aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/tifm_core.c
diff options
context:
space:
mode:
authorAlex Dubov <oakad@yahoo.com>2006-12-18 14:20:06 +1100
committerPierre Ossman <drzeus@drzeus.cx>2007-02-04 20:54:09 +0100
commit7146f0d3bd2bcd0100a5db54f4ba9edc1042fe01 (patch)
treebb8dd99b153d6aa8fe565be7256a586b0abd2977 /drivers/misc/tifm_core.c
parent6412d927313f08808d61b7efba8da43717d4e8d2 (diff)
tifm_7xx1: switch from workqueue to kthread
As there's only one work item (media_switcher) to handle and it's effectively serialized with itself, I found it more convenient to use kthread instead of workqueue. This also allows for a working implementation of suspend/resume, which were totally broken in the past version. Signed-off-by: Alex Dubov <oakad@yahoo.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/misc/tifm_core.c')
-rw-r--r--drivers/misc/tifm_core.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index 3eaf2c985b7..4d62dab2ada 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -71,8 +71,6 @@ static void tifm_free(struct class_device *cdev)
struct tifm_adapter *fm = container_of(cdev, struct tifm_adapter, cdev);
kfree(fm->sockets);
- if (fm->wq)
- destroy_workqueue(fm->wq);
kfree(fm);
}
@@ -101,7 +99,8 @@ void tifm_free_adapter(struct tifm_adapter *fm)
}
EXPORT_SYMBOL(tifm_free_adapter);
-int tifm_add_adapter(struct tifm_adapter *fm)
+int tifm_add_adapter(struct tifm_adapter *fm,
+ int (*mediathreadfn)(void *data))
{
int rc;
@@ -113,10 +112,10 @@ int tifm_add_adapter(struct tifm_adapter *fm)
spin_unlock(&tifm_adapter_lock);
if (!rc) {
snprintf(fm->cdev.class_id, BUS_ID_SIZE, "tifm%u", fm->id);
- strncpy(fm->wq_name, fm->cdev.class_id, KOBJ_NAME_LEN);
+ fm->media_switcher = kthread_create(mediathreadfn,
+ fm, "tifm/%u", fm->id);
- fm->wq = create_singlethread_workqueue(fm->wq_name);
- if (fm->wq)
+ if (!IS_ERR(fm->media_switcher))
return class_device_add(&fm->cdev);
spin_lock(&tifm_adapter_lock);