Re: [PATCH] PM: domains: Don't attach a device to genpd that corresponds to a provider

From: Ulf Hansson
Date: Fri Jul 09 2021 - 09:23:31 EST


On Fri, 9 Jul 2021 at 15:07, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
>
> Hi Ulf,
>
> Thanks for your patch!
>
> On Fri, Jul 9, 2021 at 2:56 PM Ulf Hansson <ulf.hansson@xxxxxxxxxx> wrote:
> > According to the common power domain DT bindings, a power domain provider
> > must have a "#power-domain-cells" property in its OF node. Additionally, if
> > a provider has a "power-domains" property, it means that it has a parent
> > domain.
>
> OK.
>
> > It has turned out that some OF nodes that represents a genpd provider may
> > also be compatible with a regular platform device. This leads to, during
> > probe, genpd_dev_pm_attach(), genpd_dev_pm_attach_by_name() and
> > genpd_dev_pm_attach_by_id() tries to attach the corresponding struct device
> > to the genpd provider's parent domain, which is wrong. Instead the genpd
>
> Why is that wrong?

It may lead to that the struct device that corresponds to a genpd
provider may be attached to the parent domain. In other words, the
parent domain will not only be controlled by a child domain
(corresponding to the provider), but also through the provider's
struct device. As far as I can tell, this has never been the intent
for how things should work in genpd.

So wrong or not, I guess it depends on what you expect to happen.

Do you see an issue with changing this?

>
> > provider should only assign a parent domain, through
> > pm_genpd_add_subdomain() or of_genpd_add_subdomain().

Kind regards
Uffe