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>
This commit is contained in:
committed by
Pierre Ossman
parent
6412d92731
commit
7146f0d3bd
@@ -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);
|
||||
|
Reference in New Issue
Block a user