Skip to content

Commit a9a42f0

Browse files
fujitaDanilo Krummrich
authored andcommitted
rust: device: fix broken intra-doc links
The `pci` module is conditional on CONFIG_PCI. When it's disabled, the intra-doc link to `pci::Device` causes rustdoc warnings: warning: unresolved link to `kernel::pci::Device` --> rust/kernel/device.rs:163:22 | 163 | /// [`pci::Device`]: kernel::pci::Device | ^^^^^^^^^^^^^^^^^^^ no item named `pci` in module `kernel` | = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default Fix this by making the documentation conditional on CONFIG_PCI. Fixes: d6e26c1 ("device: rust: expand documentation for Device") Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Reviewed-by: Dirk Behme <dirk.behme@de.bosch.com> Link: https://patch.msgid.link/20251231045728.1912024-2-fujita.tomonori@gmail.com [ Keep the "such as" part indicating a list of examples; fix typos in commit message. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
1 parent 32cb384 commit a9a42f0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rust/kernel/device.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ static_assert!(core::mem::size_of::<bindings::driver_type>() >= core::mem::size_
6767
///
6868
/// # Implementing Bus Devices
6969
///
70-
/// This section provides a guideline to implement bus specific devices, such as [`pci::Device`] or
71-
/// [`platform::Device`].
70+
/// This section provides a guideline to implement bus specific devices, such as:
71+
#[cfg_attr(CONFIG_PCI, doc = "* [`pci::Device`](kernel::pci::Device)")]
72+
/// * [`platform::Device`]
7273
///
7374
/// A bus specific device should be defined as follows.
7475
///
@@ -160,7 +161,6 @@ static_assert!(core::mem::size_of::<bindings::driver_type>() >= core::mem::size_
160161
///
161162
/// [`AlwaysRefCounted`]: kernel::types::AlwaysRefCounted
162163
/// [`impl_device_context_deref`]: kernel::impl_device_context_deref
163-
/// [`pci::Device`]: kernel::pci::Device
164164
/// [`platform::Device`]: kernel::platform::Device
165165
#[repr(transparent)]
166166
pub struct Device<Ctx: DeviceContext = Normal>(Opaque<bindings::device>, PhantomData<Ctx>);

0 commit comments

Comments
 (0)