From patchwork Sun Feb 13 12:30:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 12744569 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 88421C433FE for ; Sun, 13 Feb 2022 12:30:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235965AbiBMMaV (ORCPT ); Sun, 13 Feb 2022 07:30:21 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235964AbiBMMaU (ORCPT ); Sun, 13 Feb 2022 07:30:20 -0500 Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B215F5AEF3 for ; Sun, 13 Feb 2022 04:30:14 -0800 (PST) Received: from pop-os.home ([90.126.236.122]) by smtp.orange.fr with ESMTPA id JE16nPuMsHZHJJE16nOrpB; Sun, 13 Feb 2022 13:30:12 +0100 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 13 Feb 2022 13:30:12 +0100 X-ME-IP: 90.126.236.122 From: Christophe JAILLET To: Jonathan Cameron , Lars-Peter Clausen Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-iio@vger.kernel.org Subject: [PATCH] iio: as3935: Use devm_delayed_work_autocancel() Date: Sun, 13 Feb 2022 13:30:11 +0100 Message-Id: <8d5c50f191bd8f751849d72127f83b14a7636d64.1644755396.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Use devm_delayed_work_autocancel() instead of hand writing it. It saves a few lines of code. Signed-off-by: Christophe JAILLET --- drivers/iio/proximity/as3935.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index bd7595db31d4..00e06491b188 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -344,14 +345,6 @@ static SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume); #define AS3935_PM_OPS NULL #endif -static void as3935_stop_work(void *data) -{ - struct iio_dev *indio_dev = data; - struct as3935_state *st = iio_priv(indio_dev); - - cancel_delayed_work_sync(&st->work); -} - static int as3935_probe(struct spi_device *spi) { struct device *dev = &spi->dev; @@ -432,8 +425,7 @@ static int as3935_probe(struct spi_device *spi) calibrate_as3935(st); - INIT_DELAYED_WORK(&st->work, as3935_event_work); - ret = devm_add_action(dev, as3935_stop_work, indio_dev); + ret = devm_delayed_work_autocancel(dev, &st->work, as3935_event_work); if (ret) return ret;