<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/rust/kernel/bits.rs, branch v6.17</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.17</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.17'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-07-19T21:18:18Z</updated>
<entry>
<title>rust: bits: add support for bits/genmask macros</title>
<updated>2025-07-19T21:18:18Z</updated>
<author>
<name>Daniel Almeida</name>
<email>daniel.almeida@collabora.com</email>
</author>
<published>2025-07-14T23:29:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cc84ef3b88f407e8bd5a5f7b6906d1e69851c856'/>
<id>urn:sha1:cc84ef3b88f407e8bd5a5f7b6906d1e69851c856</id>
<content type='text'>
In light of bindgen being unable to generate bindings for macros, and
owing to the widespread use of these macros in drivers, manually define
the bit and genmask C macros in Rust.

The *_checked version of the functions provide runtime checking while
the const version performs compile-time assertions on the arguments via
the build_assert!() macro.

Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Reviewed-by: Alexandre Courbot &lt;acourbot@nvidia.com&gt;
Signed-off-by: Daniel Almeida &lt;daniel.almeida@collabora.com&gt;
Reviewed-by: Danilo Krummrich &lt;dakr@kernel.org&gt;
Link: https://lore.kernel.org/r/20250714-topics-tyr-genmask2-v9-1-9e6422cbadb6@collabora.com
[ `expect`ed Clippy warning in doctests, hid single `use`, grouped
  examples. Reworded title. - Miguel ]
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
</feed>
