14 #include <linux/device.h>
16 #include <linux/export.h>
17 #include <linux/slab.h>
28 #define sdio_config_attr(field, format_string) \
30 field##_show(struct device *dev, struct device_attribute *attr, char *buf) \
32 struct sdio_func *func; \
34 func = dev_to_sdio_func (dev); \
35 return sprintf (buf, format_string, func->field); \
46 return sprintf(buf,
"sdio:c%02Xv%04Xd%04X\n",
79 if (sdio_match_one(func, ids))
93 if (sdio_match_device(func, sdrv))
105 "SDIO_CLASS=%02X", func->
class))
113 "MODALIAS=sdio:c%02Xv%04Xd%04X",
120 static int sdio_bus_probe(
struct device *dev)
127 id = sdio_match_device(func, drv);
138 ret = pm_runtime_get_sync(dev);
149 goto disable_runtimepm;
151 ret = drv->
probe(func,
id);
153 goto disable_runtimepm;
159 pm_runtime_put_noidle(dev);
164 static int sdio_bus_remove(
struct device *dev)
172 pm_runtime_get_sync(dev);
177 pr_warning(
"WARNING: driver %s did not remove "
178 "its interrupt handler!\n", drv->
name);
186 pm_runtime_put_noidle(dev);
190 pm_runtime_put_sync(dev);
196 static const struct dev_pm_ops sdio_bus_pm_ops = {
198 pm_generic_runtime_suspend,
199 pm_generic_runtime_resume,
200 pm_generic_runtime_idle
204 #define SDIO_PM_OPS_PTR (&sdio_bus_pm_ops)
208 #define SDIO_PM_OPS_PTR NULL
212 static struct bus_type sdio_bus_type = {
214 .dev_attrs = sdio_dev_attrs,
215 .match = sdio_bus_match,
216 .uevent = sdio_bus_uevent,
217 .probe = sdio_bus_probe,
218 .remove = sdio_bus_remove,
239 drv->
drv.bus = &sdio_bus_type;
250 drv->
drv.bus = &sdio_bus_type;
255 static void sdio_release_func(
struct device *dev)
282 func->
dev.parent = &card->
dev;
283 func->
dev.bus = &sdio_bus_type;
284 func->
dev.release = sdio_release_func;