]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: net::phy always define device_table in module_phy_driver macro
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Mon, 30 Sep 2024 13:40:37 +0000 (13:40 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 3 Oct 2024 23:42:18 +0000 (16:42 -0700)
commit3ed8d344e061f382069c27705543c1882aca468a
tree00aafbfd619f511cf716dda0ee35176b3cb55ef6
parent5fad1c1a09accf13abf4c22cf08445c2649c9d69
rust: net::phy always define device_table in module_phy_driver macro

device_table in module_phy_driver macro is defined only when the
driver is built as a module. So a PHY driver imports phy::DeviceId
module in the following way then hits `unused import` warning when
it's compiled as built-in:

 use kernel::net::phy::DeviceId;

 kernel::module_phy_driver! {
     drivers: [PhyQT2025],
     device_table: [
        DeviceId::new_with_driver::<PhyQT2025>(),
     ],

Put device_table in a const. It's not included in the kernel image if
unused (when the driver is compiled as built-in), and the compiler
doesn't complain.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20240930134038.1309-1-fujita.tomonori@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
rust/kernel/net/phy.rs