Re: [PATCH v4 03/13] rust: implement `IdArray`, `IdTable` and `RawDeviceId`
From: Danilo Krummrich
Date: Mon Dec 09 2024 - 05:46:09 EST
On Fri, Dec 06, 2024 at 05:14:00PM -0800, Fabien Parent wrote:
> Hi Danilo,
>
> > +/// 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,
> > + "__", module_path!(),
> > + "_", line!(),
> > + "_", stringify!($table_name),
> > + "_device_table")
>
> This doesn't work on top of v6.13-rc1. The alias symbol name has been
> renamed by commit 054a9cd395a7 (modpost: rename alias
> symbol for MODULE_DEVICE_TABLE())
>
> I applied the following change to make it work again:
> - concat!("__mod_", $table_type,
> + concat!("__mod_device_table__", $table_type,
> "__", module_path!(),
> "_", line!(),
> - "_", stringify!($table_name),
> - "_device_table")
> + "_", stringify!($table_name))
Good catch, thanks!
>
>
> > + ]
> > + static $module_table_name: [core::mem::MaybeUninit<u8>; $table_name.raw_ids().size()] =
> > + unsafe { core::mem::transmute_copy($table_name.raw_ids()) };
> > + };
> > +}