aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.c
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-05-19 08:32:22 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-07-09 15:28:06 -0400
commitffce2e7e7060c949ccd703dacc9b3dd81b377373 (patch)
tree9a33cf6a4567ce0f20c353fcb6186ea1d6893308 /drivers/mmc/core/core.c
parentb93931a61a119575f84c33af2438b9384fde9eb7 (diff)
mmc: move layer init and workqueue to core file
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r--drivers/mmc/core/core.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 66e463d100c..b5d8a6d90cc 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -27,7 +27,8 @@
27#include <linux/mmc/sd.h> 27#include <linux/mmc/sd.h>
28 28
29#include "core.h" 29#include "core.h"
30#include "sysfs.h" 30#include "bus.h"
31#include "host.h"
31 32
32#include "mmc_ops.h" 33#include "mmc_ops.h"
33#include "sd_ops.h" 34#include "sd_ops.h"
@@ -35,6 +36,25 @@
35extern int mmc_attach_mmc(struct mmc_host *host, u32 ocr); 36extern int mmc_attach_mmc(struct mmc_host *host, u32 ocr);
36extern int mmc_attach_sd(struct mmc_host *host, u32 ocr); 37extern int mmc_attach_sd(struct mmc_host *host, u32 ocr);
37 38
39static struct workqueue_struct *workqueue;
40
41/*
42 * Internal function. Schedule delayed work in the MMC work queue.
43 */
44static int mmc_schedule_delayed_work(struct delayed_work *work,
45 unsigned long delay)
46{
47 return queue_delayed_work(workqueue, work, delay);
48}
49
50/*
51 * Internal function. Flush all scheduled work from the MMC work queue.
52 */
53static void mmc_flush_scheduled_work(void)
54{
55 flush_workqueue(workqueue);
56}
57
38/** 58/**
39 * mmc_request_done - finish processing an MMC request 59 * mmc_request_done - finish processing an MMC request
40 * @host: MMC host which completed request 60 * @host: MMC host which completed request
@@ -638,4 +658,31 @@ EXPORT_SYMBOL(mmc_resume_host);
638 658
639#endif 659#endif
640 660
661static int __init mmc_init(void)
662{
663 int ret;
664
665 workqueue = create_singlethread_workqueue("kmmcd");
666 if (!workqueue)
667 return -ENOMEM;
668
669 ret = mmc_register_bus();
670 if (ret == 0) {
671 ret = mmc_register_host_class();
672 if (ret)
673 mmc_unregister_bus();
674 }
675 return ret;
676}
677
678static void __exit mmc_exit(void)
679{
680 mmc_unregister_host_class();
681 mmc_unregister_bus();
682 destroy_workqueue(workqueue);
683}
684
685module_init(mmc_init);
686module_exit(mmc_exit);
687
641MODULE_LICENSE("GPL"); 688MODULE_LICENSE("GPL");