All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: supply: olpc_battery: fix the power supply name
@ 2019-12-21  7:17 Lubomir Rintel
  2020-01-09 15:09 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Lubomir Rintel @ 2019-12-21  7:17 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Darren Hart, Andy Shevchenko, platform-driver-x86, linux-kernel,
	linux-pm, Lubomir Rintel

The framework is unhappy about them, because it uses the names in sysfs
attributes:

  power_supply olpc-ac: hwmon: 'olpc-ac' is not a valid name attribute, please fix
  power_supply olpc-battery: hwmon: 'olpc-battery' is not a valid name attribute, please fix

See also commit 648cd48c9e56 ("hwmon: Do not accept invalid name
attributes") and commit 74d3b6419772 ("hwmon: Relax name attribute
validation for new APIs").

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 arch/x86/platform/olpc/olpc-xo1-sci.c  | 4 ++--
 arch/x86/platform/olpc/olpc-xo15-sci.c | 4 ++--
 drivers/platform/olpc/olpc-xo175-ec.c  | 4 ++--
 drivers/power/supply/olpc_battery.c    | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
index 99a28ce2244c7..09bd195cc9012 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -53,7 +53,7 @@ static const char * const lid_wake_mode_names[] = {
 
 static void battery_status_changed(void)
 {
-	struct power_supply *psy = power_supply_get_by_name("olpc-battery");
+	struct power_supply *psy = power_supply_get_by_name("olpc_battery");
 
 	if (psy) {
 		power_supply_changed(psy);
@@ -63,7 +63,7 @@ static void battery_status_changed(void)
 
 static void ac_status_changed(void)
 {
-	struct power_supply *psy = power_supply_get_by_name("olpc-ac");
+	struct power_supply *psy = power_supply_get_by_name("olpc_ac");
 
 	if (psy) {
 		power_supply_changed(psy);
diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
index 6d193bb36021b..7bc1ea6a47974 100644
--- a/arch/x86/platform/olpc/olpc-xo15-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
@@ -75,7 +75,7 @@ static struct kobj_attribute lid_wake_on_close_attr =
 
 static void battery_status_changed(void)
 {
-	struct power_supply *psy = power_supply_get_by_name("olpc-battery");
+	struct power_supply *psy = power_supply_get_by_name("olpc_battery");
 
 	if (psy) {
 		power_supply_changed(psy);
@@ -85,7 +85,7 @@ static void battery_status_changed(void)
 
 static void ac_status_changed(void)
 {
-	struct power_supply *psy = power_supply_get_by_name("olpc-ac");
+	struct power_supply *psy = power_supply_get_by_name("olpc_ac");
 
 	if (psy) {
 		power_supply_changed(psy);
diff --git a/drivers/platform/olpc/olpc-xo175-ec.c b/drivers/platform/olpc/olpc-xo175-ec.c
index 83ed1fbf73cfd..5e1d14e35f20b 100644
--- a/drivers/platform/olpc/olpc-xo175-ec.c
+++ b/drivers/platform/olpc/olpc-xo175-ec.c
@@ -410,7 +410,7 @@ static void olpc_xo175_ec_complete(void *arg)
 		dev_dbg(dev, "got event %.2x\n", byte);
 		switch (byte) {
 		case EVENT_AC_CHANGE:
-			psy = power_supply_get_by_name("olpc-ac");
+			psy = power_supply_get_by_name("olpc_ac");
 			if (psy) {
 				power_supply_changed(psy);
 				power_supply_put(psy);
@@ -420,7 +420,7 @@ static void olpc_xo175_ec_complete(void *arg)
 		case EVENT_BATTERY_CRITICAL:
 		case EVENT_BATTERY_SOC_CHANGE:
 		case EVENT_BATTERY_ERROR:
-			psy = power_supply_get_by_name("olpc-battery");
+			psy = power_supply_get_by_name("olpc_battery");
 			if (psy) {
 				power_supply_changed(psy);
 				power_supply_put(psy);
diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c
index ad0e9e0edb3f8..e0476ec06601d 100644
--- a/drivers/power/supply/olpc_battery.c
+++ b/drivers/power/supply/olpc_battery.c
@@ -88,7 +88,7 @@ static enum power_supply_property olpc_ac_props[] = {
 };
 
 static const struct power_supply_desc olpc_ac_desc = {
-	.name = "olpc-ac",
+	.name = "olpc_ac",
 	.type = POWER_SUPPLY_TYPE_MAINS,
 	.properties = olpc_ac_props,
 	.num_properties = ARRAY_SIZE(olpc_ac_props),
@@ -605,7 +605,7 @@ static const struct attribute_group *olpc_bat_sysfs_groups[] = {
  *********************************************************************/
 
 static struct power_supply_desc olpc_bat_desc = {
-	.name = "olpc-battery",
+	.name = "olpc_battery",
 	.get_property = olpc_bat_get_property,
 	.use_for_apm = 1,
 };
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] power: supply: olpc_battery: fix the power supply name
  2019-12-21  7:17 [PATCH] power: supply: olpc_battery: fix the power supply name Lubomir Rintel
@ 2020-01-09 15:09 ` Andy Shevchenko
  2020-01-10 20:00   ` Lubomir Rintel
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2020-01-09 15:09 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Sebastian Reichel, Darren Hart, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Linux PM

On Sat, Dec 21, 2019 at 9:18 AM Lubomir Rintel <lkundrak@v3.sk> wrote:
>
> The framework is unhappy about them, because it uses the names in sysfs
> attributes:
>
>   power_supply olpc-ac: hwmon: 'olpc-ac' is not a valid name attribute, please fix
>   power_supply olpc-battery: hwmon: 'olpc-battery' is not a valid name attribute, please fix

I'm wondering if it's an ABI change and how user space is supposed to
cope with it.

>
> See also commit 648cd48c9e56 ("hwmon: Do not accept invalid name
> attributes") and commit 74d3b6419772 ("hwmon: Relax name attribute
> validation for new APIs").
>
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---
>  arch/x86/platform/olpc/olpc-xo1-sci.c  | 4 ++--
>  arch/x86/platform/olpc/olpc-xo15-sci.c | 4 ++--
>  drivers/platform/olpc/olpc-xo175-ec.c  | 4 ++--
>  drivers/power/supply/olpc_battery.c    | 4 ++--
>  4 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
> index 99a28ce2244c7..09bd195cc9012 100644
> --- a/arch/x86/platform/olpc/olpc-xo1-sci.c
> +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
> @@ -53,7 +53,7 @@ static const char * const lid_wake_mode_names[] = {
>
>  static void battery_status_changed(void)
>  {
> -       struct power_supply *psy = power_supply_get_by_name("olpc-battery");
> +       struct power_supply *psy = power_supply_get_by_name("olpc_battery");
>
>         if (psy) {
>                 power_supply_changed(psy);
> @@ -63,7 +63,7 @@ static void battery_status_changed(void)
>
>  static void ac_status_changed(void)
>  {
> -       struct power_supply *psy = power_supply_get_by_name("olpc-ac");
> +       struct power_supply *psy = power_supply_get_by_name("olpc_ac");
>
>         if (psy) {
>                 power_supply_changed(psy);
> diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
> index 6d193bb36021b..7bc1ea6a47974 100644
> --- a/arch/x86/platform/olpc/olpc-xo15-sci.c
> +++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
> @@ -75,7 +75,7 @@ static struct kobj_attribute lid_wake_on_close_attr =
>
>  static void battery_status_changed(void)
>  {
> -       struct power_supply *psy = power_supply_get_by_name("olpc-battery");
> +       struct power_supply *psy = power_supply_get_by_name("olpc_battery");
>
>         if (psy) {
>                 power_supply_changed(psy);
> @@ -85,7 +85,7 @@ static void battery_status_changed(void)
>
>  static void ac_status_changed(void)
>  {
> -       struct power_supply *psy = power_supply_get_by_name("olpc-ac");
> +       struct power_supply *psy = power_supply_get_by_name("olpc_ac");
>
>         if (psy) {
>                 power_supply_changed(psy);
> diff --git a/drivers/platform/olpc/olpc-xo175-ec.c b/drivers/platform/olpc/olpc-xo175-ec.c
> index 83ed1fbf73cfd..5e1d14e35f20b 100644
> --- a/drivers/platform/olpc/olpc-xo175-ec.c
> +++ b/drivers/platform/olpc/olpc-xo175-ec.c
> @@ -410,7 +410,7 @@ static void olpc_xo175_ec_complete(void *arg)
>                 dev_dbg(dev, "got event %.2x\n", byte);
>                 switch (byte) {
>                 case EVENT_AC_CHANGE:
> -                       psy = power_supply_get_by_name("olpc-ac");
> +                       psy = power_supply_get_by_name("olpc_ac");
>                         if (psy) {
>                                 power_supply_changed(psy);
>                                 power_supply_put(psy);
> @@ -420,7 +420,7 @@ static void olpc_xo175_ec_complete(void *arg)
>                 case EVENT_BATTERY_CRITICAL:
>                 case EVENT_BATTERY_SOC_CHANGE:
>                 case EVENT_BATTERY_ERROR:
> -                       psy = power_supply_get_by_name("olpc-battery");
> +                       psy = power_supply_get_by_name("olpc_battery");
>                         if (psy) {
>                                 power_supply_changed(psy);
>                                 power_supply_put(psy);
> diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c
> index ad0e9e0edb3f8..e0476ec06601d 100644
> --- a/drivers/power/supply/olpc_battery.c
> +++ b/drivers/power/supply/olpc_battery.c
> @@ -88,7 +88,7 @@ static enum power_supply_property olpc_ac_props[] = {
>  };
>
>  static const struct power_supply_desc olpc_ac_desc = {
> -       .name = "olpc-ac",
> +       .name = "olpc_ac",
>         .type = POWER_SUPPLY_TYPE_MAINS,
>         .properties = olpc_ac_props,
>         .num_properties = ARRAY_SIZE(olpc_ac_props),
> @@ -605,7 +605,7 @@ static const struct attribute_group *olpc_bat_sysfs_groups[] = {
>   *********************************************************************/
>
>  static struct power_supply_desc olpc_bat_desc = {
> -       .name = "olpc-battery",
> +       .name = "olpc_battery",
>         .get_property = olpc_bat_get_property,
>         .use_for_apm = 1,
>  };
> --
> 2.24.1
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] power: supply: olpc_battery: fix the power supply name
  2020-01-09 15:09 ` Andy Shevchenko
@ 2020-01-10 20:00   ` Lubomir Rintel
  2020-01-10 20:52     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Lubomir Rintel @ 2020-01-10 20:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Sebastian Reichel, Darren Hart, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Linux PM

On Thu, 2020-01-09 at 17:09 +0200, Andy Shevchenko wrote:
> On Sat, Dec 21, 2019 at 9:18 AM Lubomir Rintel <lkundrak@v3.sk> wrote:
> > The framework is unhappy about them, because it uses the names in sysfs
> > attributes:
> > 
> >   power_supply olpc-ac: hwmon: 'olpc-ac' is not a valid name attribute, please fix
> >   power_supply olpc-battery: hwmon: 'olpc-battery' is not a valid name attribute, please fix
> 
> I'm wondering if it's an ABI change and how user space is supposed to
> cope with it.

It changes the sysfs path. It is rather unlikely that udisks or
anything else userspace cares.

If it does, then I guess the warning that suggests that it's a bug that
should be fixed should be removed instead.
> 
> > See also commit 648cd48c9e56 ("hwmon: Do not accept invalid name
> > attributes") and commit 74d3b6419772 ("hwmon: Relax name attribute
> > validation for new APIs").
> > 
> > Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> > ---
> >  arch/x86/platform/olpc/olpc-xo1-sci.c  | 4 ++--
> >  arch/x86/platform/olpc/olpc-xo15-sci.c | 4 ++--
> >  drivers/platform/olpc/olpc-xo175-ec.c  | 4 ++--
> >  drivers/power/supply/olpc_battery.c    | 4 ++--
> >  4 files changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
> > index 99a28ce2244c7..09bd195cc9012 100644
> > --- a/arch/x86/platform/olpc/olpc-xo1-sci.c
> > +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
> > @@ -53,7 +53,7 @@ static const char * const lid_wake_mode_names[] = {
> > 
> >  static void battery_status_changed(void)
> >  {
> > -       struct power_supply *psy = power_supply_get_by_name("olpc-battery");
> > +       struct power_supply *psy = power_supply_get_by_name("olpc_battery");
> > 
> >         if (psy) {
> >                 power_supply_changed(psy);
> > @@ -63,7 +63,7 @@ static void battery_status_changed(void)
> > 
> >  static void ac_status_changed(void)
> >  {
> > -       struct power_supply *psy = power_supply_get_by_name("olpc-ac");
> > +       struct power_supply *psy = power_supply_get_by_name("olpc_ac");
> > 
> >         if (psy) {
> >                 power_supply_changed(psy);
> > diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
> > index 6d193bb36021b..7bc1ea6a47974 100644
> > --- a/arch/x86/platform/olpc/olpc-xo15-sci.c
> > +++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
> > @@ -75,7 +75,7 @@ static struct kobj_attribute lid_wake_on_close_attr =
> > 
> >  static void battery_status_changed(void)
> >  {
> > -       struct power_supply *psy = power_supply_get_by_name("olpc-battery");
> > +       struct power_supply *psy = power_supply_get_by_name("olpc_battery");
> > 
> >         if (psy) {
> >                 power_supply_changed(psy);
> > @@ -85,7 +85,7 @@ static void battery_status_changed(void)
> > 
> >  static void ac_status_changed(void)
> >  {
> > -       struct power_supply *psy = power_supply_get_by_name("olpc-ac");
> > +       struct power_supply *psy = power_supply_get_by_name("olpc_ac");
> > 
> >         if (psy) {
> >                 power_supply_changed(psy);
> > diff --git a/drivers/platform/olpc/olpc-xo175-ec.c b/drivers/platform/olpc/olpc-xo175-ec.c
> > index 83ed1fbf73cfd..5e1d14e35f20b 100644
> > --- a/drivers/platform/olpc/olpc-xo175-ec.c
> > +++ b/drivers/platform/olpc/olpc-xo175-ec.c
> > @@ -410,7 +410,7 @@ static void olpc_xo175_ec_complete(void *arg)
> >                 dev_dbg(dev, "got event %.2x\n", byte);
> >                 switch (byte) {
> >                 case EVENT_AC_CHANGE:
> > -                       psy = power_supply_get_by_name("olpc-ac");
> > +                       psy = power_supply_get_by_name("olpc_ac");
> >                         if (psy) {
> >                                 power_supply_changed(psy);
> >                                 power_supply_put(psy);
> > @@ -420,7 +420,7 @@ static void olpc_xo175_ec_complete(void *arg)
> >                 case EVENT_BATTERY_CRITICAL:
> >                 case EVENT_BATTERY_SOC_CHANGE:
> >                 case EVENT_BATTERY_ERROR:
> > -                       psy = power_supply_get_by_name("olpc-battery");
> > +                       psy = power_supply_get_by_name("olpc_battery");
> >                         if (psy) {
> >                                 power_supply_changed(psy);
> >                                 power_supply_put(psy);
> > diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c
> > index ad0e9e0edb3f8..e0476ec06601d 100644
> > --- a/drivers/power/supply/olpc_battery.c
> > +++ b/drivers/power/supply/olpc_battery.c
> > @@ -88,7 +88,7 @@ static enum power_supply_property olpc_ac_props[] = {
> >  };
> > 
> >  static const struct power_supply_desc olpc_ac_desc = {
> > -       .name = "olpc-ac",
> > +       .name = "olpc_ac",
> >         .type = POWER_SUPPLY_TYPE_MAINS,
> >         .properties = olpc_ac_props,
> >         .num_properties = ARRAY_SIZE(olpc_ac_props),
> > @@ -605,7 +605,7 @@ static const struct attribute_group *olpc_bat_sysfs_groups[] = {
> >   *********************************************************************/
> > 
> >  static struct power_supply_desc olpc_bat_desc = {
> > -       .name = "olpc-battery",
> > +       .name = "olpc_battery",
> >         .get_property = olpc_bat_get_property,
> >         .use_for_apm = 1,
> >  };
> > --
> > 2.24.1
> > 
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] power: supply: olpc_battery: fix the power supply name
  2020-01-10 20:00   ` Lubomir Rintel
@ 2020-01-10 20:52     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-01-10 20:52 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Sebastian Reichel, Darren Hart, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Linux PM

On Fri, Jan 10, 2020 at 10:00 PM Lubomir Rintel <lkundrak@v3.sk> wrote:
> On Thu, 2020-01-09 at 17:09 +0200, Andy Shevchenko wrote:
> > On Sat, Dec 21, 2019 at 9:18 AM Lubomir Rintel <lkundrak@v3.sk> wrote:
> > > The framework is unhappy about them, because it uses the names in sysfs
> > > attributes:
> > >
> > >   power_supply olpc-ac: hwmon: 'olpc-ac' is not a valid name attribute, please fix
> > >   power_supply olpc-battery: hwmon: 'olpc-battery' is not a valid name attribute, please fix
> >
> > I'm wondering if it's an ABI change and how user space is supposed to
> > cope with it.
>
> It changes the sysfs path. It is rather unlikely that udisks or
> anything else userspace cares.
>
> If it does, then I guess the warning that suggests that it's a bug that
> should be fixed should be removed instead.

That said, I'm fine with this as long as power_supply subsystem maintainer does.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-10 20:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-21  7:17 [PATCH] power: supply: olpc_battery: fix the power supply name Lubomir Rintel
2020-01-09 15:09 ` Andy Shevchenko
2020-01-10 20:00   ` Lubomir Rintel
2020-01-10 20:52     ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.