Skip to content

Commit bbabb15

Browse files
Daniel Mackenomsg
authored andcommitted
power_supply: Fix regression for 'type' property
Commit 5f487cd (power_supply: Use attribute groups) causes a regression the power supply core does not export the 'type' attribute anymore. POWER_SUPPLY_PROP_TYPE is handled by the power supply core without the low-level driver, so power_supply_attr_is_visible() must always return the entry as readable. Reported-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Daniel Mack <[email protected]> Tested-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Anton Vorontsov <[email protected]>
1 parent 24af320 commit bbabb15

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/power/power_supply_sysfs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,16 @@ static mode_t power_supply_attr_is_visible(struct kobject *kobj,
179179
{
180180
struct device *dev = container_of(kobj, struct device, kobj);
181181
struct power_supply *psy = dev_get_drvdata(dev);
182+
mode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
182183
int i;
183184

185+
if (attrno == POWER_SUPPLY_PROP_TYPE)
186+
return mode;
187+
184188
for (i = 0; i < psy->num_properties; i++) {
185189
int property = psy->properties[i];
186190

187191
if (property == attrno) {
188-
mode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
189-
190192
if (psy->property_is_writeable &&
191193
psy->property_is_writeable(psy, property) > 0)
192194
mode |= S_IWUSR;

0 commit comments

Comments
 (0)