mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mahapatra, Amit Kumar" <amit.kumar-mahapatra@amd.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Simek, Michal" <michal.simek@amd.com>,
	"Potthuri, Sai Krishna" <sai.krishna.potthuri@amd.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"amitrkcian2002@gmail.com" <amitrkcian2002@gmail.com>
Subject: RE: [PATCH 3/6] iio: adc: versal-sysmon: disable interrupts on shutdown
Date: Mon, 16 Nov 2026 04:20:18 +0000	[thread overview]
Message-ID: <DS7PR12MB95038F6C18B71F2BC5073552DC7C2@DS7PR12MB9503.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20261107233244.63c35375@jic23-hlaptop>

AMD General

Hello Jonathan,

> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: Sunday, November 8, 2026 5:03 AM
> To: Mahapatra, Amit Kumar <amit.kumar-mahapatra@amd.com>
> Cc: Simek, Michal <michal.simek@amd.com>; Potthuri, Sai Krishna
> <sai.krishna.potthuri@amd.com>; David Lechner <dlechner@baylibre.com>; Nuno
> Sá <nuno.sa@analog.com>; Andy Shevchenko <andy@kernel.org>; Rob Herring
> <robh@kernel.org>; Krzysztof Kozlowski <krzk+dt@kernel.org>; Conor Dooley
> <conor+dt@kernel.org>; linux-iio@vger.kernel.org; devicetree@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
> amitrkcian2002@gmail.com
> Subject: Re: [PATCH 3/6] iio: adc: versal-sysmon: disable interrupts on shutdown
>
> On Mon, 2 Nov 2026 17:51:09 +0530
> Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com> 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.
>
> So what is disadvantage of not doing it?  Otherwise, why have the complexity of
> doing so?

I couldn't find any strong disadvantage of not doing it. I will drop this patch
in next series.

