Re: [RESEND PATCH v2 2/2] iio: frequency: ad9832: simplify bitwise math

Dan Carpenter
2026-04-11T10:38:32Z

On Sat, Apr 11, 2026 at 10:58:48AM +0200, Joshua Crofts wrote:
> Refactor the ad9832_calc_freqreg by adding a BIT_ULL()
> macro instead of manual bit shifting for better
> readability.
>
> Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
> ---
> v2:
> - changed ull to u64 type
>
> drivers/staging/iio/frequency/ad9832.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
> index 8873a6d11e..4221e51dc4 100644
> --- a/drivers/staging/iio/frequency/ad9832.c
> +++ b/drivers/staging/iio/frequency/ad9832.c
> @@ -112,8 +112,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 * BIT_ULL(AD9832_FREQ_BITS)i;
^
This extra i char is something I really dread as a vim user. :P

regards,
dan carpenter