diff mbox series

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

Message ID 20190214181249.2749-1-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
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.

Fixes: 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/base/power/domain.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:48)
> 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.
> 
> Fixes: 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Viresh Kumar Feb. 15, 2019, 3:02 a.m. UTC | #2
On 14-02-19, 10:12, Douglas Anderson wrote:
> 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.
> 
> Fixes: 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")

Not sure if this should be counted as a fix.

> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> 
>  drivers/base/power/domain.c | 2 +-
>  include/linux/pm_domain.h   | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)

For both the patches:

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Ulf Hansson Feb. 15, 2019, 10:27 a.m. UTC | #3
On Thu, 14 Feb 2019 at 19:13, Douglas Anderson <dianders@chromium.org> wrote:
>
> 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.
>
> Fixes: 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

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

Kind regards
Uffe


> ---
>
>  drivers/base/power/domain.c | 2 +-
>  include/linux/pm_domain.h   | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 45eafe8cf7dd..2c334c01fc43 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -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;
>
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index dd364abb649a..203be5082f33 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -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
>
Doug Anderson Feb. 15, 2019, 3:47 p.m. UTC | #4
Hi,
On Thu, Feb 14, 2019 at 7:02 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 14-02-19, 10:12, Douglas Anderson wrote:
> > 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.
> >
> > 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
Viresh Kumar Feb. 18, 2019, 4:15 a.m. UTC | #5
On 15-02-19, 07:47, Doug Anderson wrote:
> Hi,
> On Thu, Feb 14, 2019 at 7:02 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >
> > On 14-02-19, 10:12, Douglas Anderson wrote:
> > > 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.
> > >
> > > 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.  ;-)

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.
Greg KH Feb. 18, 2019, 8:41 a.m. UTC | #6
On Mon, Feb 18, 2019 at 09:45:14AM +0530, Viresh Kumar wrote:
> On 15-02-19, 07:47, Doug Anderson wrote:
> > Hi,
> > On Thu, Feb 14, 2019 at 7:02 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > >
> > > On 14-02-19, 10:12, Douglas Anderson wrote:
> > > > 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.
> > > >
> > > > 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.  ;-)
> 
> 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
Rafael J. Wysocki Feb. 19, 2019, 10:19 a.m. UTC | #7
On Thursday, February 14, 2019 7:12:48 PM CET Douglas Anderson wrote:
> 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.
> 
> Fixes: 5d6be70add65 ("PM / Domains: Introduce option to attach a device by name to genpd")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> 
>  drivers/base/power/domain.c | 2 +-
>  include/linux/pm_domain.h   | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 45eafe8cf7dd..2c334c01fc43 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -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;
>  
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index dd364abb649a..203be5082f33 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -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;
>  }
> 

Both this and the [2/2] applied, thanks!
diff mbox series

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 45eafe8cf7dd..2c334c01fc43 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -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;
 
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index dd364abb649a..203be5082f33 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -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;
 }