mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Radu Rendec <radu@rendec.net>
To: Fabio Estevam <festevam@gmail.com>
Cc: tglx@kernel.org, Frank.Li@nxp.com, imx@lists.linux.dev,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] irqchip: imx-irqsteer: Convert to devm_pm_runtime_enable()
Date: Wed, 05 Aug 2026 12:00:59 -0400	[thread overview]
Message-ID: <227049e031807e27863b3d6ae950de10cb2c3187.camel@rendec.net> (raw)
In-Reply-To: <CAOMZO5CFe6P3UvnhrhZqO=ALGHUaBbQyP2qFeP6qfkU_69Q6WQ@mail.gmail.com>

On Tue, 2026-08-04 at 08:09 -0300, Fabio Estevam wrote:
> On Sat, Aug 1, 2026 at 3:54 PM Radu Rendec <radu@rendec.net> wrote:
> 
> > I take that back. At a closer look, I think both issues identified by
> > Sashiko are valid. While the second issue is marked as "pre-existing",
> > the proposed patch introduces a new path where the issue can occur
> > (leaking the irq domain).
> 
> Would the first version of the patch be acceptable?

It certainly avoids the problem of the extra error path that
devm_pm_runtime_enable() introduces.

But Sashiko had a comment on the first version too, and I think at
least the first issue - about the double-disable of the clock (if the
device is suspended when it's removed) - is real.

In my (very limited) understanding of the runtime_pm framework, there
are two ways to handle this cleanly:
 * Manage the activation and deactivation of the clock indirectly
   through suspend/resume requests. The driver already enables the
   clock in its resume callback and disables the clock in its suspend
   callback. Instead of enabling/disabling the clock explicitly in the
   probe/remove function, use pm_runtime_get_sync() and
   pm_runtime_put(), which indirectly resume and respectively suspend
   the device. This is what drivers/irqchip/irq-renesas-intc-irqpin.c
   does (except it doesn't manage a clock).
 * Call pm_runtime_get_sync() at the beginning of the remove function
   (which requires a matching pm_runtime_put() in the probe function).
   That will indirectly resume the device first, then it's safe to
   disable the clock.

At a high level, the second option above would like this:

static int imx_irqsteer_probe(struct platform_device *pdev)
{
 /* Initial setup / clock enablement */

 pm_runtime_set_active(&pdev->dev);
 pm_runtime_enable(&pdev->dev);
 /* Mark device idle so it can autosuspend when unused */
 pm_runtime_put_autosuspend(&pdev->dev);

 return 0;
}

static void imx_irqsteer_remove(struct platform_device *pdev)
{
    pm_runtime_get_sync(&pdev->dev);
    pm_runtime_disable(&pdev->dev);

    /* Final clean up and disable clock */
}

That's closer to what the driver already does. But the part that I
don't like is that the pm_runtime_put_autosuspend() call may suspend
the device immediately, and I don't fully understand the implications
of that.


  reply	other threads:[~2026-08-05 16:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 22:14 Fabio Estevam
2026-07-30  2:22 ` Radu Rendec
2026-08-01 18:54   ` Radu Rendec
2026-08-04 11:09     ` Fabio Estevam
2026-08-05 16:00       ` Radu Rendec [this message]
2026-07-30 14:52 ` Frank Li

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=227049e031807e27863b3d6ae950de10cb2c3187.camel@rendec.net \
    --to=radu@rendec.net \
    --cc=Frank.Li@nxp.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@kernel.org \
    /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®