Commit 78f281e
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 be6299c ("power: supply: sysfs: use
power_supply_property_is_writeable()") this now also impacts power_supply
class sysfs attributes.
Fixes: be6299c ("power: supply: sysfs: use power_supply_property_is_writeable()")
Fixes: e67d4df ("power: supply: Add HWMON compatibility layer")
Cc: [email protected]
Cc: Thomas Weißschuh <[email protected]>
Cc: Andrey Smirnov <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Link: https://lore.kernel.org/stable/20240908185337.103696-1-hdegoede%40redhat.com
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sebastian Reichel <[email protected]>1 parent eb1ea13 commit 78f281e
1 file changed
+1
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1231 | 1231 | | |
1232 | 1232 | | |
1233 | 1233 | | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
1237 | | - | |
1238 | | - | |
| 1234 | + | |
1239 | 1235 | | |
1240 | 1236 | | |
1241 | 1237 | | |
| |||
0 commit comments