]> git.baikalelectronics.ru Git - kernel.git/commit
power: supply_core: Pass pointer to battery info
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 15 Dec 2021 01:01:18 +0000 (02:01 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Mon, 3 Jan 2022 17:53:10 +0000 (18:53 +0100)
commiteadb4e6b79a47e67bb3b6090452bf1e7cb58f3d0
tree40c0e929cc130988362ff4de29df2447388bbdff
parent11455c9683e676e09b0e61037f48706f2d35f306
power: supply_core: Pass pointer to battery info

The function to retrieve battery info (from the device tree) assumes
we have a static info struct that gets populated by calling into
power_supply_get_battery_info().

This is awkward since I want to support tables of static battery
info by just assigning a pointer to all info based on e.g. a
compatible value in the device tree.

We also have a mixture of static and dynamically allocated
variables here.

Bite the bullet and let power_supply_get_battery_info() allocate
also the memory used for the very top level
struct power_supply_battery_info container. Pass pointers
around and lifecycle this with the psy device just like the
stuff we allocate inside it.

Change all current users over.

As part of the change, initializers need to be added to some
previously uninitialized fields in struct
power_supply_battery_info.

Reviewed-By: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
19 files changed:
drivers/power/supply/ab8500-bm.h
drivers/power/supply/ab8500_bmdata.c
drivers/power/supply/ab8500_btemp.c
drivers/power/supply/ab8500_chargalg.c
drivers/power/supply/ab8500_fg.c
drivers/power/supply/axp20x_battery.c
drivers/power/supply/bd99954-charger.c
drivers/power/supply/bq24190_charger.c
drivers/power/supply/bq2515x_charger.c
drivers/power/supply/bq256xx_charger.c
drivers/power/supply/bq25980_charger.c
drivers/power/supply/bq27xxx_battery.c
drivers/power/supply/cw2015_battery.c
drivers/power/supply/ingenic-battery.c
drivers/power/supply/power_supply_core.c
drivers/power/supply/sc2731_charger.c
drivers/power/supply/sc27xx_fuel_gauge.c
drivers/power/supply/smb347-charger.c
include/linux/power_supply.h