提交 bbabb158 编写于 作者: D Daniel Mack 提交者: Anton Vorontsov

power_supply: Fix regression for 'type' property

Commit 5f487cd3 (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: NRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: NDaniel Mack <daniel@caiaq.de>
Tested-by: NRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: NAnton Vorontsov <cbouatmailru@gmail.com>
上级 24af3202
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册