public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>,
	David Laight <david.laight.linux@gmail.com>
Cc: Neel Bullywon <neelb2403@gmail.com>,
	lars@metafoo.de,  Michael.Hennerich@analog.com, jic23@kernel.org,
	dlechner@baylibre.com,  nuno.sa@analog.com, andy@kernel.org,
	linux-iio@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: frequency: adf4350: replace loop with fls_long()
Date: Mon, 23 Mar 2026 11:08:15 +0000	[thread overview]
Message-ID: <920aba2275ff1da033214293a603ef1e215d3dcb.camel@gmail.com> (raw)
In-Reply-To: <abgOuRDBt73Wv2N6@ashevche-desk.local>

On Mon, 2026-03-16 at 16:07 +0200, Andy Shevchenko wrote:
> On Mon, Mar 16, 2026 at 01:51:51PM +0000, David Laight wrote:
> > On Sat, 14 Mar 2026 13:20:06 -0400
> > Neel Bullywon <neelb2403@gmail.com> wrote:
> > 
> > > Address the TODO in adf4350_set_freq() by replacing the iterative
> > > power-of-2 shift loop with a constant-time bitwise calculation.
> > > 
> > > By comparing the highest set bits of the target constant and freq
> > > using fls_long(), we can calculate the required RF divider selection
> > > in a single step without relying on expensive 64-bit division.
> > 
> > Where is the 64bit division?
> > (apart from in v1)
> > Indeed where are the 64bit values at all.
> > If this code is used on 32bit it has to work with a 32bit long.
> > Which makes be think that the 'freq' variable should be u32 (or possibly u64
> > if frequencies above 4GHz are likely - which I doubt).
> 
> I don't know about _this_ device, but before looking into datasheet I wouldn't
> put a low probability on the frequencies higher than 4.3GHz. We have (or going
> to have) devices that work with up to 26GHz frequencies in this folder.

Yes, it goes up to 4.4GHz.

- Nuno Sá

> 
> > In any case this looks like initialisation code and the existing loop
> > has the advantage of being 'obviously correct' and small.

  reply	other threads:[~2026-03-23 11:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11  2:01 [PATCH] iio: frequency: adf4350: replace loop with order_base_2() Neel Bullywon
2026-03-11 12:07 ` Andy Shevchenko
2026-03-14 17:20 ` [PATCH v2] iio: frequency: adf4350: replace loop with fls_long() Neel Bullywon
2026-03-15 13:00   ` Jonathan Cameron
2026-03-16 12:40   ` Andy Shevchenko
2026-03-22 11:51     ` Jonathan Cameron
2026-03-16 13:51   ` David Laight
2026-03-16 14:07     ` Andy Shevchenko
2026-03-23 11:08       ` Nuno Sá [this message]
2026-03-23 13:31         ` David Laight

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=920aba2275ff1da033214293a603ef1e215d3dcb.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=david.laight.linux@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neelb2403@gmail.com \
    --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