From: Wanhui Fu <fuwh1120@163.com>
To: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Cc: "Andreas Kemnade" <andreas@kemnade.info>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-kernel@vger.kernel.org, "Wanhui Fu" <fuwh1120@163.com>
Subject: [PATCH v2 1/3] iio: adc: twl6030-gpadc: use devm_add_action_or_reset() to disable IRQ
Date: Mon, 23 Nov 2026 11:53:29 +0800 [thread overview]
Message-ID: <20261123035331.1871875-2-fuwh1120@163.com> (raw)
In-Reply-To: <20261123035331.1871875-1-fuwh1120@163.com>
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.
Fixes: 1696f36482e7 ("iio: twl6030-gpadc: TWL6030, TWL6032 GPADC driver")
Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
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);
}
--
2.25.1
next prev parent reply other threads:[~2026-11-23 3:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 3:53 [PATCH v2 0/3] iio: adc: twl6030-gpadc: convert probe/remove cleanup to devm Wanhui Fu
2026-11-23 3:53 ` Wanhui Fu [this message]
2026-11-23 3:53 ` [PATCH v2 2/3] iio: adc: twl6030-gpadc: switch to devm_iio_device_register() Wanhui Fu
2026-11-23 3:53 ` [PATCH v2 3/3] iio: adc: twl6030-gpadc: delete redundant dev_err() messages in probe Wanhui Fu
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=20261123035331.1871875-2-fuwh1120@163.com \
--to=fuwh1120@163.com \
--cc=andreas@kemnade.info \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.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
all inboxes | Powered by JetHome®