[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260205131234.3244467-7-harshit.m.mogalapalli@oracle.com>
Date: Thu, 5 Feb 2026 05:12:12 -0800
From: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
To: Jonathan Cameron <jic23@...nel.org>, David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>,
Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>,
Andrew Ijano <andrew.ijano@...il.com>,
Antoniu Miclaus <antoniu.miclaus@...log.com>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, andriy.shevchenko@...el.com
Subject: [PATCH v5 next 6/7] iio: sca3000: stop interrupts via devm_add_action_or_reset()
Used devm_add_action_or_reset() for shutting down the interrupts.
Make sca3000_stop_all_interrupts() return void now that it always hooks
into devm cleanup.
No functional change intended.
Suggested-by: David Lechner <dlechner@...libre.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@...el.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
---
v4->v5: Offloaded the move of the sca3000_stop_all_interrupts() above
probe in a earlier patch, thanks to Andy for the suggestion of making
this simple.
---
drivers/iio/accel/sca3000.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
index 56ff646684c0..cfc3353f7ffd 100644
--- a/drivers/iio/accel/sca3000.c
+++ b/drivers/iio/accel/sca3000.c
@@ -1436,8 +1436,10 @@ static const struct iio_info sca3000_info = {
.write_event_config = &sca3000_write_event_config,
};
-static void sca3000_stop_all_interrupts(struct sca3000_state *st)
+static void sca3000_stop_all_interrupts(void *data)
{
+ struct iio_dev *indio_dev = data;
+ struct sca3000_state *st = iio_priv(indio_dev);
int ret;
guard(mutex)(&st->lock);
@@ -1504,6 +1506,10 @@ static int sca3000_probe(struct spi_device *spi)
if (ret)
return ret;
+ ret = devm_add_action_or_reset(dev, sca3000_stop_all_interrupts, indio_dev);
+ if (ret)
+ return ret;
+
ret = iio_device_register(indio_dev);
if (ret)
return ret;
@@ -1514,12 +1520,8 @@ static int sca3000_probe(struct spi_device *spi)
static void sca3000_remove(struct spi_device *spi)
{
struct iio_dev *indio_dev = spi_get_drvdata(spi);
- struct sca3000_state *st = iio_priv(indio_dev);
iio_device_unregister(indio_dev);
-
- /* Must ensure no interrupts can be generated after this! */
- sca3000_stop_all_interrupts(st);
}
static const struct spi_device_id sca3000_id[] = {
--
2.47.3
Powered by blists - more mailing lists