public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Joshua Crofts <joshua.crofts1@gmail.com>,
	lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org,
	gregkh@linuxfoundation.org
Cc: nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: frequency: ad9832: simplify bitwise math
Date: Fri, 10 Apr 2026 14:12:11 -0500	[thread overview]
Message-ID: <2c29f960-1e0b-4d66-858d-576e685f0812@baylibre.com> (raw)
In-Reply-To: <20260410100832.1388-3-joshua.crofts1@gmail.com>

On 4/10/26 5:08 AM, 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>
> ---
>  drivers/staging/iio/frequency/ad9832.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
> index 1f6ece79b8..260c2e3a9b 100644
> --- a/drivers/staging/iio/frequency/ad9832.c
> +++ b/drivers/staging/iio/frequency/ad9832.c
> @@ -113,8 +113,7 @@ 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);
> +	unsigned long long freqreg = (u64)fout * BIT_ULL(AD9832_FREQ_BITS);

If we are touching this line anyway, I would change `unsigned long long`
to `u64` to make the type name consistent with the cast and makes the
line shorter.

>  	do_div(freqreg, mclk);
>  	return freqreg;
>  }


      reply	other threads:[~2026-04-10 19:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 10:08 [PATCH 0/2] iio: frequency: ad9832: cleanups Joshua Crofts
2026-04-10 10:08 ` [PATCH 1/2] iio: frequency: ad9832: remove kernel.h proxy header Joshua Crofts
2026-04-10 10:42   ` Andy Shevchenko
2026-04-10 10:08 ` [PATCH 2/2] iio: frequency: ad9832: simplify bitwise math Joshua Crofts
2026-04-10 19:12   ` David Lechner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c29f960-1e0b-4d66-858d-576e685f0812@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=joshua.crofts1@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox