[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAk1H0Msi3lMKNR9@yury>
Date: Wed, 23 Apr 2025 14:44:47 -0400
From: Yury Norov <yury.norov@...il.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Marc Zyngier <maz@...nel.org>, Andrew Lunn <andrew@...n.ch>,
Luo Jie <quic_luoj@...cinc.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Julia Lawall <Julia.Lawall@...ia.fr>,
Nicolas Palix <nicolas.palix@...g.fr>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>,
Joey Gouly <joey.gouly@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>, linux-kernel@...r.kernel.org,
cocci@...ia.fr, linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev, quic_kkumarcs@...cinc.com,
quic_linchen@...cinc.com, quic_leiwei@...cinc.com,
quic_suruchia@...cinc.com, quic_pavir@...cinc.com
Subject: Re: [PATCH v3 0/6] Add FIELD_MODIFY() helper
On Wed, Apr 23, 2025 at 06:44:15PM +0100, Russell King (Oracle) wrote:
> On Fri, Apr 18, 2025 at 11:08:38AM -0400, Yury Norov wrote:
> > The _replace_bits() functions return fixed-width values, and intended
> > for: "manipulating bitfields both in host- and fixed-endian", as the
> > very first line in the commit message says.
> >
> > Those using _replace_bits() for something else abuse the API, and
> > should switch to FIELD_MODIFY().
>
> Sorry, but please explain this statement, because it means nothing to
> me.
>
> FIELD_MODIFY() replaces bits in host endian. _replace_bits() also
> replaces bits, but has a wider range of which encompass FIELD_MODIFY().
>
> I see nothing that precludes using using _replace_bits() with
> bitfields.
>
> I see nothing that would differentiate the behaviour, other than maybe
> religous ideals about C functions vs macros or upper vs lower case.
Interesting, never heard about religious ideals in C.
> Please explain why you think there's a difference between the two
> because I really can't see any reason not to use one over the other
> apart from asthetics.
I explained that in subtread for 4/6 in this series. Shortly it's
about compiler's ability to catch various errors, like overflows,
and (not unlikely) generated code quality.
Powered by blists - more mailing lists