From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 15384C433EF for ; Sun, 20 Feb 2022 11:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pCmt5TNiKuy7l8tpMpB1QERHs5uSHBdf2MXJTnzQQMA=; b=hVb1w7Smdp3CvJ Tt/klRSSiUPX6puQemHeRA7WoqeZFntUrbEkIfij7YZOOa4XazVRvalGe1I447QYVyChyQILAlwst IjR1rUZ8XuIl/SDHCxEsZRICy01KujZLZVAO+2fpiSjU7AtlwxvF+ssVN0Oj0LcuQYVxIc6VJajq2 woYTHaiQ/LJV3H3Tafgczj0T8EBPwaoyXExQ4NfRyELmwvqqaUfLq5c1/38yVbNV3+JNCuNODVhAP l1u5tv/ufWQjSglYG/QWAAJhNYOFpN6l8C0QckkiDohr0eL4VnlLvmTYoV+grfaiivNoeoK1CL5Cr sUR6lCKC55PLM3TW8Oqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLkYa-0019e1-Ca; Sun, 20 Feb 2022 11:39:12 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLkYW-0019cm-EP for linux-arm-kernel@lists.infradead.org; Sun, 20 Feb 2022 11:39:10 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2FA9FB809E3; Sun, 20 Feb 2022 11:39:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68A1FC340E8; Sun, 20 Feb 2022 11:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645357144; bh=+CU4F09gW1jBdGn9D9BvL+RyHIoPA31D2oqtNT2Ket4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=d/++ud/mknmxEatFHQl7zc4/SOTpe35Zw8tYVB0WkYJTKiQiKQuFMtzBCJOWBk2gY EXiOi0KexVIe+GDG1xMxaO9Qx88Zr624mfAMansh4SgfPRKl3m7J6OMvm9GscSL1Ad kCqwkKSp0ozLJlZCBZ+ut7m3zoqeA3A8rGIXkBnFalSFOYOaAG8/YtDYQcAk+GNL4a 5UuL8gv7wP7e1JdhbChujxKDDsXTpQPdHTHDUueLDhb7m48GQBZqxnb57dLPbQH+aZ cXfUlpJOrrKYkjxg/9H2+keBOq/44MHz0xENSJZ24E425uflChoL8E7IZq00ZlGcJ8 ehTzwWbciwDqQ== Date: Sun, 20 Feb 2022 11:45:52 +0000 From: Jonathan Cameron To: Christophe JAILLET Cc: Anand Ashok Dumbre , Lars-Peter Clausen , Michal Simek , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] iio: adc: xilinx-ams: Use devm_delayed_work_autocancel() to simplify code Message-ID: <20220220114552.53fedd33@jic23-huawei> In-Reply-To: <2626e6a057e40cd2271ef0e5f81d12e607bad5b4.1644776929.git.christophe.jaillet@wanadoo.fr> References: <2626e6a057e40cd2271ef0e5f81d12e607bad5b4.1644776929.git.christophe.jaillet@wanadoo.fr> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220220_033908_693332_F66DBB06 X-CRM114-Status: GOOD ( 20.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, 13 Feb 2022 19:29:05 +0100 Christophe JAILLET wrote: > Use devm_delayed_work_autocancel() instead of hand writing it. This is > less verbose and saves a few lines of code. > > devm_delayed_work_autocancel() uses devm_add_action() instead of > devm_add_action_or_reset(). This is fine, because if the underlying memory > allocation fails, no work has been scheduled yet. So there is nothing to > undo. > > Signed-off-by: Christophe JAILLET Looks good to me, but I'd ideally like some input from someone familiar with the driver. Thanks, Jonathan > --- > drivers/iio/adc/xilinx-ams.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c > index 8343c5f74121..6ffddf4038b8 100644 > --- a/drivers/iio/adc/xilinx-ams.c > +++ b/drivers/iio/adc/xilinx-ams.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1348,11 +1349,6 @@ static void ams_clk_disable_unprepare(void *data) > clk_disable_unprepare(data); > } > > -static void ams_cancel_delayed_work(void *data) > -{ > - cancel_delayed_work(data); > -} > - > static int ams_probe(struct platform_device *pdev) > { > struct iio_dev *indio_dev; > @@ -1389,9 +1385,8 @@ static int ams_probe(struct platform_device *pdev) > if (ret < 0) > return ret; > > - INIT_DELAYED_WORK(&ams->ams_unmask_work, ams_unmask_worker); > - ret = devm_add_action_or_reset(&pdev->dev, ams_cancel_delayed_work, > - &ams->ams_unmask_work); > + ret = devm_delayed_work_autocancel(&pdev->dev, &ams->ams_unmask_work, > + ams_unmask_worker); > if (ret < 0) > return ret; > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel