public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: David Lechner <dlechner@baylibre.com>
Cc: "Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Ramona Gradinariu" <ramona.gradinariu@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: accel: adxl380: fix FIFO watermark bit 8 always written as 0
Date: Mon, 2 Mar 2026 17:03:15 +0200	[thread overview]
Message-ID: <aaWms6mg9MFBqzv7@ashevche-desk.local> (raw)
In-Reply-To: <2e4acc5f-2079-4160-a4d3-6453b48eef03@baylibre.com>

On Mon, Mar 02, 2026 at 08:54:52AM -0600, David Lechner wrote:
> On 3/2/26 1:56 AM, Andy Shevchenko wrote:
> > On Sat, Feb 28, 2026 at 10:50:00AM -0600, David Lechner wrote:
> >> On 2/27/26 6:43 AM, Antoniu Miclaus wrote:

...

> >>> +					    !!(fifo_samples & BIT(8))));
> >>
> >> Technically, this works, but in terms of understanding the code I think
> >> fifo_samples >= BIT(8) would make more sense.
> >>
> >> fifo_samples is a count, not bit flags.
> > 
> > I even would prefer to see in such a case
> > 
> > 	fifo_samples > (BIT(8) - 1)
> > 
> > that it will define the maximum that fits the HW, or plain number
> > 
> > 	fifo_samples > 127
> 
> Now that I looked at the dataheet, I get Jonathan's point.
> 
> The reason this is here is that we are filling in a 9-bit value
> using 8-bit registers, so the MSB goes in a different register.
> 
> So actually, it would probably make the most sense to write
> it as `fifo_samples >> 8`.

I agree based on the above justification.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-03-02 15:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 12:43 [PATCH] iio: accel: adxl380: fix FIFO watermark bit 8 always written as 0 Antoniu Miclaus
2026-02-28 12:03 ` Jonathan Cameron
2026-02-28 16:50 ` David Lechner
2026-03-01 12:02   ` Jonathan Cameron
2026-03-02  7:56   ` Andy Shevchenko
2026-03-02 14:54     ` David Lechner
2026-03-02 15:03       ` Andy Shevchenko [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=aaWms6mg9MFBqzv7@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.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=nuno.sa@analog.com \
    --cc=ramona.gradinariu@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