Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  linux/drivers/mmc/core/bus.h
0004  *
0005  *  Copyright (C) 2003 Russell King, All Rights Reserved.
0006  *  Copyright 2007 Pierre Ossman
0007  */
0008 #ifndef _MMC_CORE_BUS_H
0009 #define _MMC_CORE_BUS_H
0010 
0011 #include <linux/device.h>
0012 #include <linux/sysfs.h>
0013 
0014 struct mmc_host;
0015 struct mmc_card;
0016 
0017 #define MMC_DEV_ATTR(name, fmt, args...)                    \
0018 static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \
0019 {                                       \
0020     struct mmc_card *card = mmc_dev_to_card(dev);               \
0021     return sysfs_emit(buf, fmt, args);                  \
0022 }                                       \
0023 static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
0024 
0025 struct mmc_card *mmc_alloc_card(struct mmc_host *host,
0026     struct device_type *type);
0027 int mmc_add_card(struct mmc_card *card);
0028 void mmc_remove_card(struct mmc_card *card);
0029 
0030 int mmc_register_bus(void);
0031 void mmc_unregister_bus(void);
0032 
0033 struct mmc_driver {
0034     struct device_driver drv;
0035     int (*probe)(struct mmc_card *card);
0036     void (*remove)(struct mmc_card *card);
0037     void (*shutdown)(struct mmc_card *card);
0038 };
0039 
0040 int mmc_register_driver(struct mmc_driver *drv);
0041 void mmc_unregister_driver(struct mmc_driver *drv);
0042 
0043 #endif