Re: [PATCH 3/6] iio: adc: versal-sysmon: disable interrupts on shutdown

From: Jonathan Cameron

Date: Sat Nov 07 2026 - 18:30:59 EST


On Tue, 3 Nov 2026 12:10:41 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:

> On Mon, Nov 02, 2026 at 05:51:09PM +0530, Amit Kumar Mahapatra wrote:
> > Interrupt teardown is registered with devm_add_action_or_reset(), so
> > sysmon_disable_interrupts() runs when the driver is unbound but not when
> > the system shuts down: device_shutdown() invokes only the driver's
> > .shutdown callback, which this driver does not implement.
> >
> > The device is therefore left with its alarm interrupts enabled in
> > hardware once Linux has stopped servicing them.
> >
> > Add a .shutdown callback performing the same teardown, so the device is
> > quiesced before control is handed on. The helper lives in the core
> > module, so it is exported for the platform front-end. It skips a
> > device described without an interrupt, which never set up interrupt
> > handling.
> >
> > Disabling the interrupts at shutdown is safe to have and not a must have
> > requirement for shutdown.
>
> ...
>
> > + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> > + struct sysmon *sysmon = iio_priv(indio_dev);
>
> Side Q to Jonathan: How do you see having a helper that unites these two?
> Something like void *iio_priv_from_drvdata(struct device *dev)
>
There is no strong reason to assume that dev_get_drvdata() returns
an iio_dev (even though that's a common choice) so a helper would
have to express that somehow in the naming.