Skip to content

Commit 1b3ce51

Browse files
Tetsuo Handadtor
authored andcommitted
Input: psmouse-smbus - avoid flush_scheduled_work() usage
Flushing system-wide workqueues is dangerous and will be forbidden. Replace system_wq with local psmouse_wq. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Link: https://lore.kernel.org/r/25e2b787-cb2c-fb0d-d62c-6577ad1cd9df@I-love.SAKURA.ne.jp Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 1922cc9 commit 1b3ce51

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

drivers/input/mouse/psmouse-smbus.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ struct psmouse_smbus_dev {
2626
static LIST_HEAD(psmouse_smbus_list);
2727
static DEFINE_MUTEX(psmouse_smbus_mutex);
2828

29+
static struct workqueue_struct *psmouse_smbus_wq;
30+
2931
static void psmouse_smbus_check_adapter(struct i2c_adapter *adapter)
3032
{
3133
struct psmouse_smbus_dev *smbdev;
@@ -161,7 +163,7 @@ static void psmouse_smbus_schedule_remove(struct i2c_client *client)
161163
INIT_WORK(&rwork->work, psmouse_smbus_remove_i2c_device);
162164
rwork->client = client;
163165

164-
schedule_work(&rwork->work);
166+
queue_work(psmouse_smbus_wq, &rwork->work);
165167
}
166168
}
167169

@@ -305,9 +307,14 @@ int __init psmouse_smbus_module_init(void)
305307
{
306308
int error;
307309

310+
psmouse_smbus_wq = alloc_workqueue("psmouse-smbus", 0, 0);
311+
if (!psmouse_smbus_wq)
312+
return -ENOMEM;
313+
308314
error = bus_register_notifier(&i2c_bus_type, &psmouse_smbus_notifier);
309315
if (error) {
310316
pr_err("failed to register i2c bus notifier: %d\n", error);
317+
destroy_workqueue(psmouse_smbus_wq);
311318
return error;
312319
}
313320

@@ -317,5 +324,5 @@ int __init psmouse_smbus_module_init(void)
317324
void psmouse_smbus_module_exit(void)
318325
{
319326
bus_unregister_notifier(&i2c_bus_type, &psmouse_smbus_notifier);
320-
flush_scheduled_work();
327+
destroy_workqueue(psmouse_smbus_wq);
321328
}

0 commit comments

Comments
 (0)