diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2011-10-10 10:14:14 (GMT) |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-10-24 12:09:19 (GMT) |
commit | e62ccf3a7a21d62d92520f47ba5bd7e2112d8c1b (patch) | |
tree | 56577cca7446604dd67dac2f6595dc9cafc1cb6e | |
parent | 1934dae220ed1f1a832a191a86c1becfcbb3a094 (diff) | |
download | linux-e62ccf3a7a21d62d92520f47ba5bd7e2112d8c1b.tar.xz |
mfd: Refactor db8500-prcmu request_clock() function
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>
-rw-r--r-- | drivers/mfd/db8500-prcmu.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 98da431..e996d11 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -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) |