diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2007-05-19 08:32:22 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-07-09 15:28:06 -0400 |
commit | ffce2e7e7060c949ccd703dacc9b3dd81b377373 (patch) | |
tree | 9a33cf6a4567ce0f20c353fcb6186ea1d6893308 /drivers | |
parent | b93931a61a119575f84c33af2438b9384fde9eb7 (diff) |
mmc: move layer init and workqueue to core file
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/core/core.c | 49 | ||||
-rw-r--r-- | drivers/mmc/core/sysfs.c | 51 | ||||
-rw-r--r-- | drivers/mmc/core/sysfs.h | 4 |
3 files changed, 48 insertions, 56 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 66e463d100c5..b5d8a6d90cca 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 @@ | |||
35 | extern int mmc_attach_mmc(struct mmc_host *host, u32 ocr); | 36 | extern int mmc_attach_mmc(struct mmc_host *host, u32 ocr); |
36 | extern int mmc_attach_sd(struct mmc_host *host, u32 ocr); | 37 | extern int mmc_attach_sd(struct mmc_host *host, u32 ocr); |
37 | 38 | ||
39 | static struct workqueue_struct *workqueue; | ||
40 | |||
41 | /* | ||
42 | * Internal function. Schedule delayed work in the MMC work queue. | ||
43 | */ | ||
44 | static 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 | */ | ||
53 | static 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 | ||
661 | static 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 | |||
678 | static void __exit mmc_exit(void) | ||
679 | { | ||
680 | mmc_unregister_host_class(); | ||
681 | mmc_unregister_bus(); | ||
682 | destroy_workqueue(workqueue); | ||
683 | } | ||
684 | |||
685 | module_init(mmc_init); | ||
686 | module_exit(mmc_exit); | ||
687 | |||
641 | MODULE_LICENSE("GPL"); | 688 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/mmc/core/sysfs.c b/drivers/mmc/core/sysfs.c index fbf99f9a0b83..00a97e70f914 100644 --- a/drivers/mmc/core/sysfs.c +++ b/drivers/mmc/core/sysfs.c | |||
@@ -10,17 +10,10 @@ | |||
10 | * | 10 | * |
11 | * MMC sysfs/driver model support. | 11 | * MMC sysfs/driver model support. |
12 | */ | 12 | */ |
13 | #include <linux/module.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/device.h> | 13 | #include <linux/device.h> |
16 | #include <linux/idr.h> | ||
17 | #include <linux/workqueue.h> | ||
18 | 14 | ||
19 | #include <linux/mmc/card.h> | 15 | #include <linux/mmc/card.h> |
20 | #include <linux/mmc/host.h> | ||
21 | 16 | ||
22 | #include "bus.h" | ||
23 | #include "host.h" | ||
24 | #include "sysfs.h" | 17 | #include "sysfs.h" |
25 | 18 | ||
26 | int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs) | 19 | int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs) |
@@ -48,47 +41,3 @@ void mmc_remove_attrs(struct mmc_card *card, struct device_attribute *attrs) | |||
48 | device_remove_file(&card->dev, &attrs[i]); | 41 | device_remove_file(&card->dev, &attrs[i]); |
49 | } | 42 | } |
50 | 43 | ||
51 | static struct workqueue_struct *workqueue; | ||
52 | |||
53 | /* | ||
54 | * Internal function. Schedule delayed work in the MMC work queue. | ||
55 | */ | ||
56 | int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay) | ||
57 | { | ||
58 | return queue_delayed_work(workqueue, work, delay); | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | * Internal function. Flush all scheduled work from the MMC work queue. | ||
63 | */ | ||
64 | void mmc_flush_scheduled_work(void) | ||
65 | { | ||
66 | flush_workqueue(workqueue); | ||
67 | } | ||
68 | |||
69 | static int __init mmc_init(void) | ||
70 | { | ||
71 | int ret; | ||
72 | |||
73 | workqueue = create_singlethread_workqueue("kmmcd"); | ||
74 | if (!workqueue) | ||
75 | return -ENOMEM; | ||
76 | |||
77 | ret = mmc_register_bus(); | ||
78 | if (ret == 0) { | ||
79 | ret = mmc_register_host_class(); | ||
80 | if (ret) | ||
81 | mmc_unregister_bus(); | ||
82 | } | ||
83 | return ret; | ||
84 | } | ||
85 | |||
86 | static void __exit mmc_exit(void) | ||
87 | { | ||
88 | mmc_unregister_host_class(); | ||
89 | mmc_unregister_bus(); | ||
90 | destroy_workqueue(workqueue); | ||
91 | } | ||
92 | |||
93 | module_init(mmc_init); | ||
94 | module_exit(mmc_exit); | ||
diff --git a/drivers/mmc/core/sysfs.h b/drivers/mmc/core/sysfs.h index 2f60c79b203b..4b8f670bd10f 100644 --- a/drivers/mmc/core/sysfs.h +++ b/drivers/mmc/core/sysfs.h | |||
@@ -23,8 +23,4 @@ static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *a | |||
23 | int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs); | 23 | int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs); |
24 | void mmc_remove_attrs(struct mmc_card *card, struct device_attribute *attrs); | 24 | void mmc_remove_attrs(struct mmc_card *card, struct device_attribute *attrs); |
25 | 25 | ||
26 | int mmc_schedule_work(struct work_struct *work); | ||
27 | int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay); | ||
28 | void mmc_flush_scheduled_work(void); | ||
29 | |||
30 | #endif | 26 | #endif |