Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: d6e26c1ae4a6 ("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>

authored by

FUJITA Tomonori and committed by
Danilo Krummrich
a9a42f07 32cb3840

+3 -3
+3 -3
rust/kernel/device.rs
··· 67 67 /// 68 68 /// # Implementing Bus Devices 69 69 /// 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`] 72 73 /// 73 74 /// A bus specific device should be defined as follows. 74 75 /// ··· 161 160 /// 162 161 /// [`AlwaysRefCounted`]: kernel::types::AlwaysRefCounted 163 162 /// [`impl_device_context_deref`]: kernel::impl_device_context_deref 164 - /// [`pci::Device`]: kernel::pci::Device 165 163 /// [`platform::Device`]: kernel::platform::Device 166 164 #[repr(transparent)] 167 165 pub struct Device<Ctx: DeviceContext = Normal>(Opaque<bindings::device>, PhantomData<Ctx>);