Re: [PATCH v5 03/13] iio: light: iqs621-als: use devm_blocking_notifier_chain_register()

Jonathan Cameron <[email protected]>
Newsgroups org.kernel.vger.linux-acpi,dev.linux.lists.acpica-devel,org.kernel.vger.linux-gpio,org.kernel.vger.linux-iio,org.kernel.vger.linux-input,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pwm,org.kernel.vger.platform-driver-x86
Message-ID <20260904035632.4aaf4eab@jic23-huawei>
On Sun, 16 Aug 2026 06:06:02 +0000
Eliav Farber <[email protected]> wrote:

> Replace the blocking_notifier_chain_register() +
> devm_add_action_or_reset() pattern with a single call to
> devm_blocking_notifier_chain_register(), removing the
> iqs621_als_notifier_unregister() callback.
> 
> Signed-off-by: Eliav Farber <[email protected]>
> Acked-by: Jonathan Cameron <[email protected]>
Applied (on top of merging the branch) to the testing branch of iio.git
Upgraded that ack to an SoB as a result.

> ---
>  drivers/iio/light/iqs621-als.c | 24 +++---------------------
>  1 file changed, 3 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/iio/light/iqs621-als.c b/drivers/iio/light/iqs621-als.c
> index cd5843e3e2c3..f9d215ef1970 100644
> --- a/drivers/iio/light/iqs621-als.c
> +++ b/drivers/iio/light/iqs621-als.c
> @@ -179,19 +179,6 @@ static int iqs621_als_notifier(struct notifier_block *notifier,
>  	return NOTIFY_OK;
>  }
>  
> -static void iqs621_als_notifier_unregister(void *context)
> -{
> -	struct iqs621_als_private *iqs621_als = context;
> -	struct iio_dev *indio_dev = iqs621_als->indio_dev;
> -	int ret;
> -
> -	ret = blocking_notifier_chain_unregister(&iqs621_als->iqs62x->nh,
> -						 &iqs621_als->notifier);
> -	if (ret)
> -		dev_err(indio_dev->dev.parent,
> -			"Failed to unregister notifier: %d\n", ret);
> -}
> -
>  static int iqs621_als_read_raw(struct iio_dev *indio_dev,
>  			       struct iio_chan_spec const *chan,
>  			       int *val, int *val2, long mask)
> @@ -563,19 +550,14 @@ static int iqs621_als_probe(struct platform_device *pdev)
>  	mutex_init(&iqs621_als->lock);
>  
>  	iqs621_als->notifier.notifier_call = iqs621_als_notifier;
> -	ret = blocking_notifier_chain_register(&iqs621_als->iqs62x->nh,
> -					       &iqs621_als->notifier);
> +	ret = devm_blocking_notifier_chain_register(&pdev->dev,
> +						    &iqs621_als->iqs62x->nh,
> +						    &iqs621_als->notifier);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to register notifier: %d\n", ret);
>  		return ret;
>  	}
>  
> -	ret = devm_add_action_or_reset(&pdev->dev,
> -				       iqs621_als_notifier_unregister,
> -				       iqs621_als);
> -	if (ret)
> -		return ret;
> -
>  	return devm_iio_device_register(&pdev->dev, indio_dev);
>  }
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.