PM / Domains: Mark "name" const in genpd_dev_pm_attach_by_name()
Subsystems (6)
PATCH 1/2 PM / Domains: Mark "name" const in genpd_dev_pm_attach_by_name()
The genpd_dev_pm_attach_by_name() simply takes the name and passes it to of_property_match_string() where the argument is "const char *". Adding a const here allows a later patch to add a const to dev_pm_domain_attach_by_name() which allows drivers to pass in a name that was declared "const" in a driver.
---
drivers/base/power/domain.c | 2 +- include/linux/pm_domain.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/base/power/domain.c +1 -1
@@ -2483,7 +2483,7 @@ EXPORT_SYMBOL_GPL(genpd_dev_pm_attach_by_id);* power-domain-names DT property. For further description see * genpd_dev_pm_attach_by_id(). */ -struct device *genpd_dev_pm_attach_by_name (struct device *dev,char *name) +struct device *genpd_dev_pm_attach_by_name (struct device *dev,const char *name) {int index;
include/linux/pm_domain.h +2 -2
@@ -271,7 +271,7 @@ int genpd_dev_pm_attach(struct device *dev);struct device *genpd_dev_pm_attach_by_id (struct device *dev,unsigned int index);struct device *genpd_dev_pm_attach_by_name (struct device *dev, -char *name); +const char *name);#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ static inline int of_genpd_add_provider_simple (struct device_node *np,struct generic_pm_domain *genpd)
@@ -324,7 +324,7 @@ static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev, }static inline struct device *genpd_dev_pm_attach_by_name (struct device *dev, -char *name) +const char *name) {return NULL ; }
Signature · 1 line
2.21.0.rc0.258.g878e2cd30e-goog
PATCH 2/2 PM / Domains: Mark "name" const in dev_pm_domain_attach_by_name()
As of the patch ("PM / Domains: Mark "name" const in genpd_dev_pm_attach_by_name()") it's clear that the name in dev_pm_domain_attach_by_name() can be const. Mark it as so. This allows drivers to pass in a name that was declared "const" in a driver.
---
drivers/base/power/common.c | 2 +- include/linux/pm_domain.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/base/power/common.c +1 -1
@@ -160,7 +160,7 @@ EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_id);* For a detailed function description, see dev_pm_domain_attach_by_id(). */ struct device *dev_pm_domain_attach_by_name (struct device *dev, -char *name) +const char *name) {if (dev->pm_domain)return ERR_PTR (-EEXIST );
include/linux/pm_domain.h +2 -2
@@ -341,7 +341,7 @@ int dev_pm_domain_attach(struct device *dev, bool power_on);struct device *dev_pm_domain_attach_by_id (struct device *dev,unsigned int index);struct device *dev_pm_domain_attach_by_name (struct device *dev, -char *name); +const char *name);void dev_pm_domain_detach (struct device *dev,bool power_off);void dev_pm_domain_set (struct device *dev,struct dev_pm_domain *pd);#else
@@ -355,7 +355,7 @@ static inline struct device *dev_pm_domain_attach_by_id(struct device *dev,return NULL ; }static inline struct device *dev_pm_domain_attach_by_name (struct device *dev, -char *name) +const char *name) {return NULL ; }
Signature · 1 line
2.21.0.rc0.258.g878e2cd30e-goog
Re: [PATCH 2/2] PM / Domains: Mark "name" const in dev_pm_domain_attach_by_name()
Quoting Douglas Anderson (2019-02-14 10:12:49)
Quoted 9 lines
As of the patch ("PM / Domains: Mark "name" const in
genpd_dev_pm_attach_by_name()") it's clear that the name indev_pm_domain_attach_by_name()can be const. Mark it as so. This allows drivers to pass in a name that was declared "const" in a driver.Fixes 27dceb81f445 ("PM / Domains: Introduce dev_pm_domain_attach_by_name()")Signed-off-by Douglas Anderson <[email protected]>---
Re: [PATCH 2/2] PM / Domains: Mark "name" const in dev_pm_domain_attach_by_name()
In reply to Douglas AndersonQuoted 9 lines · Douglas Anderson
As of the patch ("PM / Domains: Mark "name" const in
genpd_dev_pm_attach_by_name()") it's clear that the name indev_pm_domain_attach_by_name()can be const. Mark it as so. This allows drivers to pass in a name that was declared "const" in a driver.Fixes 27dceb81f445 ("PM / Domains: Introduce dev_pm_domain_attach_by_name()")Signed-off-by Douglas Anderson <[email protected]>
Perhaps fold $subject patch into patch1, they seems highly related. Anyway, no strong opinion here.
Kind regards
Uffe
Quoted 44 lines
---
drivers/base/power/common.c | 2 +- include/linux/pm_domain.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/base/power/common.c +1
-1@@ -160,7 +160,7 @@ EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_id);* For a detailed function description, see dev_pm_domain_attach_by_id(). */ struct device *dev_pm_domain_attach_by_name (struct device *dev, -char *name) +const char *name) {if (dev->pm_domain)return ERR_PTR (-EEXIST );include/linux/pm_domain.h +2
-3@@ -341,7 +341,7 @@ int dev_pm_domain_attach(struct device *dev, bool power_on);struct device *dev_pm_domain_attach_by_id (struct device *dev,unsigned int index);struct device *dev_pm_domain_attach_by_name (struct device *dev, -char *name); +const char *name);void dev_pm_domain_detach (struct device *dev,bool power_off);void dev_pm_domain_set (struct device *dev,struct dev_pm_domain *pd);#else @@ -355,7 +355,7 @@ static inline struct device *dev_pm_domain_attach_by_id(struct device *dev,return NULL ; }static inline struct device *dev_pm_domain_attach_by_name (struct device *dev, -char *name) +const char *name) {return NULL ; } --2.21.0.rc0.258.g878e2cd30e-goog
Re: [PATCH 2/2] PM / Domains: Mark "name" const in dev_pm_domain_attach_by_name()
Hi,
Quoted 9 lines · Ulf Hansson
Quoted 7 lines · Douglas Anderson
As of the patch ("PM / Domains: Mark "name" const in
genpd_dev_pm_attach_by_name()") it's clear that the name indev_pm_domain_attach_by_name()can be const. Mark it as so. This allows drivers to pass in a name that was declared "const" in a driver.
Quoted 7 lines
Quoted 2 lines
Fixes 27dceb81f445 ("PM / Domains: Introduce dev_pm_domain_attach_by_name()")Signed-off-by Douglas Anderson <[email protected]>Reviewed-by Ulf Hansson <[email protected]>Perhaps fold $subject patch into patch1, they seems highly related. Anyway, no strong opinion here.
Sure, either way is fine with me so I'll wait until someone tells me for sure one way or the other. I'm also happy if they just get squashed together when applied if that's easier. I originally kept them separate since the two APIs were originally added in separate patches so it seemed consistent to do the bugfixes in separate patches. ;-)
-Doug
Quoting Douglas Anderson (2019-02-14 10:12:48)
Quoted 9 lines
The
genpd_dev_pm_attach_by_name()simply takes the name and passes it toof_property_match_string()where the argument is "const char *". Adding a const here allows a later patch to add a const todev_pm_domain_attach_by_name()which allows drivers to pass in a name that was declared "const" in a driver.Fixes 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")Signed-off-by Douglas Anderson <[email protected]>---
Quoted 7 lines · Douglas Anderson
The
genpd_dev_pm_attach_by_name()simply takes the name and passes it toof_property_match_string()where the argument is "const char *". Adding a const here allows a later patch to add a const todev_pm_domain_attach_by_name()which allows drivers to pass in a name that was declared "const" in a driver.Fixes 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")
Not sure if this should be counted as a fix.
Quoted 6 lines
Signed-off-by Douglas Anderson <[email protected]>---
drivers/base/power/domain.c | 2 +- include/linux/pm_domain.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
For both the patches:
Signature · 1 line
viresh
Hi,
Quoted 11 lines · Viresh Kumar
Quoted 7 lines · Douglas Anderson
The
genpd_dev_pm_attach_by_name()simply takes the name and passes it toof_property_match_string()where the argument is "const char *". Adding a const here allows a later patch to add a const todev_pm_domain_attach_by_name()which allows drivers to pass in a name that was declared "const" in a driver.Fixes 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")Not sure if this should be counted as a fix.
I'm OK if the "Fixes" is stripped when applying or if someone tells me to re-post without the Fixes--just let me know. In general I do a lot of cherry-picks from upstream and I appreciate the Fixes tag helping to link patches together. In this case if I picked the original patch I'd definitely want this one too. Certainly, though, CCing stable would make no sense in this case. ;-)
-Doug
Quoted 12 lines · Doug Anderson
Hi,
Quoted 10 lines · Viresh Kumar
Quoted 7 lines · Douglas Anderson
The
genpd_dev_pm_attach_by_name()simply takes the name and passes it toof_property_match_string()where the argument is "const char *". Adding a const here allows a later patch to add a const todev_pm_domain_attach_by_name()which allows drivers to pass in a name that was declared "const" in a driver.Fixes 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")
Quoted 8 lines
Quoted 1 line
Not sure if this should be counted as a fix.
I'm OK if the "Fixes" is stripped when applying or if someone tells me to re-post without the Fixes--just let me know. In general I do a lot of cherry-picks from upstream and I appreciate the Fixes tag helping to link patches together. In this case if I picked the original patch I'd definitely want this one too. Certainly, though, CCing stable would make no sense in this case. ;-)
I am not sure if this is being done right now or not, but I read/heard somewhere that stable has started picking "Fixes" patches directly as well even if they aren't cc'd to stable.
Signature · 1 line
viresh
Greg Kroah-Hartman
maintainerQuoted 22 lines · Viresh Kumar
Quoted 12 lines · Doug Anderson
Hi,
Quoted 10 lines · Viresh Kumar
Quoted 7 lines · Douglas Anderson
The
genpd_dev_pm_attach_by_name()simply takes the name and passes it toof_property_match_string()where the argument is "const char *". Adding a const here allows a later patch to add a const todev_pm_domain_attach_by_name()which allows drivers to pass in a name that was declared "const" in a driver.Fixes 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")Quoted 8 lines
Quoted 1 line
Not sure if this should be counted as a fix.
I'm OK if the "Fixes" is stripped when applying or if someone tells me to re-post without the Fixes--just let me know. In general I do a lot of cherry-picks from upstream and I appreciate the Fixes tag helping to link patches together. In this case if I picked the original patch I'd definitely want this one too. Certainly, though, CCing stable would make no sense in this case. ;-)
Quoted 3 lines
I am not sure if this is being done right now or not, but I read/heard somewhere that stable has started picking "Fixes" patches directly as well even if they aren't cc'd to stable.
It's random, not always happening, and nothing you can rely on.
If you know this is a patch for older kernels, then always add the cc:
stable line, as the documentation says you have to do!
thanks,
greg k-h
Quoted 9 lines · Douglas Anderson
The
genpd_dev_pm_attach_by_name()simply takes the name and passes it toof_property_match_string()where the argument is "const char *". Adding a const here allows a later patch to add a const todev_pm_domain_attach_by_name()which allows drivers to pass in a name that was declared "const" in a driver.Fixes 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")Signed-off-by Douglas Anderson <[email protected]>
Kind regards
Uffe
Quoted 44 lines
---
drivers/base/power/domain.c | 2 +- include/linux/pm_domain.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/base/power/domain.c +1
-1@@ -2483,7 +2483,7 @@ EXPORT_SYMBOL_GPL(genpd_dev_pm_attach_by_id);* power-domain-names DT property. For further description see * genpd_dev_pm_attach_by_id(). */ -struct device *genpd_dev_pm_attach_by_name (struct device *dev,char *name) +struct device *genpd_dev_pm_attach_by_name (struct device *dev,const char *name) {int index;include/linux/pm_domain.h +2
-3@@ -271,7 +271,7 @@ int genpd_dev_pm_attach(struct device *dev);struct device *genpd_dev_pm_attach_by_id (struct device *dev,unsigned int index);struct device *genpd_dev_pm_attach_by_name (struct device *dev, -char *name); +const char *name);#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ static inline int of_genpd_add_provider_simple (struct device_node *np,struct generic_pm_domain *genpd)@@ -324,7 +324,7 @@ static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev, }static inline struct device *genpd_dev_pm_attach_by_name (struct device *dev, -char *name) +const char *name) {return NULL ; } --2.21.0.rc0.258.g878e2cd30e-goog
Quoted 42 lines · CET Douglas Anderson
The
genpd_dev_pm_attach_by_name()simply takes the name and passes it toof_property_match_string()where the argument is "const char *". Adding a const here allows a later patch to add a const todev_pm_domain_attach_by_name()which allows drivers to pass in a name that was declared "const" in a driver.Fixes 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")Signed-off-by Douglas Anderson <[email protected]>---
drivers/base/power/domain.c | 2 +- include/linux/pm_domain.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/base/power/domain.c +1
-1@@ -2483,7 +2483,7 @@ EXPORT_SYMBOL_GPL(genpd_dev_pm_attach_by_id);* power-domain-names DT property. For further description see * genpd_dev_pm_attach_by_id(). */ -struct device *genpd_dev_pm_attach_by_name (struct device *dev,char *name) +struct device *genpd_dev_pm_attach_by_name (struct device *dev,const char *name) {int index;include/linux/pm_domain.h +1
-1@@ -271,7 +271,7 @@ int genpd_dev_pm_attach(struct device *dev);struct device *genpd_dev_pm_attach_by_id (struct device *dev,unsigned int index);struct device *genpd_dev_pm_attach_by_name (struct device *dev, -char *name); +const char *name);#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ static inline int of_genpd_add_provider_simple (struct device_node *np,struct generic_pm_domain *genpd)
include/linux/pm_domain.h static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev, · line 330
Quoted 8 lines
include/linux/pm_domain.h +1
-1@@ -324,7 +324,7 @@ static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev, }static inline struct device *genpd_dev_pm_attach_by_name (struct device *dev, -char *name) +const char *name) {return NULL ; }
Both this and the [2/2] applied, thanks!