Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 01/14] iio: accel: mma8452: unregister own trigger rather than current one
       [not found] <20261109035252.1295926-1-jic23@kernel.org>
@ 2026-11-09  3:52 ` Jonathan Cameron
  0 siblings, 0 replies; only message in thread
From: Jonathan Cameron @ 2026-11-09  3:52 UTC (permalink / raw)
  To: iio, Miquel Raynal, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, Song Qiang, Radu Sabau, Maxwell Doose,
	Tomasz Duszynski, Erikas Bitovtas, Waqar Hameed
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-kernel,
	Jonathan Cameron, stable

From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

mma8452_trigger_cleanup() uses indio_dev->trig to unregister the trigger.
That may or may not be the one it registered as this driver allows
triggers other than its own to be used.

Keep a pointer to the driver's own trigger in struct mma8452_data and
unregister that instead.

Fixes: ae6d9ce05691 ("iio: mma8452: Add support for interrupt driven triggers.")
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/accel/mma8452.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index dc8031e14c29..f9abff3842fc 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -115,6 +115,7 @@
  * @orientation:		mounting matrix, flipped axis etc.
  * @chip_info:			chip specific data
  * @regs:			reference to voltage regulators
+ * @trig:			data ready trigger, if an interrupt is available
  * @buffer:			triggered buffer
  * @sleep_val:			time in ms to sleep while waiting for drdy
  * @ctrl_reg1:			CTRL_REG1 register shadow value
@@ -127,6 +128,7 @@ struct mma8452_data {
 	struct iio_mount_matrix orientation;
 	const struct mma_chip_info *chip_info;
 	struct regulator_bulk_data regs[2];
+	struct iio_trigger *trig;
 
 	/* Ensure correct alignment of time stamp when present */
 	struct {
@@ -1526,6 +1528,7 @@ static int mma8452_trigger_setup(struct iio_dev *indio_dev)
 	if (ret)
 		return ret;
 
+	data->trig = trig;
 	indio_dev->trig = iio_trigger_get(trig);
 
 	return 0;
@@ -1533,8 +1536,10 @@ static int mma8452_trigger_setup(struct iio_dev *indio_dev)
 
 static void mma8452_trigger_cleanup(struct iio_dev *indio_dev)
 {
-	if (indio_dev->trig)
-		iio_trigger_unregister(indio_dev->trig);
+	struct mma8452_data *data = iio_priv(indio_dev);
+
+	if (data->trig)
+		iio_trigger_unregister(data->trig);
 }
 
 static int mma8452_reset(struct i2c_client *client)
-- 
2.56.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-09  3:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261109035252.1295926-1-jic23@kernel.org>
2026-11-09  3:52 ` [PATCH 01/14] iio: accel: mma8452: unregister own trigger rather than current one Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox