Skip to content

Commit ee8f334

Browse files
krzksre
authored andcommitted
power_supply: sysfs: Use power_supply_*() API for accessing function 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 <[email protected]> Acked-by: Jonghwa Lee <[email protected]> Acked-by: Pavel Machek <[email protected]> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent bc15405 commit ee8f334

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/power/power_supply_sysfs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static ssize_t power_supply_show_property(struct device *dev,
7676
if (off == POWER_SUPPLY_PROP_TYPE) {
7777
value.intval = psy->type;
7878
} else {
79-
ret = psy->get_property(psy, off, &value);
79+
ret = power_supply_get_property(psy, off, &value);
8080

8181
if (ret < 0) {
8282
if (ret == -ENODATA)
@@ -125,7 +125,7 @@ static ssize_t power_supply_store_property(struct device *dev,
125125

126126
value.intval = long_val;
127127

128-
ret = psy->set_property(psy, off, &value);
128+
ret = power_supply_set_property(psy, off, &value);
129129
if (ret < 0)
130130
return ret;
131131

@@ -223,7 +223,7 @@ static umode_t power_supply_attr_is_visible(struct kobject *kobj,
223223

224224
if (property == attrno) {
225225
if (psy->property_is_writeable &&
226-
psy->property_is_writeable(psy, property) > 0)
226+
power_supply_property_is_writeable(psy, property) > 0)
227227
mode |= S_IWUSR;
228228

229229
return mode;

0 commit comments

Comments
 (0)