From: Guru Das Srinagesh <linux@gurudas.dev>
To: Matthew Wilcox <willy@infradead.org>
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>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Gustavo Silva" <gustavograzs@gmail.com>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 1/2] minmax: Add in_range_inclusive() for inclusive range checks
Date: Mon, 31 Aug 2026 09:29:56 -0700 [thread overview]
Message-ID: <apWsBDT6tdpW6lUU@gurudas.dev> (raw)
In-Reply-To: <aoItA_ktl04qmhEb@casper.infradead.org>
On Sun, Aug 16, 2026 at 10:34:59PM +0100, Matthew Wilcox wrote:
> On Sun, Aug 16, 2026 at 12:26:20PM -0700, Guru Das Srinagesh wrote:
> > +++ b/include/linux/minmax.h
> > @@ -299,6 +299,25 @@ static inline bool in_range32(u32 val, u32 start, u32 len)
> > ((sizeof(start) | sizeof(len) | sizeof(val)) <= sizeof(u32) ? \
> > in_range32(val, start, len) : in_range64(val, start, len))
> >
> > +#define __in_range_inclusive(val, start, end, uval, ustart, uend) ({ \
> > + typeof(val) uval = (val); \
> > + typeof(start) ustart = (start); \
> > + typeof(end) uend = (end); \
> > + uval >= ustart && uval <= uend; \
>
> By convention, 'end' is used for exclusive ranges while 'max' is used
> for inclusive ranges.
Changed to use 'min' and 'max' instead.
> Also, this seems completely wrong. How do you think this is unsigned
> comparisons? I think you'd do better to follow the example of
> in_range() much more closely.
Done - v3 now follows in_range() closely.
next prev parent reply other threads:[~2026-08-31 16:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-16 19:26 [PATCH v2 0/2] Introduce in_range_incl() inclusive range check macro Guru Das Srinagesh
2026-08-16 19:26 ` [PATCH v2 1/2] minmax: Add in_range_inclusive() for inclusive range checks Guru Das Srinagesh
2026-08-16 21:34 ` Matthew Wilcox
2026-08-31 16:29 ` Guru Das Srinagesh [this message]
2026-08-17 8:06 ` Andy Shevchenko
2026-08-31 16:33 ` Guru Das Srinagesh
2026-08-16 19:26 ` [PATCH v2 2/2] iio: imu: bmi270: Use in_range_inclusive() in bmi270_write_event_value() Guru Das Srinagesh
2026-08-17 3:00 ` Jonathan Cameron
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=apWsBDT6tdpW6lUU@gurudas.dev \
--to=linux@gurudas.dev \
--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=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.