Skip to contentSkip to conversation

Commit "power_supply: Use attribute groups" breaks KDE battery monitor on openSUSE 11.3 M6

Regression Rafael J. Wysocki 3 participants 8 messages May 24, 2010 – May 25, 2010

lore
Share & tools
lore
#0 lore raw

Hi Anton,

Your commit 5f487cd34f4337f9bc27ca19da72a39d1b0a0ab4 (power_supply: Use attribute groups) unfortunately breaks KDE 4.4's battery monitor from openSUSE 11.3 Milestone 6 on my Acer Ferrari One. Apparently, the battery monitor can't access the sysfs battery attributes with this commit applied.

Reverting the commit along with commit 0011d2d4a5f7bb5666dcfb9f9b3dbdb084ab98f1 (power_supply: Add support for writeable properties) fixes the problem for me, but reverting commit 0011d2d4a5f7bb5666dcfb9f9b3dbdb084ab98f1 alone doesn't fix it, so it looks like your commit is the source of the problem.

Thanks,
Rafael

#1 lore raw
Quoted 4 lines · Rafael J. Wysocki

Your commit 5f487cd34f4337f9bc27ca19da72a39d1b0a0ab4 (power_supply: Use attribute groups) unfortunately breaks KDE 4.4's battery monitor from openSUSE 11.3 Milestone 6 on my Acer Ferrari One. Apparently, the battery monitor can't access the sysfs battery attributes with this commit applied.

Can you still see the attributes in sysfs? What are their properties?

Thanks,
Daniel

#2 lore raw
Quoted 7 lines · Daniel Mack
Quoted 4 lines · Rafael J. Wysocki

Your commit 5f487cd34f4337f9bc27ca19da72a39d1b0a0ab4 (power_supply: Use attribute groups) unfortunately breaks KDE 4.4's battery monitor from openSUSE 11.3 Milestone 6 on my Acer Ferrari One. Apparently, the battery monitor can't access the sysfs battery attributes with this commit applied.

Can you still see the attributes in sysfs?

Yes, I can.

Quoted 1 line

What are their properties?

They don't seem to be different from the properties without the commit.

Yet, the battery monitor evidently thinks the battery is not present (it also doesn't seem to see the AC adapter).

Thanks,
Rafael

#3 lore raw
Quoted 10 lines · Rafael J. Wysocki
Quoted 7 lines · Daniel Mack
Quoted 4 lines · Rafael J. Wysocki

Your commit 5f487cd34f4337f9bc27ca19da72a39d1b0a0ab4 (power_supply: Use attribute groups) unfortunately breaks KDE 4.4's battery monitor from openSUSE 11.3 Milestone 6 on my Acer Ferrari One. Apparently, the battery monitor can't access the sysfs battery attributes with this commit applied.

Can you still see the attributes in sysfs?

Yes, I can.

Ah, sorry. The 'type' property is not present (I didn't notice that before).

Rafael

#4 lore raw
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Rafael J. Wysocki
Quoted 6 lines · Daniel Mack
Quoted 4 lines · Rafael J. Wysocki

Your commit 5f487cd34f4337f9bc27ca19da72a39d1b0a0ab4 (power_supply: Use attribute groups) unfortunately breaks KDE 4.4's battery monitor from openSUSE 11.3 Milestone 6 on my Acer Ferrari One. Apparently, the battery monitor can't access the sysfs battery attributes with this commit applied.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Can you still see the attributes in sysfs?

Yes, I can.

Ah, sorry. The 'type' property is not present (I didn't notice that before).

Ah. That I didn't see. Does the (untested) patch below help?

Daniel

Quoted 1 line

From ea5c518fb287d5e80e9a46ba1f9a17c45141187c Mon Sep 17 00:00:00 2001

From: Daniel Mack <[email protected]>
Date: Tue, 25 May 2010 02:39:45 +0200
Subject: [PATCH] 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.

---
 drivers/power/power_supply_sysfs.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/power/power_supply_sysfs.c +4 -2
index 6a86cdf..9d30eeb 100644
@@ -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;
Signature · 1 line
1.7.1
#5 lore raw
Quoted 28 lines · Daniel Mack
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Rafael J. Wysocki
Quoted 6 lines · Daniel Mack
Quoted 4 lines · Rafael J. Wysocki

Your commit 5f487cd34f4337f9bc27ca19da72a39d1b0a0ab4 (power_supply: Use attribute groups) unfortunately breaks KDE 4.4's battery monitor from openSUSE 11.3 Milestone 6 on my Acer Ferrari One. Apparently, the battery monitor can't access the sysfs battery attributes with this commit applied.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Can you still see the attributes in sysfs?

Yes, I can.

Ah, sorry. The 'type' property is not present (I didn't notice that before).

Ah. That I didn't see. Does the (untested) patch below help?

Daniel

From ea5c518fb287d5e80e9a46ba1f9a17c45141187c Mon Sep 17 00:00:00 2001
From: Daniel Mack <[email protected]>
Date: Tue, 25 May 2010 02:39:45 +0200
Subject: [PATCH] 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.

Quoted 6 lines

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.

Yes, that's it, thanks.

Rafael

Quoted 28 lines
---
 drivers/power/power_supply_sysfs.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/power/power_supply_sysfs.c +4 -2
index 6a86cdf..9d30eeb 100644
@@ -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;
#6 lore raw
Quoted 29 lines · Rafael J. Wysocki
Quoted 28 lines · Daniel Mack
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Rafael J. Wysocki
Quoted 6 lines · Daniel Mack
Quoted 4 lines · Rafael J. Wysocki

Your commit 5f487cd34f4337f9bc27ca19da72a39d1b0a0ab4 (power_supply: Use attribute groups) unfortunately breaks KDE 4.4's battery monitor from openSUSE 11.3 Milestone 6 on my Acer Ferrari One. Apparently, the battery monitor can't access the sysfs battery attributes with this commit applied.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Can you still see the attributes in sysfs?

Yes, I can.

Ah, sorry. The 'type' property is not present (I didn't notice that before).

Ah. That I didn't see. Does the (untested) patch below help?

Daniel

From ea5c518fb287d5e80e9a46ba1f9a17c45141187c Mon Sep 17 00:00:00 2001
From: Daniel Mack <[email protected]>
Date: Tue, 25 May 2010 02:39:45 +0200
Subject: [PATCH] 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.

Quoted 8 lines
Quoted 6 lines

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.

Yes, that's it, thanks.

Good, thanks for testing.

I think Anton will pick this for battery-2.6.git.

Daniel

Quoted 28 lines
Quoted 27 lines
 drivers/power/power_supply_sysfs.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/power/power_supply_sysfs.c +4 -2
index 6a86cdf..9d30eeb 100644
@@ -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;
#7 lore raw

[GIT PULL] battery-2.6.git

Hello Linus,

Please pull from

git://git.infradead.org/battery-2.6.git master

to receive a fixup for regression reported by Rafael J. Wysocki
http://lkml.org/lkml/2010/5/24/273

Thanks!

commit bbabb158f0e9d41174ae5c2183a8e4f981daf6ce

Author: Daniel Mack <[email protected]>
Date:   Tue May 25 02:39:45 2010 +0200

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.

drivers/power/power_supply_sysfs.c +4 -2
index 6a86cdf..9d30eeb 100644
@@ -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;