diff options
author | Hans de Goede <hdegoede@redhat.com> | 2024-09-08 20:53:36 +0200 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2024-09-14 11:06:07 +0200 |
commit | 78f281e5bdeb6476fab97a2c3fcece1094b42aaf (patch) | |
tree | 53f3c470c6e3504d8a7cb1f60b20ca6a580a1857 /drivers/regulator/pcap-regulator.c | |
parent | power: supply: ab8500: Constify struct kobj_type (diff) | |
download | linux-78f281e5bdeb6476fab97a2c3fcece1094b42aaf.tar.xz linux-78f281e5bdeb6476fab97a2c3fcece1094b42aaf.zip |
power: supply: Drop use_cnt check from power_supply_property_is_writeable()
power_supply_property_is_writeable() gets called from the is_visible()
callback for the sysfs attributes of power_supply class devices and for
the sysfs attributes of power_supply core instantiated hwmon class devices.
These sysfs attributes get registered by the device_add() respectively
power_supply_add_hwmon_sysfs() calls in power_supply_register().
use_cnt gets initialized to 0 and is incremented only after these calls.
So when power_supply_property_is_writeable() gets called it always return
-ENODEV because of use_cnt == 0.
This causes all the attributes to have permissions of 444 even those which
should be writable. This used to be a problem only for hwmon sysfs
attributes but since commit be6299c6e55e ("power: supply: sysfs: use
power_supply_property_is_writeable()") this now also impacts power_supply
class sysfs attributes.
Fixes: be6299c6e55e ("power: supply: sysfs: use power_supply_property_is_writeable()")
Fixes: e67d4dfc9ff1 ("power: supply: Add HWMON compatibility layer")
Cc: stable@vger.kernel.org
Cc: Thomas Weißschuh <linux@weissschuh.net>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/stable/20240908185337.103696-1-hdegoede%40redhat.com
Link: https://lore.kernel.org/r/20240908185337.103696-1-hdegoede@redhat.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/regulator/pcap-regulator.c')
0 files changed, 0 insertions, 0 deletions