mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 03:27:30 -04:00
iio: frequency: ad9832: simplify bitwise math
Refactor the ad9832_calc_freqreg by removing the redundant u64 casts and 1L bitwise left shift and replacing the multiplication by a bit shift, as multiplying integers by a power of two is identical to a bitwise left shift. Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
committed by
Jonathan Cameron
parent
c0536d61f3
commit
5b382bf01a
@@ -117,8 +117,8 @@ struct ad9832_state {
|
||||
|
||||
static unsigned long ad9832_calc_freqreg(unsigned long mclk, unsigned long fout)
|
||||
{
|
||||
unsigned long long freqreg = (u64)fout *
|
||||
(u64)((u64)1L << AD9832_FREQ_BITS);
|
||||
u64 freqreg = (u64)fout << AD9832_FREQ_BITS;
|
||||
|
||||
do_div(freqreg, mclk);
|
||||
return freqreg;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user