Skip to content

Commit

Permalink
power_supply: Fix regression for 'type' property
Browse files Browse the repository at this point in the history
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 <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>
  • Loading branch information
Daniel Mack authored and Anton Vorontsov committed May 25, 2010
1 parent 24af320 commit bbabb15
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/power/power_supply_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bbabb15

Please sign in to comment.