Re: [PATCH v3 05/16] rust: implement `IdArray`, `IdTable` and `RawDeviceId`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/22/24 23:31, Danilo Krummrich wrote:
+
+/// Create device table alias for modpost.
+#[macro_export]
+macro_rules! module_device_table {
+    ($table_type: literal, $module_table_name:ident, $table_name:ident) => {
+        #[rustfmt::skip]
+        #[export_name =
+            concat!("__mod_", $table_type, "__",
stringify!($table_name), "_device_table")
+        ]
+        static $module_table_name: [core::mem::MaybeUninit<u8>;
$table_name.raw_ids().size()] =
+            unsafe { core::mem::transmute_copy($table_name.raw_ids()) };
+    };
+}

This needs a cfg(MODULE) or similar, otherwise it is impossible to
build multiple modules
into the kernel. (See
https://github.com/AsahiLinux/linux/commit/b63a09090638ff92993c450132387a77e1e68c9a)




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux