diff mbox series

[2/2] PM / Domains: Mark "name" const in dev_pm_domain_attach_by_name()

Message ID 20190214181249.2749-2-dianders@chromium.org (mailing list archive)
State Mainlined
Delegated to: Rafael Wysocki
Headers show
Series [1/2] PM / Domains: Mark "name" const in genpd_dev_pm_attach_by_name() | expand

Commit Message

Doug Anderson Feb. 14, 2019, 6:12 p.m. UTC
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.

Fixes: 27dceb81f445 ("PM / Domains: Introduce dev_pm_domain_attach_by_name()")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

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

Comments

Stephen Boyd Feb. 14, 2019, 6:23 p.m. UTC | #1
Quoting Douglas Anderson (2019-02-14 10:12:49)
> 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.
> 
> Fixes: 27dceb81f445 ("PM / Domains: Introduce dev_pm_domain_attach_by_name()")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Ulf Hansson Feb. 15, 2019, 10:27 a.m. UTC | #2
On Thu, 14 Feb 2019 at 19:13, Douglas Anderson <dianders@chromium.org> wrote:
>
> 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.
>
> Fixes: 27dceb81f445 ("PM / Domains: Introduce dev_pm_domain_attach_by_name()")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

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

Perhaps fold $subject patch into patch1, they seems highly related.
Anyway, no strong opinion here.

Kind regards
Uffe

> ---
>
>  drivers/base/power/common.c | 2 +-
>  include/linux/pm_domain.h   | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
> index b413951c6abc..22aedb28aad7 100644
> --- a/drivers/base/power/common.c
> +++ b/drivers/base/power/common.c
> @@ -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);
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 203be5082f33..1ed5874bcee0 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -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
>
Doug Anderson Feb. 15, 2019, 3:42 p.m. UTC | #3
Hi,

On Fri, Feb 15, 2019 at 2:28 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Thu, 14 Feb 2019 at 19:13, Douglas Anderson <dianders@chromium.org> wrote:
> >
> > 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.
> >
> > Fixes: 27dceb81f445 ("PM / Domains: Introduce dev_pm_domain_attach_by_name()")
> > Signed-off-by: Douglas Anderson <dianders@chromium.org>
>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> 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
diff mbox series

Patch

diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index b413951c6abc..22aedb28aad7 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -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);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 203be5082f33..1ed5874bcee0 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -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;
 }