Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38357
b: refs/heads/master
c: 7104e2d
h: refs/heads/master
i:
  38355: 98f807a
v: v3
  • Loading branch information
Pierre Ossman authored and Linus Torvalds committed Oct 4, 2006
1 parent 656b724 commit 887eab5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a4da1430f7f2a16df3be9c7b5d55ba4e75b708c
refs/heads/master: 7104e2d5a85b4b786d6a63568beffe1e185547bb
6 changes: 3 additions & 3 deletions trunk/drivers/mmc/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,9 +1166,9 @@ static void mmc_setup(struct mmc_host *host)
void mmc_detect_change(struct mmc_host *host, unsigned long delay)
{
if (delay)
schedule_delayed_work(&host->detect, delay);
mmc_schedule_delayed_work(&host->detect, delay);
else
schedule_work(&host->detect);
mmc_schedule_work(&host->detect);
}

EXPORT_SYMBOL(mmc_detect_change);
Expand Down Expand Up @@ -1311,7 +1311,7 @@ EXPORT_SYMBOL(mmc_remove_host);
*/
void mmc_free_host(struct mmc_host *host)
{
flush_scheduled_work();
mmc_flush_scheduled_work();
mmc_free_host_sysfs(host);
}

Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/mmc/mmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ struct mmc_host *mmc_alloc_host_sysfs(int extra, struct device *dev);
int mmc_add_host_sysfs(struct mmc_host *host);
void mmc_remove_host_sysfs(struct mmc_host *host);
void mmc_free_host_sysfs(struct mmc_host *host);

int mmc_schedule_work(struct work_struct *work);
int mmc_schedule_delayed_work(struct work_struct *work, unsigned long delay);
void mmc_flush_scheduled_work(void);
#endif
35 changes: 34 additions & 1 deletion trunk/drivers/mmc/mmc_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -317,10 +318,41 @@ void mmc_free_host_sysfs(struct mmc_host *host)
class_device_put(&host->class_dev);
}

static struct workqueue_struct *workqueue;

/*
* Internal function. Schedule work in the MMC work queue.
*/
int mmc_schedule_work(struct work_struct *work)
{
return queue_work(workqueue, work);
}

/*
* Internal function. Schedule delayed work in the MMC work queue.
*/
int mmc_schedule_delayed_work(struct work_struct *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)
Expand All @@ -333,6 +365,7 @@ static void __exit mmc_exit(void)
{
class_unregister(&mmc_host_class);
bus_unregister(&mmc_bus_type);
destroy_workqueue(workqueue);
}

module_init(mmc_init);
Expand Down

0 comments on commit 887eab5

Please sign in to comment.