diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2007-05-27 06:00:02 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-09-23 13:55:26 -0400 |
commit | f76c85154d320497bf1a939a98d6c432edcbd4a9 (patch) | |
tree | e0da7140f0aa3d50f501aca6a1439ebe1c973e9d | |
parent | e29a7d73f4277eb92aa64e17017dea33460828ef (diff) |
mmc: add SDIO driver handling
Add basic driver handling to the SDIO device model.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
-rw-r--r-- | drivers/mmc/core/sdio_bus.c | 23 | ||||
-rw-r--r-- | include/linux/mmc/sdio_func.h | 18 |
2 files changed, 41 insertions, 0 deletions
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index 59c909e1c7c6..fa488cea8594 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c | |||
@@ -67,6 +67,29 @@ void sdio_unregister_bus(void) | |||
67 | bus_unregister(&sdio_bus_type); | 67 | bus_unregister(&sdio_bus_type); |
68 | } | 68 | } |
69 | 69 | ||
70 | /** | ||
71 | * sdio_register_driver - register a function driver | ||
72 | * @drv: SDIO function driver | ||
73 | */ | ||
74 | int sdio_register_driver(struct sdio_driver *drv) | ||
75 | { | ||
76 | drv->drv.name = drv->name; | ||
77 | drv->drv.bus = &sdio_bus_type; | ||
78 | return driver_register(&drv->drv); | ||
79 | } | ||
80 | EXPORT_SYMBOL_GPL(sdio_register_driver); | ||
81 | |||
82 | /** | ||
83 | * sdio_unregister_driver - unregister a function driver | ||
84 | * @drv: SDIO function driver | ||
85 | */ | ||
86 | void sdio_unregister_driver(struct sdio_driver *drv) | ||
87 | { | ||
88 | drv->drv.bus = &sdio_bus_type; | ||
89 | driver_unregister(&drv->drv); | ||
90 | } | ||
91 | EXPORT_SYMBOL_GPL(sdio_unregister_driver); | ||
92 | |||
70 | static void sdio_release_func(struct device *dev) | 93 | static void sdio_release_func(struct device *dev) |
71 | { | 94 | { |
72 | struct sdio_func *func = dev_to_sdio_func(dev); | 95 | struct sdio_func *func = dev_to_sdio_func(dev); |
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h index 50c78db420e6..13a1a9ca4b66 100644 --- a/include/linux/mmc/sdio_func.h +++ b/include/linux/mmc/sdio_func.h | |||
@@ -31,5 +31,23 @@ struct sdio_func { | |||
31 | 31 | ||
32 | #define sdio_func_id(f) ((f)->dev.bus_id) | 32 | #define sdio_func_id(f) ((f)->dev.bus_id) |
33 | 33 | ||
34 | #define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) | ||
35 | #define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) | ||
36 | |||
37 | /* | ||
38 | * SDIO function device driver | ||
39 | */ | ||
40 | struct sdio_driver { | ||
41 | char *name; | ||
42 | |||
43 | int (*probe)(struct sdio_func *); | ||
44 | void (*remove)(struct sdio_func *); | ||
45 | |||
46 | struct device_driver drv; | ||
47 | }; | ||
48 | |||
49 | extern int sdio_register_driver(struct sdio_driver *); | ||
50 | extern void sdio_unregister_driver(struct sdio_driver *); | ||
51 | |||
34 | #endif | 52 | #endif |
35 | 53 | ||