[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAMT+MTTiimUvH7=T-zHsGAU0cDSYcyJL9p_jWNE3K+JKaxQ-Aw@mail.gmail.com>
Date: Sun, 24 Nov 2024 16:07:09 +0100
From: Sasha Finkelstein <fnkl.kernel@...il.com>
To: Danilo Krummrich <dakr@...nel.org>, Greg KH <gregkh@...uxfoundation.org>, rafael@...nel.org,
bhelgaas@...gle.com, ojeda@...nel.org, alex.gaynor@...il.com,
boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me, tmgross@...ch.edu, a.hindborg@...sung.com,
aliceryhl@...gle.com, airlied@...il.com, fujita.tomonori@...il.com,
lina@...hilina.net, pstanner@...hat.com, ajanulgu@...hat.com,
lyude@...hat.com, Rob Herring <robh@...nel.org>, daniel.almeida@...labora.com,
saravanak@...gle.com
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, devicetree@...r.kernel.org,
Wedson Almeida Filho <wedsonaf@...il.com>, Fabien Parent <fabien.parent@...aro.org>
Subject: Re: [PATCH v3 05/16] rust: implement `IdArray`, `IdTable` and `RawDeviceId`
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)
Powered by blists - more mailing lists