Commit d22f955c authored by Rahul Rameshbabu's avatar Rahul Rameshbabu Committed by Paolo Abeni
Browse files

rust: net::phy scope ThisModule usage in the module_phy_driver macro



Similar to the use of $crate::Module, ThisModule should be referred to as
$crate::ThisModule in the macro evaluation. The reason the macro previously
did not cause any errors is because all the users of the macro would use
kernel::prelude::*, bringing ThisModule into scope.

Signed-off-by: default avatarRahul Rameshbabu <sergeantsagara@protonmail.com>
Reviewed-by: default avatarFUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20241214194242.19505-1-sergeantsagara@protonmail.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent ff9f17ce
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -837,7 +837,7 @@ const fn as_int(&self) -> u32 {
///         [::kernel::net::phy::create_phy_driver::<PhySample>()];
///
///     impl ::kernel::Module for Module {
///         fn init(module: &'static ThisModule) -> Result<Self> {
///         fn init(module: &'static ::kernel::ThisModule) -> Result<Self> {
///             let drivers = unsafe { &mut DRIVERS };
///             let mut reg = ::kernel::net::phy::Registration::register(
///                 module,
@@ -903,7 +903,7 @@ struct Module {
                [$($crate::net::phy::create_phy_driver::<$driver>()),+];

            impl $crate::Module for Module {
                fn init(module: &'static ThisModule) -> Result<Self> {
                fn init(module: &'static $crate::ThisModule) -> Result<Self> {
                    // SAFETY: The anonymous constant guarantees that nobody else can access
                    // the `DRIVERS` static. The array is used only in the C side.
                    let drivers = unsafe { &mut DRIVERS };