Regards,
Amit
>
> J
> >
> > Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
> > ---
> >  drivers/iio/adc/versal-sysmon-core.c | 19 +++++++++++++++++++
> >  drivers/iio/adc/versal-sysmon.c      |  6 ++++++
> >  drivers/iio/adc/versal-sysmon.h      |  1 +
> >  3 files changed, 26 insertions(+)
> >
> > diff --git a/drivers/iio/adc/versal-sysmon-core.c
> > b/drivers/iio/adc/versal-sysmon-core.c
> > index 6595d07038c1..d39aaba9a8b6 100644
> > --- a/drivers/iio/adc/versal-sysmon-core.c
> > +++ b/drivers/iio/adc/versal-sysmon-core.c
> > @@ -1000,6 +1000,8 @@ int devm_versal_sysmon_core_probe(struct device
> *dev, struct regmap *regmap)
> >     if (!indio_dev)
> >             return -ENOMEM;
> >
> > +   dev_set_drvdata(dev, indio_dev);
> > +
> >     sysmon = iio_priv(indio_dev);
> >     sysmon->regmap = regmap;
> >     sysmon->temp_oversampling = 1;
> > @@ -1050,6 +1052,23 @@ int devm_versal_sysmon_core_probe(struct device
> > *dev, struct regmap *regmap)  }
> > EXPORT_SYMBOL_NS_GPL(devm_versal_sysmon_core_probe,
> "VERSAL_SYSMON");
> >
> > +/**
> > + * versal_sysmon_shutdown() - Disable SysMon interrupts on system
> > +shutdown
> > + * @dev: SysMon device
> > + *
> > + * Interrupt teardown is a devm action, which runs on driver unbind
> > +but not
> > + * on system shutdown, so disable the interrupts here as well.
> > + */
> > +void versal_sysmon_shutdown(struct device *dev) {
> > +   struct iio_dev *indio_dev = dev_get_drvdata(dev);
> > +   struct sysmon *sysmon = iio_priv(indio_dev);
> > +
> > +   if (sysmon->irq > 0)
> > +           sysmon_disable_interrupts(sysmon);
> > +}
> > +EXPORT_SYMBOL_NS_GPL(versal_sysmon_shutdown,
> "VERSAL_SYSMON");
> > +
> >  MODULE_LICENSE("GPL");
> >  MODULE_DESCRIPTION("AMD Versal SysMon Core Driver");
> > MODULE_AUTHOR("Salih Erim <salih.erim@amd.com>"); diff --git
> > a/drivers/iio/adc/versal-sysmon.c b/drivers/iio/adc/versal-sysmon.c
> > index 529d0486c9f9..4d5e3d14cf15 100644
> > --- a/drivers/iio/adc/versal-sysmon.c
> > +++ b/drivers/iio/adc/versal-sysmon.c
> > @@ -71,6 +71,11 @@ static int sysmon_platform_probe(struct platform_device
> *pdev)
> >     return devm_versal_sysmon_core_probe(dev, regmap);  }
> >
> > +static void sysmon_platform_shutdown(struct platform_device *pdev) {
> > +   versal_sysmon_shutdown(&pdev->dev);
> > +}
> > +
> >  static const struct of_device_id sysmon_of_match_table[] = {
> >     { .compatible = "xlnx,versal-sysmon" },
> >     { }
> > @@ -79,6 +84,7 @@ MODULE_DEVICE_TABLE(of, sysmon_of_match_table);
> >
> >  static struct platform_driver sysmon_platform_driver = {
> >     .probe = sysmon_platform_probe,
> > +   .shutdown = sysmon_platform_shutdown,
> >     .driver = {
> >             .name = "versal-sysmon",
> >             .of_match_table = sysmon_of_match_table, diff --git
> > a/drivers/iio/adc/versal-sysmon.h b/drivers/iio/adc/versal-sysmon.h
> > index a1ac3289719c..a21dacc13471 100644
> > --- a/drivers/iio/adc/versal-sysmon.h
> > +++ b/drivers/iio/adc/versal-sysmon.h
> > @@ -122,5 +122,6 @@ struct sysmon {
> >  };
> >
> >  int devm_versal_sysmon_core_probe(struct device *dev, struct regmap
> > *regmap);
> > +void versal_sysmon_shutdown(struct device *dev);
> >
> >  #endif /* _VERSAL_SYSMON_H_ */


  reply	other threads:[~2026-11-16  4:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 12:21 [PATCH 0/6] iio: adc: versal-sysmon: Add OT alarm, shutdown and thermal zone support Amit Kumar Mahapatra
2026-11-02 12:21 ` [PATCH 1/6] iio: adc: versal-sysmon: fix race in interrupt teardown Amit Kumar Mahapatra
2026-11-03  7:05   ` Prasanna Kumar T S M
2026-11-07 23:27   ` Jonathan Cameron
2026-11-02 12:21 ` [PATCH 2/6] iio: adc: versal-sysmon: validate temperature hysteresis Amit Kumar Mahapatra
2026-11-03 10:08   ` Andy Shevchenko
2026-11-06 11:35     ` Mahapatra, Amit Kumar
2026-11-09 19:45       ` Andy Shevchenko
2026-11-16  4:19         ` Mahapatra, Amit Kumar
2026-11-02 12:21 ` [PATCH 3/6] iio: adc: versal-sysmon: disable interrupts on shutdown Amit Kumar Mahapatra
2026-11-03  7:07   ` Prasanna Kumar T S M
2026-11-03 10:10   ` Andy Shevchenko
2026-11-07 23:30     ` Jonathan Cameron
2026-11-07 23:32   ` Jonathan Cameron
2026-11-16  4:20     ` Mahapatra, Amit Kumar [this message]
2026-11-02 12:21 ` [PATCH 4/6] iio: adc: versal-sysmon: add over-temperature alarm events Amit Kumar Mahapatra
2026-11-07 23:43   ` Jonathan Cameron
2026-11-16  5:42     ` Mahapatra, Amit Kumar
2026-11-02 12:21 ` [PATCH 5/6] arm64: versal-net: Add SysMon and thermal zone Amit Kumar Mahapatra
2026-11-02 14:53   ` Michal Simek
2026-11-06 11:46     ` Mahapatra, Amit Kumar
2026-11-02 12:21 ` [PATCH 6/6] MAINTAINERS: update Versal SysMon maintainers Amit Kumar Mahapatra
2026-11-02 12:53   ` Michal Simek
2026-11-06 11:46   ` Sai Krishna Potthuri

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=DS7PR12MB95038F6C18B71F2BC5073552DC7C2@DS7PR12MB9503.namprd12.prod.outlook.com \
    --to=amit.kumar-mahapatra@amd.com \
    --cc=amitrkcian2002@gmail.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=sai.krishna.potthuri@amd.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®