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

Eric Biggers <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux,org.kernel.vger.linux-crypto,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <20260821030018.GA1961@sol>
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 <[email protected]>
> ---
>  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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.