* [PATCH 0/3] PM / Domains: Improve support for multi PM domains
@ 2019-04-18 10:27 Ulf Hansson
2019-04-18 10:27 ` [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path Ulf Hansson
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Ulf Hansson @ 2019-04-18 10:27 UTC (permalink / raw)
To: Rafael J . Wysocki, linux-pm
Cc: Ulf Hansson, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak,
Viresh Kumar, Niklas Cassel, Kevin Hilman, linux-kernel,
linux-arm-kernel
It's been a while since the introduction for the support for multi PM domains
per device in genpd. In this small series, a couple of different improvement
are being made to this code in genpd.
Ulf Hansson (3):
PM / Domains: Don't kfree() the virtual device in the error path
PM / Domains: Allow OF lookup for multi PM domain case from
->attach_dev()
PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM
domain
drivers/base/power/domain.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path 2019-04-18 10:27 [PATCH 0/3] PM / Domains: Improve support for multi PM domains Ulf Hansson @ 2019-04-18 10:27 ` Ulf Hansson 2019-04-22 8:27 ` Viresh Kumar 2019-04-24 11:28 ` Niklas Cassel 2019-04-18 10:27 ` [PATCH 2/3] PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev() Ulf Hansson ` (2 subsequent siblings) 3 siblings, 2 replies; 11+ messages in thread From: Ulf Hansson @ 2019-04-18 10:27 UTC (permalink / raw) To: Rafael J . Wysocki, linux-pm Cc: Ulf Hansson, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak, Viresh Kumar, Niklas Cassel, Kevin Hilman, linux-kernel, linux-arm-kernel It's not correct to call kfree(dev) when device_register(dev) has failed. Fix this by calling put_device(dev) instead. Fixes: 3c095f32a92b ("PM / Domains: Add support for multi PM domains per device to genpd") Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index ecac03dcc9b2..7fec69aebf46 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2528,7 +2528,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, ret = device_register(virt_dev); if (ret) { - kfree(virt_dev); + put_device(virt_dev); return ERR_PTR(ret); } -- 2.17.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path 2019-04-18 10:27 ` [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path Ulf Hansson @ 2019-04-22 8:27 ` Viresh Kumar 2019-04-24 11:28 ` Niklas Cassel 1 sibling, 0 replies; 11+ messages in thread From: Viresh Kumar @ 2019-04-22 8:27 UTC (permalink / raw) To: Ulf Hansson Cc: Rafael J . Wysocki, linux-pm, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak, Niklas Cassel, Kevin Hilman, linux-kernel, linux-arm-kernel On 18-04-19, 12:27, Ulf Hansson wrote: > It's not correct to call kfree(dev) when device_register(dev) has failed. > Fix this by calling put_device(dev) instead. > > Fixes: 3c095f32a92b ("PM / Domains: Add support for multi PM domains per device to genpd") > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> > --- > drivers/base/power/domain.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index ecac03dcc9b2..7fec69aebf46 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -2528,7 +2528,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, > > ret = device_register(virt_dev); > if (ret) { > - kfree(virt_dev); > + put_device(virt_dev); > return ERR_PTR(ret); > } Acked-by: Viresh Kumar <viresh.kumar@linaro.org> -- viresh ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path 2019-04-18 10:27 ` [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path Ulf Hansson 2019-04-22 8:27 ` Viresh Kumar @ 2019-04-24 11:28 ` Niklas Cassel 1 sibling, 0 replies; 11+ messages in thread From: Niklas Cassel @ 2019-04-24 11:28 UTC (permalink / raw) To: Ulf Hansson Cc: Rafael J . Wysocki, linux-pm, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak, Viresh Kumar, Kevin Hilman, linux-kernel, linux-arm-kernel On Thu, Apr 18, 2019 at 12:27:55PM +0200, Ulf Hansson wrote: > It's not correct to call kfree(dev) when device_register(dev) has failed. > Fix this by calling put_device(dev) instead. > > Fixes: 3c095f32a92b ("PM / Domains: Add support for multi PM domains per device to genpd") > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> > --- > drivers/base/power/domain.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index ecac03dcc9b2..7fec69aebf46 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -2528,7 +2528,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, > > ret = device_register(virt_dev); > if (ret) { > - kfree(virt_dev); > + put_device(virt_dev); > return ERR_PTR(ret); > } > > -- > 2.17.1 > Acked-by: Niklas Cassel <niklas.cassel@linaro.org> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/3] PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev() 2019-04-18 10:27 [PATCH 0/3] PM / Domains: Improve support for multi PM domains Ulf Hansson 2019-04-18 10:27 ` [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path Ulf Hansson @ 2019-04-18 10:27 ` Ulf Hansson 2019-04-22 8:29 ` Viresh Kumar 2019-04-24 11:28 ` Niklas Cassel 2019-04-18 10:27 ` [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain Ulf Hansson 2019-05-01 10:25 ` [PATCH 0/3] PM / Domains: Improve support for multi PM domains Rafael J. Wysocki 3 siblings, 2 replies; 11+ messages in thread From: Ulf Hansson @ 2019-04-18 10:27 UTC (permalink / raw) To: Rafael J . Wysocki, linux-pm Cc: Ulf Hansson, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak, Viresh Kumar, Niklas Cassel, Kevin Hilman, linux-kernel, linux-arm-kernel A genpd provider that uses the ->attach_dev() callback to lookup resources for a device, fails to do so when the device has multiple PM domains. This is because when genpd invokes the ->attach_dev() callback, it passes the allocated virtual device as the in-parameter. To address this problem, let's simply assign the dev->of_node for the virtual device, based upon the original device's OF node. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/base/power/domain.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 7fec69aebf46..801f31c87d16 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2345,6 +2345,7 @@ EXPORT_SYMBOL_GPL(of_genpd_remove_last); static void genpd_release_dev(struct device *dev) { + of_node_put(dev->of_node); kfree(dev); } @@ -2406,14 +2407,14 @@ static void genpd_dev_pm_sync(struct device *dev) genpd_queue_power_off_work(pd); } -static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np, - unsigned int index, bool power_on) +static int __genpd_dev_pm_attach(struct device *dev, unsigned int index, + bool power_on) { struct of_phandle_args pd_args; struct generic_pm_domain *pd; int ret; - ret = of_parse_phandle_with_args(np, "power-domains", + ret = of_parse_phandle_with_args(dev->of_node, "power-domains", "#power-domain-cells", index, &pd_args); if (ret < 0) return ret; @@ -2481,7 +2482,7 @@ int genpd_dev_pm_attach(struct device *dev) "#power-domain-cells") != 1) return 0; - return __genpd_dev_pm_attach(dev, dev->of_node, 0, true); + return __genpd_dev_pm_attach(dev, 0, true); } EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); @@ -2525,6 +2526,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, dev_set_name(virt_dev, "genpd:%u:%s", index, dev_name(dev)); virt_dev->bus = &genpd_bus_type; virt_dev->release = genpd_release_dev; + virt_dev->of_node = of_node_get(dev->of_node); ret = device_register(virt_dev); if (ret) { @@ -2533,7 +2535,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, } /* Try to attach the device to the PM domain at the specified index. */ - ret = __genpd_dev_pm_attach(virt_dev, dev->of_node, index, false); + ret = __genpd_dev_pm_attach(virt_dev, index, false); if (ret < 1) { device_unregister(virt_dev); return ret ? ERR_PTR(ret) : NULL; -- 2.17.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev() 2019-04-18 10:27 ` [PATCH 2/3] PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev() Ulf Hansson @ 2019-04-22 8:29 ` Viresh Kumar 2019-04-24 11:28 ` Niklas Cassel 1 sibling, 0 replies; 11+ messages in thread From: Viresh Kumar @ 2019-04-22 8:29 UTC (permalink / raw) To: Ulf Hansson Cc: Rafael J . Wysocki, linux-pm, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak, Niklas Cassel, Kevin Hilman, linux-kernel, linux-arm-kernel On 18-04-19, 12:27, Ulf Hansson wrote: > A genpd provider that uses the ->attach_dev() callback to lookup resources > for a device, fails to do so when the device has multiple PM domains. This > is because when genpd invokes the ->attach_dev() callback, it passes the > allocated virtual device as the in-parameter. > > To address this problem, let's simply assign the dev->of_node for the > virtual device, based upon the original device's OF node. > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> > --- > drivers/base/power/domain.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 7fec69aebf46..801f31c87d16 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -2345,6 +2345,7 @@ EXPORT_SYMBOL_GPL(of_genpd_remove_last); > > static void genpd_release_dev(struct device *dev) > { > + of_node_put(dev->of_node); > kfree(dev); > } > > @@ -2406,14 +2407,14 @@ static void genpd_dev_pm_sync(struct device *dev) > genpd_queue_power_off_work(pd); > } > > -static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np, > - unsigned int index, bool power_on) > +static int __genpd_dev_pm_attach(struct device *dev, unsigned int index, > + bool power_on) > { > struct of_phandle_args pd_args; > struct generic_pm_domain *pd; > int ret; > > - ret = of_parse_phandle_with_args(np, "power-domains", > + ret = of_parse_phandle_with_args(dev->of_node, "power-domains", > "#power-domain-cells", index, &pd_args); > if (ret < 0) > return ret; > @@ -2481,7 +2482,7 @@ int genpd_dev_pm_attach(struct device *dev) > "#power-domain-cells") != 1) > return 0; > > - return __genpd_dev_pm_attach(dev, dev->of_node, 0, true); > + return __genpd_dev_pm_attach(dev, 0, true); > } > EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); > > @@ -2525,6 +2526,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, > dev_set_name(virt_dev, "genpd:%u:%s", index, dev_name(dev)); > virt_dev->bus = &genpd_bus_type; > virt_dev->release = genpd_release_dev; > + virt_dev->of_node = of_node_get(dev->of_node); > > ret = device_register(virt_dev); > if (ret) { > @@ -2533,7 +2535,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, > } > > /* Try to attach the device to the PM domain at the specified index. */ > - ret = __genpd_dev_pm_attach(virt_dev, dev->of_node, index, false); > + ret = __genpd_dev_pm_attach(virt_dev, index, false); > if (ret < 1) { > device_unregister(virt_dev); > return ret ? ERR_PTR(ret) : NULL; Acked-by: Viresh Kumar <viresh.kumar@linaro.org> -- viresh ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev() 2019-04-18 10:27 ` [PATCH 2/3] PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev() Ulf Hansson 2019-04-22 8:29 ` Viresh Kumar @ 2019-04-24 11:28 ` Niklas Cassel 1 sibling, 0 replies; 11+ messages in thread From: Niklas Cassel @ 2019-04-24 11:28 UTC (permalink / raw) To: Ulf Hansson Cc: Rafael J . Wysocki, linux-pm, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak, Viresh Kumar, Kevin Hilman, linux-kernel, linux-arm-kernel On Thu, Apr 18, 2019 at 12:27:56PM +0200, Ulf Hansson wrote: > A genpd provider that uses the ->attach_dev() callback to lookup resources > for a device, fails to do so when the device has multiple PM domains. This > is because when genpd invokes the ->attach_dev() callback, it passes the > allocated virtual device as the in-parameter. > > To address this problem, let's simply assign the dev->of_node for the > virtual device, based upon the original device's OF node. > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> > --- > drivers/base/power/domain.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 7fec69aebf46..801f31c87d16 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -2345,6 +2345,7 @@ EXPORT_SYMBOL_GPL(of_genpd_remove_last); > > static void genpd_release_dev(struct device *dev) > { > + of_node_put(dev->of_node); > kfree(dev); > } > > @@ -2406,14 +2407,14 @@ static void genpd_dev_pm_sync(struct device *dev) > genpd_queue_power_off_work(pd); > } > > -static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np, > - unsigned int index, bool power_on) > +static int __genpd_dev_pm_attach(struct device *dev, unsigned int index, > + bool power_on) > { > struct of_phandle_args pd_args; > struct generic_pm_domain *pd; > int ret; > > - ret = of_parse_phandle_with_args(np, "power-domains", > + ret = of_parse_phandle_with_args(dev->of_node, "power-domains", > "#power-domain-cells", index, &pd_args); > if (ret < 0) > return ret; > @@ -2481,7 +2482,7 @@ int genpd_dev_pm_attach(struct device *dev) > "#power-domain-cells") != 1) > return 0; > > - return __genpd_dev_pm_attach(dev, dev->of_node, 0, true); > + return __genpd_dev_pm_attach(dev, 0, true); > } > EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); > > @@ -2525,6 +2526,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, > dev_set_name(virt_dev, "genpd:%u:%s", index, dev_name(dev)); > virt_dev->bus = &genpd_bus_type; > virt_dev->release = genpd_release_dev; > + virt_dev->of_node = of_node_get(dev->of_node); > > ret = device_register(virt_dev); > if (ret) { > @@ -2533,7 +2535,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, > } > > /* Try to attach the device to the PM domain at the specified index. */ > - ret = __genpd_dev_pm_attach(virt_dev, dev->of_node, index, false); > + ret = __genpd_dev_pm_attach(virt_dev, index, false); > if (ret < 1) { > device_unregister(virt_dev); > return ret ? ERR_PTR(ret) : NULL; > -- > 2.17.1 > Acked-by: Niklas Cassel <niklas.cassel@linaro.org> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain 2019-04-18 10:27 [PATCH 0/3] PM / Domains: Improve support for multi PM domains Ulf Hansson 2019-04-18 10:27 ` [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path Ulf Hansson 2019-04-18 10:27 ` [PATCH 2/3] PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev() Ulf Hansson @ 2019-04-18 10:27 ` Ulf Hansson 2019-04-22 8:31 ` Viresh Kumar 2019-04-24 11:28 ` Niklas Cassel 2019-05-01 10:25 ` [PATCH 0/3] PM / Domains: Improve support for multi PM domains Rafael J. Wysocki 3 siblings, 2 replies; 11+ messages in thread From: Ulf Hansson @ 2019-04-18 10:27 UTC (permalink / raw) To: Rafael J . Wysocki, linux-pm Cc: Ulf Hansson, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak, Viresh Kumar, Niklas Cassel, Kevin Hilman, linux-kernel, linux-arm-kernel If a call to dev_pm_domain_attach() succeeds to attach a device to its single PM domain, the important point is to prevent following calls to dev_pm_domain_attach_by_name|id() to fail. This is managed by checking the dev->pm_domain pointer and then return -EEXIST, rather than continue calling genpd_dev_pm_attach_by_id|name(). For this reason, let's enable genpd_dev_pm_attach_by_id|name() to be used for also single PM domains. This simplifies for future users to solely make use of dev_pm_domain_attach_by_id|name() rather than having to combine it with dev_pm_domain_attach(). Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/base/power/domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 801f31c87d16..1b026704a8fc 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2512,10 +2512,10 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, if (!dev->of_node) return NULL; - /* Deal only with devices using multiple PM domains. */ + /* Verify that the index is within a valid range. */ num_domains = of_count_phandle_with_args(dev->of_node, "power-domains", "#power-domain-cells"); - if (num_domains < 2 || index >= num_domains) + if (index >= num_domains) return NULL; /* Allocate and register device on the genpd bus. */ -- 2.17.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain 2019-04-18 10:27 ` [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain Ulf Hansson @ 2019-04-22 8:31 ` Viresh Kumar 2019-04-24 11:28 ` Niklas Cassel 1 sibling, 0 replies; 11+ messages in thread From: Viresh Kumar @ 2019-04-22 8:31 UTC (permalink / raw) To: Ulf Hansson Cc: Rafael J . Wysocki, linux-pm, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak, Niklas Cassel, Kevin Hilman, linux-kernel, linux-arm-kernel On 18-04-19, 12:27, Ulf Hansson wrote: > If a call to dev_pm_domain_attach() succeeds to attach a device to its > single PM domain, the important point is to prevent following calls to > dev_pm_domain_attach_by_name|id() to fail. This is managed by checking the > dev->pm_domain pointer and then return -EEXIST, rather than continue > calling genpd_dev_pm_attach_by_id|name(). > > For this reason, let's enable genpd_dev_pm_attach_by_id|name() to be used > for also single PM domains. This simplifies for future users to solely make > use of dev_pm_domain_attach_by_id|name() rather than having to combine it > with dev_pm_domain_attach(). > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> > --- > drivers/base/power/domain.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 801f31c87d16..1b026704a8fc 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -2512,10 +2512,10 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, > if (!dev->of_node) > return NULL; > > - /* Deal only with devices using multiple PM domains. */ > + /* Verify that the index is within a valid range. */ > num_domains = of_count_phandle_with_args(dev->of_node, "power-domains", > "#power-domain-cells"); > - if (num_domains < 2 || index >= num_domains) > + if (index >= num_domains) > return NULL; > > /* Allocate and register device on the genpd bus. */ Acked-by: Viresh Kumar <viresh.kumar@linaro.org> -- viresh ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain 2019-04-18 10:27 ` [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain Ulf Hansson 2019-04-22 8:31 ` Viresh Kumar @ 2019-04-24 11:28 ` Niklas Cassel 1 sibling, 0 replies; 11+ messages in thread From: Niklas Cassel @ 2019-04-24 11:28 UTC (permalink / raw) To: Ulf Hansson Cc: Rafael J . Wysocki, linux-pm, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak, Viresh Kumar, Kevin Hilman, linux-kernel, linux-arm-kernel On Thu, Apr 18, 2019 at 12:27:57PM +0200, Ulf Hansson wrote: > If a call to dev_pm_domain_attach() succeeds to attach a device to its > single PM domain, the important point is to prevent following calls to nit: s/prevent/ensure/ > dev_pm_domain_attach_by_name|id() to fail. This is managed by checking the > dev->pm_domain pointer and then return -EEXIST, rather than continue > calling genpd_dev_pm_attach_by_id|name(). > > For this reason, let's enable genpd_dev_pm_attach_by_id|name() to be used > for also single PM domains. This simplifies for future users to solely make > use of dev_pm_domain_attach_by_id|name() rather than having to combine it > with dev_pm_domain_attach(). > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> > --- > drivers/base/power/domain.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 801f31c87d16..1b026704a8fc 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -2512,10 +2512,10 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, > if (!dev->of_node) > return NULL; > > - /* Deal only with devices using multiple PM domains. */ > + /* Verify that the index is within a valid range. */ > num_domains = of_count_phandle_with_args(dev->of_node, "power-domains", > "#power-domain-cells"); > - if (num_domains < 2 || index >= num_domains) > + if (index >= num_domains) > return NULL; > > /* Allocate and register device on the genpd bus. */ > -- > 2.17.1 > Acked-by: Niklas Cassel <niklas.cassel@linaro.org> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] PM / Domains: Improve support for multi PM domains 2019-04-18 10:27 [PATCH 0/3] PM / Domains: Improve support for multi PM domains Ulf Hansson ` (2 preceding siblings ...) 2019-04-18 10:27 ` [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain Ulf Hansson @ 2019-05-01 10:25 ` Rafael J. Wysocki 3 siblings, 0 replies; 11+ messages in thread From: Rafael J. Wysocki @ 2019-05-01 10:25 UTC (permalink / raw) To: Ulf Hansson Cc: linux-pm, Greg Kroah-Hartman, Jon Hunter, Rajendra Nayak, Viresh Kumar, Niklas Cassel, Kevin Hilman, linux-kernel, linux-arm-kernel On Thursday, April 18, 2019 12:27:54 PM CEST Ulf Hansson wrote: > It's been a while since the introduction for the support for multi PM domains > per device in genpd. In this small series, a couple of different improvement > are being made to this code in genpd. > > Ulf Hansson (3): > PM / Domains: Don't kfree() the virtual device in the error path > PM / Domains: Allow OF lookup for multi PM domain case from > ->attach_dev() > PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM > domain > > drivers/base/power/domain.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) All [1-3/3] applied, thanks! ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-05-01 10:25 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-04-18 10:27 [PATCH 0/3] PM / Domains: Improve support for multi PM domains Ulf Hansson 2019-04-18 10:27 ` [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path Ulf Hansson 2019-04-22 8:27 ` Viresh Kumar 2019-04-24 11:28 ` Niklas Cassel 2019-04-18 10:27 ` [PATCH 2/3] PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev() Ulf Hansson 2019-04-22 8:29 ` Viresh Kumar 2019-04-24 11:28 ` Niklas Cassel 2019-04-18 10:27 ` [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain Ulf Hansson 2019-04-22 8:31 ` Viresh Kumar 2019-04-24 11:28 ` Niklas Cassel 2019-05-01 10:25 ` [PATCH 0/3] PM / Domains: Improve support for multi PM domains Rafael J. Wysocki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox