Re: [PATCH 3/7] PM / Domain: Add struct device to genpd
From: Viresh Kumar
Date: Thu Mar 22 2018 - 05:59:16 EST
On 22-03-18, 10:30, Ulf Hansson wrote:
> On 22 December 2017 at 08:26, Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> > The power-domain core would be using the OPP core going forward and the
> > OPP core has the basic requirement of a device structure for its working.
>
> According to the OPP core also seems to require the ->dev.of_node to
> be set. Actually, it seems like that part belongs in patch4 instead,
> while starting to make use of the opp OF APIs. Could you please move
> it?
You meaning setting of the of_node to the next patch? I can do that if that;s
what you want.
> > +static struct bus_type genpd_bus_type = {
> > + .name = "genpd",
> > +};
>
> This seems silly. Can't we just avoid having a bus type altogether,
> thus no need to call bus_register() as well?
I thought we need a bus where we want to add the device, haven't tried with that
pointer being empty. Will try that and let you know.
> > +
> > /**
> > * pm_genpd_init - Initialize a generic I/O PM domain object.
> > * @genpd: PM domain object to initialize.
> > @@ -1687,6 +1691,18 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
> > return ret;
> > }
> >
> > + genpd->dev.bus = &genpd_bus_type;
> > + device_initialize(&genpd->dev);
> > + dev_set_name(&genpd->dev, "%s", genpd->name);
> > +
> > + ret = device_add(&genpd->dev);
>
> What's the point of adding the device? Can we skip this step, as I
> guess the opp core is only using the device as cookie rather actual
> using it? No?
We also use it for the OPP debugfs stuff, so that would be required I believe.
We also use it for playing with clk/regulator stuff as well, though we may not
use it in genpd case for now.
--
viresh