summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2022-05-16 21:04:59 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2022-05-16 21:10:14 -0700
commit1b3ce51dde3652960ba74e20d1990e5c23d25105 (patch)
treee1200de34ecc795c757c0925b67676cd014a1615 /drivers/input
parent1922cc9c20a38a12ca1d8e44d3ccede62b59d5e8 (diff)
downloadlinux-1b3ce51dde3652960ba74e20d1990e5c23d25105.tar.bz2
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>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/psmouse-smbus.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/input/mouse/psmouse-smbus.c b/drivers/input/mouse/psmouse-smbus.c
index 164f6c757f6b..2a2459b1b4f2 100644
--- a/drivers/input/mouse/psmouse-smbus.c
+++ b/drivers/input/mouse/psmouse-smbus.c
@@ -26,6 +26,8 @@ struct psmouse_smbus_dev {
static LIST_HEAD(psmouse_smbus_list);
static DEFINE_MUTEX(psmouse_smbus_mutex);
+static struct workqueue_struct *psmouse_smbus_wq;
+
static void psmouse_smbus_check_adapter(struct i2c_adapter *adapter)
{
struct psmouse_smbus_dev *smbdev;
@@ -161,7 +163,7 @@ static void psmouse_smbus_schedule_remove(struct i2c_client *client)
INIT_WORK(&rwork->work, psmouse_smbus_remove_i2c_device);
rwork->client = client;
- schedule_work(&rwork->work);
+ queue_work(psmouse_smbus_wq, &rwork->work);
}
}
@@ -305,9 +307,14 @@ int __init psmouse_smbus_module_init(void)
{
int error;
+ psmouse_smbus_wq = alloc_workqueue("psmouse-smbus", 0, 0);
+ if (!psmouse_smbus_wq)
+ return -ENOMEM;
+
error = bus_register_notifier(&i2c_bus_type, &psmouse_smbus_notifier);
if (error) {
pr_err("failed to register i2c bus notifier: %d\n", error);
+ destroy_workqueue(psmouse_smbus_wq);
return error;
}
@@ -317,5 +324,5 @@ int __init psmouse_smbus_module_init(void)
void psmouse_smbus_module_exit(void)
{
bus_unregister_notifier(&i2c_bus_type, &psmouse_smbus_notifier);
- flush_scheduled_work();
+ destroy_workqueue(psmouse_smbus_wq);
}