1) Use msecs_to_jiffies() instead of calculating by hand.
2) Call cancel_delayed_work_sync() instead of cancel_delayed_work()
followed by a separate flush_workqueue().
3) Remove the "tsc->wq = 0;" Sparse complains about that because
tsc->wq is a pointer, not an int. It's not needed because we just
free the pointer anyway.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
if (poll) {
schd = queue_delayed_work(tsc->wq, &tsc->work,
if (poll) {
schd = queue_delayed_work(tsc->wq, &tsc->work,
- tsc->poll_period * HZ / 1000);
+ msecs_to_jiffies(tsc->poll_period));
if (schd)
tsc->polling = 1;
else {
if (schd)
tsc->polling = 1;
else {
goto err2;
schd = queue_delayed_work(tsc->wq, &tsc->work,
goto err2;
schd = queue_delayed_work(tsc->wq, &tsc->work,
- tsc->poll_period * HZ / 1000);
+ msecs_to_jiffies(tsc->poll_period));
if (schd)
tsc->polling = 1;
if (schd)
tsc->polling = 1;
- cancel_delayed_work(&tsc->work);
- flush_workqueue(tsc->wq);
+ cancel_delayed_work_sync(&tsc->work);
destroy_workqueue(tsc->wq);
destroy_workqueue(tsc->wq);
input_free_device(input_dev);
err1:
kfree(tsc);
input_free_device(input_dev);
err1:
kfree(tsc);
- cancel_delayed_work(&tsc->work);
- flush_workqueue(tsc->wq);
+ cancel_delayed_work_sync(&tsc->work);
destroy_workqueue(tsc->wq);
destroy_workqueue(tsc->wq);
input_free_device(input_dev);
input_free_device(input_dev);