]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
mmc: add SDIO driver handling
authorPierre Ossman <drzeus@drzeus.cx>
Sun, 27 May 2007 10:00:02 +0000 (12:00 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Sun, 23 Sep 2007 17:55:26 +0000 (19:55 +0200)
Add basic driver handling to the SDIO device model.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/core/sdio_bus.c
include/linux/mmc/sdio_func.h

index 59c909e1c7c6c8f441ef5c2f48026c3588f577c1..fa488cea85944503fdc7198a447f2c78cb86aa42 100644 (file)
@@ -67,6 +67,29 @@ void sdio_unregister_bus(void)
        bus_unregister(&sdio_bus_type);
 }
 
+/**
+ *     sdio_register_driver - register a function driver
+ *     @drv: SDIO function driver
+ */
+int sdio_register_driver(struct sdio_driver *drv)
+{
+       drv->drv.name = drv->name;
+       drv->drv.bus = &sdio_bus_type;
+       return driver_register(&drv->drv);
+}
+EXPORT_SYMBOL_GPL(sdio_register_driver);
+
+/**
+ *     sdio_unregister_driver - unregister a function driver
+ *     @drv: SDIO function driver
+ */
+void sdio_unregister_driver(struct sdio_driver *drv)
+{
+       drv->drv.bus = &sdio_bus_type;
+       driver_unregister(&drv->drv);
+}
+EXPORT_SYMBOL_GPL(sdio_unregister_driver);
+
 static void sdio_release_func(struct device *dev)
 {
        struct sdio_func *func = dev_to_sdio_func(dev);
index 50c78db420e659410c4ac5de9ab1d7692b014aaa..13a1a9ca4b66fb8922870bf94a996ca833e137bf 100644 (file)
@@ -31,5 +31,23 @@ struct sdio_func {
 
 #define sdio_func_id(f)                ((f)->dev.bus_id)
 
+#define sdio_get_drvdata(f)    dev_get_drvdata(&(f)->dev)
+#define sdio_set_drvdata(f,d)  dev_set_drvdata(&(f)->dev, d)
+
+/*
+ * SDIO function device driver
+ */
+struct sdio_driver {
+       char *name;
+
+       int (*probe)(struct sdio_func *);
+       void (*remove)(struct sdio_func *);
+
+       struct device_driver drv;
+};
+
+extern int sdio_register_driver(struct sdio_driver *);
+extern void sdio_unregister_driver(struct sdio_driver *);
+
 #endif