2 * linux/drivers/mmc/core/sysfs.c
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 * Copyright 2007 Pierre Ossman
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * MMC sysfs/driver model support.
13 #include <linux/module.h>
14 #include <linux/init.h>
15 #include <linux/device.h>
16 #include <linux/idr.h>
17 #include <linux/workqueue.h>
19 #include <linux/mmc/card.h>
20 #include <linux/mmc/host.h>
26 int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs)
31 for (i = 0; attr_name(attrs[i]); i++) {
32 error = device_create_file(&card->dev, &attrs[i]);
35 device_remove_file(&card->dev, &attrs[i]);
43 void mmc_remove_attrs(struct mmc_card *card, struct device_attribute *attrs)
47 for (i = 0; attr_name(attrs[i]); i++)
48 device_remove_file(&card->dev, &attrs[i]);
51 static struct workqueue_struct *workqueue;
54 * Internal function. Schedule delayed work in the MMC work queue.
56 int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay)
58 return queue_delayed_work(workqueue, work, delay);
62 * Internal function. Flush all scheduled work from the MMC work queue.
64 void mmc_flush_scheduled_work(void)
66 flush_workqueue(workqueue);
69 static int __init mmc_init(void)
73 workqueue = create_singlethread_workqueue("kmmcd");
77 ret = mmc_register_bus();
79 ret = mmc_register_host_class();
86 static void __exit mmc_exit(void)
88 mmc_unregister_host_class();
90 destroy_workqueue(workqueue);
93 module_init(mmc_init);
94 module_exit(mmc_exit);