]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sbs-battery: Don't trigger false supply_changed event
authorNikolaus Voss <n.voss@weinmann.de>
Wed, 9 May 2012 06:30:44 +0000 (08:30 +0200)
committerAnton Vorontsov <cbouatmailru@gmail.com>
Wed, 20 Jun 2012 02:26:40 +0000 (19:26 -0700)
power_supply_changed() events are triggerd based on the return value
of a get_property() call. However the property TECHNOLOGY is
hard-coded to LION in this driver, thus always succeeds.

So, with the battery removed, this triggers a false battery present
uevent. This uevent triggers a new query via power_supply_uevent()
which again starts to query all known properties and thus leads to
an infinite loop of battery present/not-present uevents.

This patch skips the battery presence detection for the hard-coded
property TECHNOLOGY.

Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
Acked-by Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
drivers/power/sbs-battery.c

index a5b6849d4123b51b60d2431bbcd72cc9f13c86f4..a65e8f54157efe4fe046367e6a28d10fefe0c141 100644 (file)
@@ -469,7 +469,7 @@ static int sbs_get_property(struct power_supply *psy,
 
        case POWER_SUPPLY_PROP_TECHNOLOGY:
                val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
-               break;
+               goto done; /* don't trigger power_supply_changed()! */
 
        case POWER_SUPPLY_PROP_ENERGY_NOW:
        case POWER_SUPPLY_PROP_ENERGY_FULL: