diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-05-25 02:39:45 +0200 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2010-05-25 13:52:58 +0400 |
commit | bbabb158f0e9d41174ae5c2183a8e4f981daf6ce (patch) | |
tree | 257637b9c8bad8a95e32d3a857bb0268ae9822b2 /drivers/power | |
parent | 24af3202459d9a25643009b1ab8ab5ff04d94b49 (diff) | |
download | op-kernel-dev-bbabb158f0e9d41174ae5c2183a8e4f981daf6ce.zip op-kernel-dev-bbabb158f0e9d41174ae5c2183a8e4f981daf6ce.tar.gz |
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>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/power_supply_sysfs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index 6a86cdf..9d30eeb 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c @@ -179,14 +179,16 @@ static mode_t power_supply_attr_is_visible(struct kobject *kobj, { struct device *dev = container_of(kobj, struct device, kobj); struct power_supply *psy = dev_get_drvdata(dev); + mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; int i; + if (attrno == POWER_SUPPLY_PROP_TYPE) + return mode; + for (i = 0; i < psy->num_properties; i++) { int property = psy->properties[i]; if (property == attrno) { - mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; - if (psy->property_is_writeable && psy->property_is_writeable(psy, property) > 0) mode |= S_IWUSR; |