mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Gustavo Silva" <gustavograzs@gmail.com>,
	"Alex Lanzano" <lanzano.alex@gmail.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] iio: imu: bmi270: add channel for step counter
Date: Sun, 8 Jun 2025 23:03:18 +0300	[thread overview]
Message-ID: <aEXshsLK0JLUp37s@smile.fi.intel.com> (raw)
In-Reply-To: <20250607165004.4673e9f5@jic23-huawei>

On Sat, Jun 07, 2025 at 04:50:04PM +0100, Jonathan Cameron wrote:
> On Fri, 6 Jun 2025 12:14:44 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Jun 05, 2025 at 07:05:01PM -0300, Gustavo Silva wrote:

...

> > > +	set_mask_bits(&regval, mask, val);  
> > 
> > You can't do this on the 16-bit values on some architectures.
> > Maybe it's easy to implement cmpxchg() for 16-bit values there,
> > though.
> 
> It doesn't need to be atomic, so stick to traditional
> 
> 	regval &= ~mask;
> 	regval |= bits;
> 
> And avoid the fun of architectural corner cases entirely.

Standard pattern is

	regval = (regval & ~mask) | (val & mask);

this will be robust against any changes in the val.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-06-08 20:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 22:05 [PATCH v2 0/3] BMI270: Add support for step counter and motion events Gustavo Silva
2025-06-05 22:05 ` [PATCH v2 1/3] iio: imu: bmi270: add channel for step counter Gustavo Silva
2025-06-06  7:43   ` kernel test robot
2025-06-06  9:14   ` Andy Shevchenko
2025-06-07 15:50     ` Jonathan Cameron
2025-06-08 20:03       ` Andy Shevchenko [this message]
2025-06-05 22:05 ` [PATCH v2 2/3] iio: imu: bmi270: add step counter watermark event Gustavo Silva
2025-06-07 15:54   ` Jonathan Cameron
2025-06-05 22:05 ` [PATCH v2 3/3] iio: imu: bmi270: add support for motion events Gustavo Silva
2025-06-07 16:02   ` Jonathan Cameron
2025-06-17  7:28     ` Lothar Rubusch

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=aEXshsLK0JLUp37s@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=dlechner@baylibre.com \
    --cc=gustavograzs@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lanzano.alex@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®