Re: [PATCH] staging: sm750fb: replace twoToPowerOfx with shift operator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> The function twoToPowerOfx that iteratively caclulates the power of 2
> may be replaced with shift operator

calculates

> -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 / (1UL << pPLL->OD) / (1UL << pPLL->POD));

The original function returned an unsigned int.  Why did you use the UL
suffix here?

Also, this line still raises a checkpatch warning about it being over 80
characters.  AFAIK, if you change a line in a patch, you should make
sure it doesn't raise any checkpatch warnings afterwards.  Don't take my
word for it, though.

-- 
Best regards,
Michał Kępień
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux