diff mbox series

Warning since "power: supply: add charge_behaviour attributes"

Message ID 52cedbd4-7db2-7d81-f6c6-e6f6b7436545@gmail.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series Warning since "power: supply: add charge_behaviour attributes" | expand

Commit Message

Heiner Kallweit Jan. 4, 2022, 11:03 p.m. UTC
Since 1b0b6cc8030d ("power: supply: add charge_behaviour attributes") I get the following warning:
power_supply_init_attrs: Property 37 skipped because it is missing from power_supply_attrs
Seems the patch misses the following:


Didn't this show up when testing before submitting the patch?

Comments

Hans de Goede Jan. 5, 2022, 10:28 a.m. UTC | #1
Hi Heiner,

On 1/5/22 00:03, Heiner Kallweit wrote:
> Since 1b0b6cc8030d ("power: supply: add charge_behaviour attributes") I get the following warning:
> power_supply_init_attrs: Property 37 skipped because it is missing from power_supply_attrs
> Seems the patch misses the following:
> 
> diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
> index 2cfce2b2e..ef5109102 100644
> --- a/drivers/power/supply/power_supply_sysfs.c
> +++ b/drivers/power/supply/power_supply_sysfs.c
> @@ -179,6 +179,7 @@ static struct power_supply_attr power_supply_attrs[] = {
>         POWER_SUPPLY_ATTR(CHARGE_CONTROL_LIMIT_MAX),
>         POWER_SUPPLY_ATTR(CHARGE_CONTROL_START_THRESHOLD),
>         POWER_SUPPLY_ATTR(CHARGE_CONTROL_END_THRESHOLD),
> +       POWER_SUPPLY_ENUM_ATTR(CHARGE_BEHAVIOUR),
>         POWER_SUPPLY_ATTR(INPUT_CURRENT_LIMIT),
>         POWER_SUPPLY_ATTR(INPUT_VOLTAGE_LIMIT),
>         POWER_SUPPLY_ATTR(INPUT_POWER_LIMIT),
> 
> Didn't this show up when testing before submitting the patch?

Thank you for reporting this.

The warning did show up in dmesg, but the attribute still works despite the warning
because it is injected as an "extra" property through the drivers/acpi/battery.c
battery_hook_register() mechanism which uses device_add_groups() to add extra
properties handled by vendor specific extensions.

These extra properties do not use the drivers/power/supply/power_supply_sysfs.c
registered attributed handlers and this caused us to miss this, since everything
still works fine for the current user of the new charge_behaviour attribute
despite the warning.

And we completely missed the warning in dmesg.

Regards,

Hans
diff mbox series

Patch

diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index 2cfce2b2e..ef5109102 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -179,6 +179,7 @@  static struct power_supply_attr power_supply_attrs[] = {
        POWER_SUPPLY_ATTR(CHARGE_CONTROL_LIMIT_MAX),
        POWER_SUPPLY_ATTR(CHARGE_CONTROL_START_THRESHOLD),
        POWER_SUPPLY_ATTR(CHARGE_CONTROL_END_THRESHOLD),
+       POWER_SUPPLY_ENUM_ATTR(CHARGE_BEHAVIOUR),
        POWER_SUPPLY_ATTR(INPUT_CURRENT_LIMIT),
        POWER_SUPPLY_ATTR(INPUT_VOLTAGE_LIMIT),
        POWER_SUPPLY_ATTR(INPUT_POWER_LIMIT),