diff mbox series

[V2,07/11] PM / Domain: Add struct device to genpd

Message ID 26cfcef726e24a578768ea75ade5fd9b2fb19254.1523273291.git.viresh.kumar@linaro.org
State Accepted
Commit 401ea1572de944df548a13eded82339491a739ff
Headers show
Series PM / genpd & OPP: Parse performance state from DT | expand

Commit Message

Viresh Kumar April 9, 2018, 11:43 a.m. UTC
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.

Add a struct device to the genpd structure. This doesn't register the
device with device core as the "dev" pointer is mostly used by the OPP
core as a cookie for now and registering the device is not mandatory.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

---
 drivers/base/power/domain.c | 3 +++
 include/linux/pm_domain.h   | 1 +
 2 files changed, 4 insertions(+)

-- 
2.15.0.194.g9af6a3dea062

Comments

Ulf Hansson April 9, 2018, 3:22 p.m. UTC | #1
On 9 April 2018 at 13:43, Viresh Kumar <viresh.kumar@linaro.org> 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.

>

> Add a struct device to the genpd structure. This doesn't register the

> device with device core as the "dev" pointer is mostly used by the OPP

> core as a cookie for now and registering the device is not mandatory.

>

> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>


Acked-by: Ulf Hansson <ulf.hansson@linaro.org>


Kind regards
Uffe

> ---

>  drivers/base/power/domain.c | 3 +++

>  include/linux/pm_domain.h   | 1 +

>  2 files changed, 4 insertions(+)

>

> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c

> index 1ea0e2502e8e..4a3dc9cc0848 100644

> --- a/drivers/base/power/domain.c

> +++ b/drivers/base/power/domain.c

> @@ -1696,6 +1696,9 @@ int pm_genpd_init(struct generic_pm_domain *genpd,

>                         return ret;

>         }

>

> +       device_initialize(&genpd->dev);

> +       dev_set_name(&genpd->dev, "%s", genpd->name);

> +

>         mutex_lock(&gpd_list_lock);

>         list_add(&genpd->gpd_list_node, &gpd_list);

>         mutex_unlock(&gpd_list_lock);

> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h

> index 04dbef9847d3..aaacaa35005d 100644

> --- a/include/linux/pm_domain.h

> +++ b/include/linux/pm_domain.h

> @@ -49,6 +49,7 @@ struct genpd_power_state {

>  struct genpd_lock_ops;

>

>  struct generic_pm_domain {

> +       struct device dev;

>         struct dev_pm_domain domain;    /* PM domain operations */

>         struct list_head gpd_list_node; /* Node in the global PM domains list */

>         struct list_head master_links;  /* Links with PM domain as a master */

> --

> 2.15.0.194.g9af6a3dea062

>
diff mbox series

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 1ea0e2502e8e..4a3dc9cc0848 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1696,6 +1696,9 @@  int pm_genpd_init(struct generic_pm_domain *genpd,
 			return ret;
 	}
 
+	device_initialize(&genpd->dev);
+	dev_set_name(&genpd->dev, "%s", genpd->name);
+
 	mutex_lock(&gpd_list_lock);
 	list_add(&genpd->gpd_list_node, &gpd_list);
 	mutex_unlock(&gpd_list_lock);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 04dbef9847d3..aaacaa35005d 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -49,6 +49,7 @@  struct genpd_power_state {
 struct genpd_lock_ops;
 
 struct generic_pm_domain {
+	struct device dev;
 	struct dev_pm_domain domain;	/* PM domain operations */
 	struct list_head gpd_list_node;	/* Node in the global PM domains list */
 	struct list_head master_links;	/* Links with PM domain as a master */