power: supply: sysfs: rework uevent property loop
authorThomas Weißschuh <linux@weissschuh.net>
Mon, 11 Nov 2024 21:40:08 +0000 (22:40 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 4 Dec 2024 23:02:31 +0000 (00:02 +0100)
commitf29a749d01dc136ee6e08afafebbccc389ef5b05
treebe54a0c6c4f708510e2f0511a856144f70e781ef
parent5c2141f2c7c671e8696e2ee1c7b332c77266dd08
power: supply: sysfs: rework uevent property loop

Instead of looping through all properties known to be supported by the
psy, loop over all known properties and decide based on the return value
of power_supply_get_property() whether the property existed.

This makes the code shorter now and even more so when power supply
extensions are added.
It also simplifies the locking, as it can all happen inside
power_supply_get_property().

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20241111-power-supply-extensions-v4-6-7240144daa8e@weissschuh.net
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/power_supply_sysfs.c