Skip to content

Commit dfafa56

Browse files
tititiou36dtor
authored andcommitted
Input: da9063 - use devm_delayed_work_autocancel()
Use devm_delayed_work_autocancel() instead of hand-writing it. This saves a few lines of code. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Link: https://lore.kernel.org/r/a76ac3f4c7aee205395b89b5b3f587e30a48df96.1645205312.git.christophe.jaillet@wanadoo.fr Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 65de58c commit dfafa56

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

drivers/input/misc/da9063_onkey.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright (C) 2015 Dialog Semiconductor Ltd.
55
*/
66

7+
#include <linux/devm-helpers.h>
78
#include <linux/module.h>
89
#include <linux/errno.h>
910
#include <linux/input.h>
@@ -182,13 +183,6 @@ static irqreturn_t da9063_onkey_irq_handler(int irq, void *data)
182183
return IRQ_HANDLED;
183184
}
184185

185-
static void da9063_cancel_poll(void *data)
186-
{
187-
struct da9063_onkey *onkey = data;
188-
189-
cancel_delayed_work_sync(&onkey->work);
190-
}
191-
192186
static int da9063_onkey_probe(struct platform_device *pdev)
193187
{
194188
struct da9063_onkey *onkey;
@@ -234,9 +228,8 @@ static int da9063_onkey_probe(struct platform_device *pdev)
234228

235229
input_set_capability(onkey->input, EV_KEY, KEY_POWER);
236230

237-
INIT_DELAYED_WORK(&onkey->work, da9063_poll_on);
238-
239-
error = devm_add_action(&pdev->dev, da9063_cancel_poll, onkey);
231+
error = devm_delayed_work_autocancel(&pdev->dev, &onkey->work,
232+
da9063_poll_on);
240233
if (error) {
241234
dev_err(&pdev->dev,
242235
"Failed to add cancel poll action: %d\n",

0 commit comments

Comments
 (0)