From e839a448814584e73a79c1fa76caace2ef42e0ee Mon Sep 17 00:00:00 2001 From: Chris Lapa Date: Mon, 9 Jan 2017 11:47:35 +1100 Subject: [PATCH] power: supply: bq27xxx: move overtemp tests to a switch statement. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is done for readability as the upcoming commits will add a lot of cases. tested: no Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis Signed-off-by: Sebastian Reichel --- drivers/power/supply/bq27xxx_battery.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index 08c36b8..7272d1e 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -674,13 +674,18 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di) */ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags) { - if (di->chip == BQ27500 || di->chip == BQ27510 || - di->chip == BQ27541 || di->chip == BQ27545) + switch (di->chip) { + case BQ27500: + case BQ27510: + case BQ27541: + case BQ27545: return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD); - if (di->chip == BQ27530 || di->chip == BQ27421) + case BQ27530: + case BQ27421: return flags & BQ27XXX_FLAG_OT; - - return false; + default: + return false; + } } /* -- 2.7.4