Linux Audio

Check our new training course

Loading...
v6.8
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 *  linux/drivers/mmc/core/bus.h
 4 *
 5 *  Copyright (C) 2003 Russell King, All Rights Reserved.
 6 *  Copyright 2007 Pierre Ossman
 7 */
 8#ifndef _MMC_CORE_BUS_H
 9#define _MMC_CORE_BUS_H
10
11#include <linux/device.h>
12#include <linux/sysfs.h>
13
14struct mmc_host;
15struct mmc_card;
16
17#define MMC_DEV_ATTR(name, fmt, args...)					\
18static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf)	\
19{										\
20	struct mmc_card *card = mmc_dev_to_card(dev);				\
21	return sysfs_emit(buf, fmt, args);					\
22}										\
23static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
24
25struct mmc_card *mmc_alloc_card(struct mmc_host *host,
26	struct device_type *type);
27int mmc_add_card(struct mmc_card *card);
28void mmc_remove_card(struct mmc_card *card);
29
30int mmc_register_bus(void);
31void mmc_unregister_bus(void);
32
33struct mmc_driver {
34	struct device_driver drv;
35	int (*probe)(struct mmc_card *card);
36	void (*remove)(struct mmc_card *card);
37	void (*shutdown)(struct mmc_card *card);
38};
39
40int mmc_register_driver(struct mmc_driver *drv);
41void mmc_unregister_driver(struct mmc_driver *drv);
42
43#endif
v5.4
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 *  linux/drivers/mmc/core/bus.h
 4 *
 5 *  Copyright (C) 2003 Russell King, All Rights Reserved.
 6 *  Copyright 2007 Pierre Ossman
 7 */
 8#ifndef _MMC_CORE_BUS_H
 9#define _MMC_CORE_BUS_H
10
11#include <linux/device.h>
 
12
13struct mmc_host;
14struct mmc_card;
15
16#define MMC_DEV_ATTR(name, fmt, args...)					\
17static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf)	\
18{										\
19	struct mmc_card *card = mmc_dev_to_card(dev);				\
20	return sprintf(buf, fmt, args);						\
21}										\
22static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
23
24struct mmc_card *mmc_alloc_card(struct mmc_host *host,
25	struct device_type *type);
26int mmc_add_card(struct mmc_card *card);
27void mmc_remove_card(struct mmc_card *card);
28
29int mmc_register_bus(void);
30void mmc_unregister_bus(void);
31
32struct mmc_driver {
33	struct device_driver drv;
34	int (*probe)(struct mmc_card *card);
35	void (*remove)(struct mmc_card *card);
36	void (*shutdown)(struct mmc_card *card);
37};
38
39int mmc_register_driver(struct mmc_driver *drv);
40void mmc_unregister_driver(struct mmc_driver *drv);
41
42#endif