Thread (23 messages) 23 messages, 6 authors, 2026-08-25

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

flat view

From: Ayush Singh <hidden>
Date: 2026-08-21 05:25:51
Also in: linux-crypto, lkml, rust-for-linux

On 8/21/26 8:30 AM, Eric Biggers wrote:
On Thu, Aug 20, 2026 at 02:55:45PM +0530, Ayush Singh wrote:
quoted
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 <redacted>
---
  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.
I was copying `RUST_SERIAL_DEV_BUS_ABSTRACTIONS`, which seems to have a prompt. Will remove in next revision.

quoted
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

Was copying `RUST_SERIAL_DEV_BUS_ABSTRACTIONS`. It is also in `drivers/tty/serdev/Kconfig`.


The reason for introducing this symbol is that normally, crc_ccitt can be built as either builtin, a module, or just left out. However, for use from Rust abstractions, it can either be builtin, or left out. The module state is not supported. Is there a better way to deal with it?


Best Regards,

Ayush Singh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help