mmc: move layer init and workqueue to core file
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
This commit is contained in:
@@ -27,7 +27,8 @@
|
||||
#include <linux/mmc/sd.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "sysfs.h"
|
||||
#include "bus.h"
|
||||
#include "host.h"
|
||||
|
||||
#include "mmc_ops.h"
|
||||
#include "sd_ops.h"
|
||||
@@ -35,6 +36,25 @@
|
||||
extern int mmc_attach_mmc(struct mmc_host *host, u32 ocr);
|
||||
extern int mmc_attach_sd(struct mmc_host *host, u32 ocr);
|
||||
|
||||
static struct workqueue_struct *workqueue;
|
||||
|
||||
/*
|
||||
* Internal function. Schedule delayed work in the MMC work queue.
|
||||
*/
|
||||
static 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.
|
||||
*/
|
||||
static void mmc_flush_scheduled_work(void)
|
||||
{
|
||||
flush_workqueue(workqueue);
|
||||
}
|
||||
|
||||
/**
|
||||
* mmc_request_done - finish processing an MMC request
|
||||
* @host: MMC host which completed request
|
||||
@@ -638,4 +658,31 @@ EXPORT_SYMBOL(mmc_resume_host);
|
||||
|
||||
#endif
|
||||
|
||||
static int __init mmc_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
workqueue = create_singlethread_workqueue("kmmcd");
|
||||
if (!workqueue)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mmc_register_bus();
|
||||
if (ret == 0) {
|
||||
ret = mmc_register_host_class();
|
||||
if (ret)
|
||||
mmc_unregister_bus();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void __exit mmc_exit(void)
|
||||
{
|
||||
mmc_unregister_host_class();
|
||||
mmc_unregister_bus();
|
||||
destroy_workqueue(workqueue);
|
||||
}
|
||||
|
||||
module_init(mmc_init);
|
||||
module_exit(mmc_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
Reference in New Issue
Block a user