Re: [PATCHv1 02/11] power: supply: core: auto-exposure of simple-battery data

From: Linus Walleij
Date: Fri Mar 10 2023 - 03:20:29 EST


Hi Sebastian,

thanks for your patch!

On Thu, Mar 9, 2023 at 11:50 PM Sebastian Reichel <sre@xxxxxxxxxx> wrote:

> + /*
> + * Set if constant battery information from firmware should be
> + * exposed automatically. No driver specific code is required
> + * in that case. If the driver also handles a property provided
> + * by constant firmware data, the driver's handler is preferred.
> + */
> + bool expose_battery_info;

Playing it safe with opt-in I see! But I would probably invert it and add
a hide_battery_info for those that don't wanna expose it. It seems
pretty useful to just expose this in general.

However I have no insight in what happens on laptops etc for this
so I guess you have your reasons, either way:

Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

> +extern bool power_supply_battery_info_has_prop(struct power_supply_battery_info *info,
> + enum power_supply_property psp);
> +extern int power_supply_battery_info_get_prop(struct power_supply_battery_info *info,
> + enum power_supply_property psp,
> + union power_supply_propval *val);

I think the build robots complain because you need to add some stubs
for the not enabled case.

Yours,
Linus Walleij