All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Guru Das Srinagesh <linux@gurudas.dev>
Cc: "Alex Lanzano" <lanzano.alex@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Matthew Wilcox" <willy@infradead.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Gustavo Silva" <gustavograzs@gmail.com>,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH v3 3/3] iio: imu: bmi270: Use in_range_inclusive() in bmi270_write_event_value()
Date: Tue, 1 Sep 2026 10:47:59 +0300	[thread overview]
Message-ID: <apaDLzXEvNU7APss@ashevche-desk.local> (raw)
In-Reply-To: <20260831-minmax-in-range-incl-v3-3-30444a2fd2a5@gurudas.dev>

On Mon, Aug 31, 2026 at 09:26:30AM -0700, Guru Das Srinagesh wrote:
> Replace the three "in_range(val, 0, MAX + 1)" checks with the new
> in_range_inclusive() helper, expressing each as the inclusive [0, MAX]
> range it actually validates.
> 
> No functional changes are introduced by this change because @min <= @max
> in the inclusive range in both signed and unsigned readings and hence
> the check correctly continues to hold and is unchanged in behaviour.

Yes, this change makes code better (not only shorter, it makes it robust
against theoretical wrap-around).

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-09-01  7:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 16:26 [PATCH v3 0/3] Introduce in_range_incl() inclusive range check macro Guru Das Srinagesh
2026-08-31 16:26 ` [PATCH v3 1/3] minmax: Add in_range_inclusive() for inclusive range checks Guru Das Srinagesh
2026-09-01  7:26   ` Andy Shevchenko
2026-08-31 16:26 ` [PATCH v3 2/3] lib/tests: Add in_range_inclusive() KUnit test Guru Das Srinagesh
2026-09-01  7:38   ` Andy Shevchenko
2026-08-31 16:26 ` [PATCH v3 3/3] iio: imu: bmi270: Use in_range_inclusive() in bmi270_write_event_value() Guru Das Srinagesh
2026-09-01  7:47   ` 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=apaDLzXEvNU7APss@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy@kernel.org \
    --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=linux@gurudas.dev \
    --cc=nuno.sa@analog.com \
    --cc=willy@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.