From: Kim, Milo Date: Fri, 31 Aug 2012 09:25:22 +0000 (+0000) Subject: lp8727_charger: Clean up lp8727_is_charger_attached() X-Git-Tag: upstream/snapshot3+hdmi~6523^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=65272bac3a24162b7362eccf9a30a481f2139266;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Signed-off-by: Anton Vorontsov --- diff --git a/drivers/power/lp8727_charger.c b/drivers/power/lp8727_charger.c index 254bbe0..658518b 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) return ret; } -static int lp8727_is_charger_attached(const char *name, int id) +static bool lp8727_is_charger_attached(const char *name, int id) { - if (name) { - if (!strcmp(name, "ac")) - return (id == LP8727_ID_TA || id == LP8727_ID_DEDICATED_CHG) ? 1 : 0; - else if (!strcmp(name, "usb")) - return (id == LP8727_ID_USB_CHG) ? 1 : 0; - } + if (!strcmp(name, "ac")) + return id == LP8727_ID_TA || id == LP8727_ID_DEDICATED_CHG; + else if (!strcmp(name, "usb")) + return id == LP8727_ID_USB_CHG; - return (id >= LP8727_ID_TA && id <= LP8727_ID_USB_CHG) ? 1 : 0; + return id >= LP8727_ID_TA && id <= LP8727_ID_USB_CHG; } static int lp8727_init_device(struct lp8727_chg *pchg)