<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-rng/include/linux/bitfield-fix-width.h, branch master</title>
<subtitle>Development tree for the kernel CSPRNG</subtitle>
<id>https://git.zx2c4.com/linux-rng/atom/include/linux/bitfield-fix-width.h?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-rng/atom/include/linux/bitfield-fix-width.h?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/'/>
<updated>2026-09-23T22:17:45Z</updated>
<entry>
<title>bitfield: Restore be16_replace_bits()</title>
<updated>2026-09-23T22:17:45Z</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2026-09-23T22:09:53Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=d267d2f41222912a5f40dc064df64cee57c8bade'/>
<id>urn:sha1:d267d2f41222912a5f40dc064df64cee57c8bade</id>
<content type='text'>
Commit 1c88ceb09d5e5 ("bitfield: get rid of __MAKE_OP machinery")
removed a bunch of unused bitfield operations including
be16_replace_bits() but commit 508bdb4938928 ("iio: adc: Add AD7768 and
AD7768-4 core support") introduces a new user.  Restore the function so
the build still works once both branches are merged.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</content>
</entry>
<entry>
<title>bitfield: get rid of __MAKE_OP machinery</title>
<updated>2026-09-21T16:28:21Z</updated>
<author>
<name>Yury Norov</name>
<email>ynorov@nvidia.com</email>
</author>
<published>2026-09-14T20:49:29Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-rng/commit/?id=1c88ceb09d5e5506456a625043bc9b35ce86fc41'/>
<id>urn:sha1:1c88ceb09d5e5506456a625043bc9b35ce86fc41</id>
<content type='text'>
The __MAKE_OP machinery hides the fixed-width bitfield helper definitions
from source searches and makes the end result highly obscured and largely
uncontrolled.

This follows earlier discussions about making these helpers easier to
find: [1], [2].

Move the explicit helpers and their shared checks into
linux/bitfield-fix-width.h in both the kernel and tools headers, and
include it from bitfield.h to preserve existing users.

The repeated overflow check is factored into __assert_field(), preserving
the original condition and compile-time diagnostics.

With GCC 15.2.0 and x86-64 defconfig plus the bitfield KUnit tests, the
before/after kernel builds are binary identical.

The __MAKE_OP generates the following 40 functions (including the direct
____MAKE_OP(u8,u8,,) invocation):

  u8_encode_bits()
  u8_replace_bits()
  u8p_replace_bits()
  u8_get_bits()
  le16_encode_bits()
  le16_replace_bits() [dead code]
  le16p_replace_bits()
  le16_get_bits()
  be16_encode_bits()
  be16_replace_bits() [dead code]
  be16p_replace_bits() [dead code]
  be16_get_bits()
  u16_encode_bits()
  u16_replace_bits()
  u16p_replace_bits()
  u16_get_bits()
  le32_encode_bits()
  le32_replace_bits() [dead code]
  le32p_replace_bits()
  le32_get_bits()
  be32_encode_bits()
  be32_replace_bits() [dead code]
  be32p_replace_bits()
  be32_get_bits()
  u32_encode_bits()
  u32_replace_bits()
  u32p_replace_bits()
  u32_get_bits()
  le64_encode_bits()
  le64_replace_bits() [dead code]
  le64p_replace_bits() [dead code]
  le64_get_bits()
  be64_encode_bits()
  be64_replace_bits() [dead code]
  be64p_replace_bits() [dead code]
  be64_get_bits()
  u64_encode_bits()
  u64_replace_bits()
  u64p_replace_bits()
  u64_get_bits()

Functions marked with [dead code] have no in-tree callers and are
removed by this change.

Link: https://lore.kernel.org/all/20250214073402.0129e259@kernel.org/ [1]
Link: https://lore.kernel.org/all/aeub59FBHbCy-KKP@yury/ [2]
Assisted-by: OpenAI Codex
Reviewed-by: Akihiko Odaki &lt;odaki@rsg.ci.i.u-tokyo.ac.jp&gt;
Acked-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</content>
</entry>
</feed>
