diff options
author | Mike Rapoport <mike.rapoport@gmail.com> | 2015-09-27 16:25:43 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-09-29 04:16:31 +0200 |
commit | 174f2642349da542eb27c011e67a147773d8721f (patch) | |
tree | 51881eed31fced251cd5cc147733e906f01b3d0d /drivers | |
parent | e967d336ee1a01ced24907ead6cd93dc4f097bed (diff) |
staging: sm750fb: replace twoToPowerOfx with shift operator
The function twoToPowerOfx that iteratively calculates the power of 2
may be replaced with shift operator
Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/sm750fb/ddk750_chip.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index c9adc387f574..28733db74bdc 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -35,20 +35,10 @@ logical_chip_type_t getChipType(void) return chip; } - -inline unsigned int twoToPowerOfx(unsigned long x) -{ - unsigned long i; - unsigned long result = 1; - - for (i = 1; i <= x; i++) - result *= 2; - return result; -} - inline unsigned int calcPLL(pll_value_t *pPLL) { - return (pPLL->inputFreq * pPLL->M / pPLL->N / twoToPowerOfx(pPLL->OD) / twoToPowerOfx(pPLL->POD)); + return (pPLL->inputFreq * pPLL->M / pPLL->N / (1 << pPLL->OD) / + (1 << pPLL->POD)); } unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL) @@ -526,12 +516,12 @@ pll_value_t *pPLL /* Structure to hold the value to be set in PLL */ #endif /* Work out 2 to the power of POD */ - podPower = twoToPowerOfx(POD); + podPower = 1 << POD; /* OD has only 2 bits [15:14] and its value must between 0 to 3 */ for (OD = 0; OD <= 3; OD++) { /* Work out 2 to the power of OD */ - odPower = twoToPowerOfx(OD); + odPower = 1 << OD; #ifdef VALIDATION_CHIP if (odPower > 4) |