Skip to contentSkip to conversation

power_supply: Only register WM831x battery charger if enabled

PATCH Applied Mark Brown 2 participants 2 messages Aug 15, 2011 – Aug 19, 2011

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 power_supply: Only register WM831x battery charger if enabled

Don't tell the system about the battery charger if it's not enabled, we can reasonably assume that if the charger is not enabled then no battery will ever be connected so reporting state is at best going to waste time and at worst going to cause confusing information in the UI.

For simplicity and robustness we continue to register and handle interrupts from the charger.

---
 drivers/power/power_supply_sysfs.c |    4 +-
 drivers/power/wm831x_power.c       |   44 ++++++++++++++++++++++-------------
 2 files changed, 30 insertions(+), 18 deletions(-)
drivers/power/power_supply_sysfs.c +2 -2
index e15d4c9..166927b 100644
@@ -78,8 +78,8 @@ static ssize_t power_supply_show_property(struct device *dev,
 			dev_dbg(dev, "driver has no data for `%s' property\n",
 				attr->attr.name);
 		else if (ret != -ENODEV)
-			dev_err(dev, "driver failed to report `%s' property\n",
-				attr->attr.name);
+			dev_err(dev, "driver failed to report `%s' property: %d\n",
+				attr->attr.name, ret);
 		return ret;
 	}
 
drivers/power/wm831x_power.c +28 -16

94 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 10 lines · Mark Brown

Don't tell the system about the battery charger if it's not enabled, we can reasonably assume that if the charger is not enabled then no battery will ever be connected so reporting state is at best going to waste time and at worst going to cause confusing information in the UI.

For simplicity and robustness we continue to register and handle interrupts from the charger.

---

Applied, thanks!

Signature · 2 lines
Anton Vorontsov
Email: [email protected]