lp8727_charger: Make lp8727_charger_get_propery() simpler
authorKim, Milo <Milo.Kim@ti.com>
Fri, 31 Aug 2012 09:25:55 +0000 (09:25 +0000)
committerAnton Vorontsov <anton.vorontsov@linaro.org>
Fri, 21 Sep 2012 01:05:39 +0000 (18:05 -0700)
Charger has only one valid property - ONLINE. If the property is not
ONLINE, then just return quickly.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
drivers/power/lp8727_charger.c

index 880bb7b..2507b2b 100644 (file)
@@ -305,9 +305,10 @@ static int lp8727_charger_get_property(struct power_supply *psy,
 {
        struct lp8727_chg *pchg = dev_get_drvdata(psy->dev->parent);
 
-       if (psp == POWER_SUPPLY_PROP_ONLINE)
-               val->intval = lp8727_is_charger_attached(psy->name,
-                                                        pchg->devid);
+       if (psp != POWER_SUPPLY_PROP_ONLINE)
+               return -EINVAL;
+
+       val->intval = lp8727_is_charger_attached(psy->name, pchg->devid);
 
        return 0;
 }