Re: [PATCH 3/7] rust: crc_ccitt: add CRC-CCITT abstraction

From: Eric Biggers

Date: Thu Aug 20 2026 - 23:02:31 EST


On Thu, Aug 20, 2026 at 02:55:45PM +0530, Ayush Singh wrote:
> The module is gated behind the new RUST_CRC_CCITT_ABSTRACTIONS Kconfig
> symbol, which selects CRC_CCITT, so the C library is only built when a
> Rust user actually needs it.
>
> Signed-off-by: Ayush Singh <ayush@xxxxxxxxxxxxxxx>
> ---
> MAINTAINERS | 1 +
> lib/crc/Kconfig | 7 +++++++
> rust/bindings/bindings_helper.h | 1 +
> rust/kernel/crc_ccitt.rs | 26 ++++++++++++++++++++++++++
> rust/kernel/lib.rs | 2 ++
> 5 files changed, 37 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 6008f16ae2ca..1e3b42eff741 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -6921,6 +6921,7 @@ T: git https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git crc-ne
> F: Documentation/staging/crc*
> F: include/linux/crc*
> F: lib/crc/
> +F: rust/kernel/crc*
> F: scripts/gen-crc-consts.py
>
> CREATIVE SB0540
> diff --git a/lib/crc/Kconfig b/lib/crc/Kconfig
> index 927fc6a6b2b9..aceb8fe8f0ed 100644
> --- a/lib/crc/Kconfig
> +++ b/lib/crc/Kconfig
> @@ -32,6 +32,13 @@ config CRC_CCITT
> The CRC-CCITT library functions. Select this if your module uses any
> of the functions from <linux/crc-ccitt.h>.
>
> +config RUST_CRC_CCITT_ABSTRACTIONS
> + bool "Rust CRC-CCITT abstractions"
> + depends on RUST
> + select CRC_CCITT
> + help
> + This enables the Rust abstraction for the CRC-CCITT API.

Like the other library kconfig symbols, this shouldn't have a prompt.
It should just be selected by the other symbols that need it.

> diff --git a/rust/kernel/crc_ccitt.rs b/rust/kernel/crc_ccitt.rs
> new file mode 100644
> index 000000000000..6042ada16967
> --- /dev/null
> +++ b/rust/kernel/crc_ccitt.rs

Is there a reason why the kconfig symbol is being put in lib/crc/ but
the actual code is being put in rust/kernel/? It seems inconsistent.

- Eric