Skip to content

Commit

Permalink
power_supply: sysfs: Use power_supply_*() API for accessing function …
Browse files Browse the repository at this point in the history
…attrs

Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property -> power_supply_get_property
 - set_property -> power_supply_set_property
 - property_is_writeable -> power_supply_property_is_writeable

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
  • Loading branch information
Krzysztof Kozlowski authored and Sebastian Reichel committed Mar 13, 2015
1 parent bc15405 commit ee8f334
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/power/power_supply_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static ssize_t power_supply_show_property(struct device *dev,
if (off == POWER_SUPPLY_PROP_TYPE) {
value.intval = psy->type;
} else {
ret = psy->get_property(psy, off, &value);
ret = power_supply_get_property(psy, off, &value);

if (ret < 0) {
if (ret == -ENODATA)
Expand Down Expand Up @@ -125,7 +125,7 @@ static ssize_t power_supply_store_property(struct device *dev,

value.intval = long_val;

ret = psy->set_property(psy, off, &value);
ret = power_supply_set_property(psy, off, &value);
if (ret < 0)
return ret;

Expand Down Expand Up @@ -223,7 +223,7 @@ static umode_t power_supply_attr_is_visible(struct kobject *kobj,

if (property == attrno) {
if (psy->property_is_writeable &&
psy->property_is_writeable(psy, property) > 0)
power_supply_property_is_writeable(psy, property) > 0)
mode |= S_IWUSR;

return mode;
Expand Down

0 comments on commit ee8f334

Please sign in to comment.