Re: [PATCH v2 1/3] iio: adc: twl6030-gpadc: use devm_add_action_or_reset() to disable IRQ

From: Jonathan Cameron

Date: Sat Nov 28 2026 - 18:37:04 EST


On Mon, 23 Nov 2026 11:53:29 +0800
Wanhui Fu <fuwh1120@xxxxxxx> wrote:

> Register twl6030_gpadc_disable_irq() via devm_add_action_or_reset()
> and remove the manual call from twl6030_gpadc_remove().
>
> Modify twl6030_gpadc_enable_irq() and twl6030_gpadc_disable_irq() to
> not take a mask argument, since the mask is always the same.

This doesn't state anywhere what is being fixed.
I want to see details on the cause and impact of the bug.

Jonathan

>
> Fixes: 1696f36482e7 ("iio: twl6030-gpadc: TWL6030, TWL6032 GPADC driver")
> Signed-off-by: Wanhui Fu <fuwh1120@xxxxxxx>
> ---
> drivers/iio/adc/twl6030-gpadc.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
> index e7fd371b3404..786059cf7513 100644
> --- a/drivers/iio/adc/twl6030-gpadc.c
> +++ b/drivers/iio/adc/twl6030-gpadc.c
> @@ -360,8 +360,9 @@ static inline int twl6030_gpadc_read(u8 reg, u8 *val)
> return twl_i2c_read(TWL6030_MODULE_GPADC, val, reg, 2);
> }
>
> -static int twl6030_gpadc_enable_irq(u8 mask)
> +static int twl6030_gpadc_enable_irq(void)
> {
> + u8 mask = TWL6030_GPADC_RT_SW1_EOC_MASK;
> int ret;
>
> ret = twl6030_interrupt_unmask(mask, REG_INT_MSK_LINE_B);
> @@ -373,8 +374,10 @@ static int twl6030_gpadc_enable_irq(u8 mask)
> return ret;
> }
>
> -static void twl6030_gpadc_disable_irq(u8 mask)
> +static void twl6030_gpadc_disable_irq(void *data)
> {
> + u8 mask = TWL6030_GPADC_RT_SW1_EOC_MASK;
> +
> twl6030_interrupt_mask(mask, REG_INT_MSK_LINE_B);
> twl6030_interrupt_mask(mask, REG_INT_MSK_STS_B);
> }
> @@ -921,12 +924,16 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - ret = twl6030_gpadc_enable_irq(TWL6030_GPADC_RT_SW1_EOC_MASK);
> + ret = twl6030_gpadc_enable_irq();
> if (ret < 0) {
> dev_err(dev, "failed to enable GPADC interrupt\n");
> return ret;
> }
>
> + ret = devm_add_action_or_reset(dev, twl6030_gpadc_disable_irq, NULL);
> + if (ret)
> + return ret;
> +
> ret = twl_i2c_write_u8(TWL6030_MODULE_ID1, TWL6030_GPADCS,
> TWL6030_REG_TOGGLE1);
> if (ret < 0) {
> @@ -967,7 +974,6 @@ static void twl6030_gpadc_remove(struct platform_device *pdev)
> {
> struct iio_dev *indio_dev = platform_get_drvdata(pdev);
>
> - twl6030_gpadc_disable_irq(TWL6030_GPADC_RT_SW1_EOC_MASK);
> iio_device_unregister(indio_dev);
> }
>