Thread (2 messages) 2 messages, 2 authors, 2026-03-16

Re: [PATCH v2 4/4] rust: make `build_assert` module the home of related macros

From: "Danilo Krummrich" <dakr@kernel.org>
Date: 2026-03-16 17:45:00
Also in: driver-core, lkml, rust-for-linux

On Mon Mar 16, 2026 at 4:07 PM CET, Gary Guo wrote:
quoted hunk ↗ jump to hunk
diff --git a/rust/kernel/dma.rs b/rust/kernel/dma.rs
index a396f8435739..bef3f33cf2ea 100644
--- a/rust/kernel/dma.rs
+++ b/rust/kernel/dma.rs
@@ -5,12 +5,14 @@
 //! C header: [`include/linux/dma-mapping.h`](srctree/include/linux/dma-mapping.h)
 
 use crate::{
-    bindings, build_assert, device,
+    bindings,
+    build_assert::build_assert,
I think we can just drop it, as we already include prelude.
quoted hunk ↗ jump to hunk
+    device,
     device::{Bound, Core},
     error::{to_result, Result},
     prelude::*,
     sync::aref::ARef,
-    transmute::{AsBytes, FromBytes},
+    transmute::{AsBytes, FromBytes}, //
 };
 use core::ptr::NonNull;
 
diff --git a/rust/kernel/io/resource.rs b/rust/kernel/io/resource.rs
index b7ac9faf141d..9cb18ce1c479 100644
--- a/rust/kernel/io/resource.rs
+++ b/rust/kernel/io/resource.rs
@@ -229,7 +229,7 @@ impl Flags {
     // Always inline to optimize out error path of `build_assert`.
     #[inline(always)]
     const fn new(value: u32) -> Self {
-        crate::build_assert!(value as u64 <= c_ulong::MAX as u64);
+        crate::build_assert::build_assert!(value as u64 <= c_ulong::MAX as u64);
We include the prelude here as well, so this should also be just
build_assert!().
         Flags(value as c_ulong)
     }
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help