linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: da9063 - Use devm_delayed_work_autocancel()
@ 2022-02-18 17:29 Christophe JAILLET
  2022-02-22  9:16 ` Adam Thomson
  2022-03-01  7:25 ` Dmitry Torokhov
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-02-18 17:29 UTC (permalink / raw)
  To: Support Opensource, Dmitry Torokhov
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-input

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>
---
 drivers/input/misc/da9063_onkey.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/input/misc/da9063_onkey.c b/drivers/input/misc/da9063_onkey.c
index 79851923ee57..b14a389600c9 100644
--- a/drivers/input/misc/da9063_onkey.c
+++ b/drivers/input/misc/da9063_onkey.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2015  Dialog Semiconductor Ltd.
  */
 
+#include <linux/devm-helpers.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/input.h>
@@ -182,13 +183,6 @@ static irqreturn_t da9063_onkey_irq_handler(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-static void da9063_cancel_poll(void *data)
-{
-	struct da9063_onkey *onkey = data;
-
-	cancel_delayed_work_sync(&onkey->work);
-}
-
 static int da9063_onkey_probe(struct platform_device *pdev)
 {
 	struct da9063_onkey *onkey;
@@ -234,9 +228,8 @@ static int da9063_onkey_probe(struct platform_device *pdev)
 
 	input_set_capability(onkey->input, EV_KEY, KEY_POWER);
 
-	INIT_DELAYED_WORK(&onkey->work, da9063_poll_on);
-
-	error = devm_add_action(&pdev->dev, da9063_cancel_poll, onkey);
+	error = devm_delayed_work_autocancel(&pdev->dev, &onkey->work,
+					     da9063_poll_on);
 	if (error) {
 		dev_err(&pdev->dev,
 			"Failed to add cancel poll action: %d\n",
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] Input: da9063 - Use devm_delayed_work_autocancel()
  2022-02-18 17:29 [PATCH] Input: da9063 - Use devm_delayed_work_autocancel() Christophe JAILLET
@ 2022-02-22  9:16 ` Adam Thomson
  2022-03-01  7:25 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Adam Thomson @ 2022-02-22  9:16 UTC (permalink / raw)
  To: Christophe JAILLET, Support Opensource, Dmitry Torokhov
  Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-input@vger.kernel.org

On 18 February 2022 17:29, Christophe JAILLET wrote:

> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: da9063 - Use devm_delayed_work_autocancel()
  2022-02-18 17:29 [PATCH] Input: da9063 - Use devm_delayed_work_autocancel() Christophe JAILLET
  2022-02-22  9:16 ` Adam Thomson
@ 2022-03-01  7:25 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2022-03-01  7:25 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Support Opensource, linux-kernel, kernel-janitors, linux-input

On Fri, Feb 18, 2022 at 06:29:13PM +0100, Christophe JAILLET wrote:
> 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>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-01  7:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-18 17:29 [PATCH] Input: da9063 - Use devm_delayed_work_autocancel() Christophe JAILLET
2022-02-22  9:16 ` Adam Thomson
2022-03-01  7:25 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).