Commit bbabb158f0e9d41174ae5c2183a8e4f981daf6ce
Committed by
Anton Vorontsov
1 parent
24af320245
Exists in
master
and in
7 other branches
power_supply: Fix regression for 'type' property
Commit 5f487cd34f4337f9bc27ca19da72a39d1b0a0ab4 (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 <rjw@sisk.pl> Signed-off-by: Daniel Mack <daniel@caiaq.de> Tested-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
drivers/power/power_supply_sysfs.c
... | ... | @@ -179,14 +179,16 @@ |
179 | 179 | { |
180 | 180 | struct device *dev = container_of(kobj, struct device, kobj); |
181 | 181 | struct power_supply *psy = dev_get_drvdata(dev); |
182 | + mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; | |
182 | 183 | int i; |
183 | 184 | |
185 | + if (attrno == POWER_SUPPLY_PROP_TYPE) | |
186 | + return mode; | |
187 | + | |
184 | 188 | for (i = 0; i < psy->num_properties; i++) { |
185 | 189 | int property = psy->properties[i]; |
186 | 190 | |
187 | 191 | if (property == attrno) { |
188 | - mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; | |
189 | - | |
190 | 192 | if (psy->property_is_writeable && |
191 | 193 | psy->property_is_writeable(psy, property) > 0) |
192 | 194 | mode |= S_IWUSR; |