Skip to content

Commit

Permalink
lp8727_charger: Clean up lp8727_is_charger_attached()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kim, Milo authored and Anton Vorontsov committed Sep 21, 2012
1 parent 18763a3 commit 65272ba
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/power/lp8727_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 65272ba

Please sign in to comment.