mfd: Refactor db8500-prcmu request_clock() function
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 10 Oct 2011 10:14:14 +0000 (12:14 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 24 Oct 2011 12:09:19 +0000 (14:09 +0200)
This refactors the mfd/dbx500-prcmu drivers to use a switch()
statement rather than nested if/else-construction.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/db8500-prcmu.c

index 98da431af044679fbd412682daaac783d5698d17..e996d11980faf9bf0ad9437160f73cbc41a5a966 100644 (file)
@@ -1433,18 +1433,21 @@ static int request_sga_clock(u8 clock, bool enable)
  */
 int db8500_prcmu_request_clock(u8 clock, bool enable)
 {
-       if (clock == PRCMU_SGACLK)
+       switch(clock) {
+       case PRCMU_SGACLK:
                return request_sga_clock(clock, enable);
-       else if (clock < PRCMU_NUM_REG_CLOCKS)
-               return request_reg_clock(clock, enable);
-       else if (clock == PRCMU_TIMCLK)
+       case PRCMU_TIMCLK:
                return request_timclk(enable);
-       else if (clock == PRCMU_SYSCLK)
+       case PRCMU_SYSCLK:
                return request_sysclk(enable);
-       else if (clock == PRCMU_PLLSOC1)
+       case PRCMU_PLLSOC1:
                return request_pll(clock, enable);
-       else
-               return -EINVAL;
+       default:
+               break;
+       }
+       if (clock < PRCMU_NUM_REG_CLOCKS)
+               return request_reg_clock(clock, enable);
+       return -EINVAL;
 }
 
 int db8500_prcmu_config_esram0_deep_sleep(u8 state)
This page took 0.029692 seconds and 5 git commands to generate.