Skip to content

Commit 4c9f6a7

Browse files
DarksonnDanilo Krummrich
authored andcommitted
rust: driver: fix broken intra-doc links to example driver types
The `auxiliary` and `pci` modules are conditional on `CONFIG_AUXILIARY_BUS` and `CONFIG_PCI` respectively. When these are disabled, the intra-doc links to `auxiliary::Driver` and `pci::Driver` break, causing rustdoc warnings (or errors with `-D warnings`). error: unresolved link to `kernel::auxiliary::Driver` --> rust/kernel/driver.rs:82:28 | 82 | //! [`auxiliary::Driver`]: kernel::auxiliary::Driver | ^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `auxiliary` in module `kernel` Fix this by making the documentation for these examples conditional on the corresponding configuration options. Fixes: 970a7c6 ("driver: rust: expand documentation for driver infrastructure") Signed-off-by: Alice Ryhl <aliceryhl@google.com> Reported-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Closes: https://lore.kernel.org/rust-for-linux/20251209.151817.744108529426448097.fujita.tomonori@gmail.com/ Link: https://patch.msgid.link/20251227-driver-types-v1-1-1916154fbe5e@google.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
1 parent 3691fd1 commit 4c9f6a7

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

rust/kernel/driver.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@
3333
//! }
3434
//! ```
3535
//!
36-
//! For specific examples see [`auxiliary::Driver`], [`pci::Driver`] and [`platform::Driver`].
36+
//! For specific examples see:
37+
//!
38+
//! * [`platform::Driver`](kernel::platform::Driver)
39+
#![cfg_attr(
40+
CONFIG_AUXILIARY_BUS,
41+
doc = "* [`auxiliary::Driver`](kernel::auxiliary::Driver)"
42+
)]
43+
#![cfg_attr(CONFIG_PCI, doc = "* [`pci::Driver`](kernel::pci::Driver)")]
3744
//!
3845
//! The `probe()` callback should return a `impl PinInit<Self, Error>`, i.e. the driver's private
3946
//! data. The bus abstraction should store the pointer in the corresponding bus device. The generic
@@ -79,16 +86,13 @@
7986
//!
8087
//! For this purpose the generic infrastructure in [`device_id`] should be used.
8188
//!
82-
//! [`auxiliary::Driver`]: kernel::auxiliary::Driver
8389
//! [`Core`]: device::Core
8490
//! [`Device`]: device::Device
8591
//! [`Device<Core>`]: device::Device<device::Core>
8692
//! [`Device<CoreInternal>`]: device::Device<device::CoreInternal>
8793
//! [`DeviceContext`]: device::DeviceContext
8894
//! [`device_id`]: kernel::device_id
8995
//! [`module_driver`]: kernel::module_driver
90-
//! [`pci::Driver`]: kernel::pci::Driver
91-
//! [`platform::Driver`]: kernel::platform::Driver
9296
9397
use crate::error::{Error, Result};
9498
use crate::{acpi, device, of, str::CStr, try_pin_init, types::Opaque, ThisModule};

0 commit comments

Comments
 (0)