From: David Laight <david.laight.linux@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Yoelvis Oliveros <yoelvisoliveros@gmail.com>,
gregkh@linuxfoundation.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, outreachy@lists.linux.dev
Subject: Re: [PATCH] staging: octeon: type change from uint<bits>_t to u<bits>
Date: Tue, 10 Feb 2026 12:28:43 +0000 [thread overview]
Message-ID: <20260210122843.05800774@pumpkin> (raw)
In-Reply-To: <aYsLZcRhZ7kB7f51@stanley.mountain>
On Tue, 10 Feb 2026 13:41:41 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:
> On Tue, Feb 10, 2026 at 10:19:52AM +0000, David Laight wrote:
> > As a separate issue, what is the purpose of all these bit-field structures?
> > You can't portably use C bit-fields to map hardware registers or network
> > packets.
> > It isn't just byte-order, the 'bit order' can differ even for the same
> > endianness.
>
> Huh. I didn't know that. Can you give an example?
You probably need to look at one of the old BE ABI.
But I've just failed to find a reference to an 'unexpected' bit order.
But play with union { u8 one:1; u8 all; } and you find that one has
the value 0x80 on BE.
There is a note in one of the kernel headers that all the architectures
that linux has supported since (at least) 2.6.24 have bit endianess
that matches the byte endianess.
There are definitely differences if bitfields cross word boundaries.
Basically the C language pretty much lets the implementation 'do what
it likes', so different architectures can behave differently.
ISTR a relatively recent change to gcc WRT the alignment of packed
bitfields on x86.
David
>
> regards,
> dan carpenter
>
prev parent reply other threads:[~2026-02-10 12:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 4:36 [PATCH] staging: octeon: type change from uint<bits>_t to u<bits> Yoelvis Oliveros
2026-02-10 4:58 ` Greg KH
2026-02-10 6:50 ` Dan Carpenter
2026-02-10 10:19 ` David Laight
2026-02-10 10:41 ` Dan Carpenter
2026-02-10 12:28 ` David Laight [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=20260210122843.05800774@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=outreachy@lists.linux.dev \
--cc=yoelvisoliveros@gmail.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