aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorKim, Milo <Milo.Kim@ti.com>2012-08-31 05:25:22 -0400
committerAnton Vorontsov <anton.vorontsov@linaro.org>2012-09-20 21:04:00 -0400
commit65272bac3a24162b7362eccf9a30a481f2139266 (patch)
tree0201df5b9c7b30e10a8a2138ed34bb89bdafcc03 /drivers/power
parent18763a36d0bae11a916ffe8fa58a26fd0b5eb115 (diff)
lp8727_charger: Clean up lp8727_is_charger_attached()
Change return type to boolean. Remove unnecessary check routine for NULL string. (Power supply name is always valid when the function is executed.) Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/lp8727_charger.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/power/lp8727_charger.c b/drivers/power/lp8727_charger.c
index 254bbe07c269..658518ba675b 100644
--- a/drivers/power/lp8727_charger.c
+++ b/drivers/power/lp8727_charger.c
@@ -124,16 +124,14 @@ static int lp8727_write_byte(struct lp8727_chg *pchg, u8 reg, u8 data)
124 return ret; 124 return ret;
125} 125}
126 126
127static int lp8727_is_charger_attached(const char *name, int id) 127static bool lp8727_is_charger_attached(const char *name, int id)
128{ 128{
129 if (name) { 129 if (!strcmp(name, "ac"))
130 if (!strcmp(name, "ac")) 130 return id == LP8727_ID_TA || id == LP8727_ID_DEDICATED_CHG;
131 return (id == LP8727_ID_TA || id == LP8727_ID_DEDICATED_CHG) ? 1 : 0; 131 else if (!strcmp(name, "usb"))
132 else if (!strcmp(name, "usb")) 132 return id == LP8727_ID_USB_CHG;
133 return (id == LP8727_ID_USB_CHG) ? 1 : 0;
134 }
135 133
136 return (id >= LP8727_ID_TA && id <= LP8727_ID_USB_CHG) ? 1 : 0; 134 return id >= LP8727_ID_TA && id <= LP8727_ID_USB_CHG;
137} 135}
138 136
139static int lp8727_init_device(struct lp8727_chg *pchg) 137static int lp8727_init_device(struct lp8727_chg *pchg)