From patchwork Fri Feb 18 17:29:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 12751683 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3914C433EF for ; Fri, 18 Feb 2022 17:29:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238613AbiBRR3i (ORCPT ); Fri, 18 Feb 2022 12:29:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238604AbiBRR3h (ORCPT ); Fri, 18 Feb 2022 12:29:37 -0500 Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39D502B3AC6 for ; Fri, 18 Feb 2022 09:29:20 -0800 (PST) Received: from pop-os.home ([90.126.236.122]) by smtp.orange.fr with ESMTPA id L74GnW5saFTgbL74Hni9ks; Fri, 18 Feb 2022 18:29:17 +0100 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Fri, 18 Feb 2022 18:29:17 +0100 X-ME-IP: 90.126.236.122 From: Christophe JAILLET To: Support Opensource , Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-input@vger.kernel.org Subject: [PATCH] Input: da9063 - Use devm_delayed_work_autocancel() Date: Fri, 18 Feb 2022 18:29:13 +0100 Message-Id: X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Use devm_delayed_work_autocancel() instead of hand-writing it. This saves a few lines of code. Signed-off-by: Christophe JAILLET Reviewed-by: Adam Thomson --- 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 #include #include #include @@ -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",