Re: [PATCH 2/2] driver core: platform: Allow drivers to skip PM domain power-on at probe

From: Ulf Hansson

Date: Mon Nov 30 2026 - 11:55:36 EST


On Thu, Nov 26, 2026 at 5:03 PM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>
> On Wed Nov 25, 2026 at 4:28 PM CET, Ulf Hansson wrote:
> > On Mon, Nov 23, 2026 at 9:43 AM Beleswar Padhi <b-padhi@xxxxxx> wrote:
> >> diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
> >> index 3bd0f1f0d8704..4d1679c4ea78e 100644
> >> --- a/include/linux/platform_device.h
> >> +++ b/include/linux/platform_device.h
> >> @@ -292,6 +292,14 @@ struct platform_driver {
> >> * to setup and manage their own I/O address space.
> >> */
> >> bool driver_managed_dma;
> >> + /*
> >> + * By default the PM domain of a platform device is powered on before
> >> + * the driver's probe is invoked. Drivers that need to configure the
> >> + * device (e.g. hold it in reset) before its PM domain can be powered
> >> + * on must set this flag, and are then responsible for powering on the
> >> + * PM domain themselves.
> >> + */
> >
> > I would appreciate it if we could be more to the point. We should not
> > need an entire book to explain what one variable is for. :-)
>
> Hm...to me the comment seems reasonable. What do you suggest instead?

The comment is reasonable - and I have no strong opinion if you insist
on having it like this.

Although to me the below would be sufficient.
"Tell dev_pm_domain_attach() to skip turning on the PM domain."

>
> >> + bool pm_domain_no_power_on;
> >> };

That said, I made some more thinking of the $subject series - and
there is an alternative solution that I believe could be a better
option.

Rather than controlling the parameters with the flag above for what
the platform bus should use when it calls dev_pm_domain_attach() - we
could instead tell it not to do the attach at all.

In this way, the corresponding platform driver can manage the
attaching itself, which allows it to control the behavior in a more
flexible way. We already do this for devices that have multiple PM
domains, so it would be kind of consistent with this. Instead of
calling the legacy dev_pm_domain_attach() API, the driver can use any
of the below APIs to manage the attach without enforcing the PM domain
to be turned on.

dev_pm_domain_attach_by_id|name() and dev|devm_pm_domain_attach_list()
doesn't turn on the PM domain.

What do you think?

Kind regards
Uffe