]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
power: supply: bq27xxx: move overtemp tests to a switch statement.
authorChris Lapa <chris@lapa.com.au>
Mon, 9 Jan 2017 00:47:35 +0000 (11:47 +1100)
committerSebastian Reichel <sre@kernel.org>
Tue, 10 Jan 2017 02:45:38 +0000 (03:45 +0100)
This is done for readability as the upcoming commits will add a lot of
cases.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
drivers/power/supply/bq27xxx_battery.c

index 08c36b8e04bd6c804c9a94a421c9b6a2fb1dcab9..7272d1e024f90af5e7408ba6c5109e2eadb1e2fd 100644 (file)
@@ -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;
+       }
 }
 
 /*