Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-iio@vger.kernel.org,
	Matt Ranostay <matt.ranostay@konsulko.com>
Subject: Re: [PATCH] iio: as3935: Use devm_delayed_work_autocancel()
Date: Sun, 13 Feb 2022 16:19:22 +0000	[thread overview]
Message-ID: <20220213161922.2f2bd797@jic23-huawei> (raw)
In-Reply-To: <8d5c50f191bd8f751849d72127f83b14a7636d64.1644755396.git.christophe.jaillet@wanadoo.fr>

On Sun, 13 Feb 2022 13:30:11 +0100
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> Use devm_delayed_work_autocancel() instead of hand writing it.
> It saves a few lines of code.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Nice.

+CC Matt as it's his driver. As this is an obvious like for like replacement
I'll apply it now.

Applied to the togreg branch of iio.git and pushed out as testing
to let the autobuilders see if we missed anything.

Thanks,

Jonathan

> ---
>  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 <linux/interrupt.h>
>  #include <linux/delay.h>
>  #include <linux/workqueue.h>
> +#include <linux/devm-helpers.h>
>  #include <linux/mutex.h>
>  #include <linux/err.h>
>  #include <linux/irq.h>
> @@ -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;
>  


      reply	other threads:[~2022-02-13 16:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-13 12:30 [PATCH] iio: as3935: Use devm_delayed_work_autocancel() Christophe JAILLET
2022-02-13 16:19 ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220213161922.2f2bd797@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.ranostay@konsulko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox