]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/mmc/mmc_sysfs.c
WorkStruct: make allyesconfig
[net-next-2.6.git] / drivers / mmc / mmc_sysfs.c
index 3f4a66ca9555e6c354c468266d22609adf56c628..fd9a5fc6db7becf7ab9d490af15e400c8f6e7767 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/device.h>
 #include <linux/idr.h>
+#include <linux/workqueue.h>
 
 #include <linux/mmc/card.h>
 #include <linux/mmc/host.h>
@@ -80,7 +81,7 @@ static int mmc_bus_match(struct device *dev, struct device_driver *drv)
 }
 
 static int
-mmc_bus_hotplug(struct device *dev, char **envp, int num_envp, char *buf,
+mmc_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf,
                int buf_size)
 {
        struct mmc_card *card = dev_to_mmc_card(dev);
@@ -136,17 +137,7 @@ static int mmc_bus_resume(struct device *dev)
        return ret;
 }
 
-static struct bus_type mmc_bus_type = {
-       .name           = "mmc",
-       .dev_attrs      = mmc_dev_attrs,
-       .match          = mmc_bus_match,
-       .hotplug        = mmc_bus_hotplug,
-       .suspend        = mmc_bus_suspend,
-       .resume         = mmc_bus_resume,
-};
-
-
-static int mmc_drv_probe(struct device *dev)
+static int mmc_bus_probe(struct device *dev)
 {
        struct mmc_driver *drv = to_mmc_driver(dev->driver);
        struct mmc_card *card = dev_to_mmc_card(dev);
@@ -154,7 +145,7 @@ static int mmc_drv_probe(struct device *dev)
        return drv->probe(card);
 }
 
-static int mmc_drv_remove(struct device *dev)
+static int mmc_bus_remove(struct device *dev)
 {
        struct mmc_driver *drv = to_mmc_driver(dev->driver);
        struct mmc_card *card = dev_to_mmc_card(dev);
@@ -164,6 +155,16 @@ static int mmc_drv_remove(struct device *dev)
        return 0;
 }
 
+static struct bus_type mmc_bus_type = {
+       .name           = "mmc",
+       .dev_attrs      = mmc_dev_attrs,
+       .match          = mmc_bus_match,
+       .uevent         = mmc_bus_uevent,
+       .probe          = mmc_bus_probe,
+       .remove         = mmc_bus_remove,
+       .suspend        = mmc_bus_suspend,
+       .resume         = mmc_bus_resume,
+};
 
 /**
  *     mmc_register_driver - register a media driver
@@ -172,8 +173,6 @@ static int mmc_drv_remove(struct device *dev)
 int mmc_register_driver(struct mmc_driver *drv)
 {
        drv->drv.bus = &mmc_bus_type;
-       drv->drv.probe = mmc_drv_probe;
-       drv->drv.remove = mmc_drv_remove;
        return driver_register(&drv->drv);
 }
 
@@ -319,10 +318,33 @@ void mmc_free_host_sysfs(struct mmc_host *host)
        class_device_put(&host->class_dev);
 }
 
+static struct workqueue_struct *workqueue;
+
+/*
+ * Internal function. Schedule delayed work in the MMC work queue.
+ */
+int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay)
+{
+       return queue_delayed_work(workqueue, work, delay);
+}
+
+/*
+ * Internal function. Flush all scheduled work from the MMC work queue.
+ */
+void mmc_flush_scheduled_work(void)
+{
+       flush_workqueue(workqueue);
+}
 
 static int __init mmc_init(void)
 {
-       int ret = bus_register(&mmc_bus_type);
+       int ret;
+
+       workqueue = create_singlethread_workqueue("kmmcd");
+       if (!workqueue)
+               return -ENOMEM;
+
+       ret = bus_register(&mmc_bus_type);
        if (ret == 0) {
                ret = class_register(&mmc_host_class);
                if (ret)
@@ -335,6 +357,7 @@ static void __exit mmc_exit(void)
 {
        class_unregister(&mmc_host_class);
        bus_unregister(&mmc_bus_type);
+       destroy_workqueue(workqueue);
 }
 
 module_init(mmc_init);