Skip to content

Commit f1b55db

Browse files
author
Danilo Krummrich
committed
rust: device: fix unresolved link to drm::Device
drm::Device is only available when CONFIG_DRM=y, which we have to consider for intra-doc links, otherwise the rustdoc make target produces the following warning. >> warning: unresolved link to `kernel::drm::Device` --> rust/kernel/device.rs:154:22 | 154 | /// [`drm::Device`]: kernel::drm::Device | ^^^^^^^^^^^^^^^^^^^ no item named `drm` in module `kernel` | = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default Fix this by making the intra-doc link conditional on CONFIG_DRM being enabled. Fixes: d6e26c1 ("device: rust: expand documentation for Device") Suggested-by: Alice Ryhl <aliceryhl@google.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202508261644.9LclwUgt-lkp@intel.com/ Reviewed-by: Alice Ryhl <aliceryhl@google.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20250829195745.31174-1-dakr@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org>
1 parent 1b237f1 commit f1b55db

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

rust/kernel/device.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ pub mod property;
138138
/// }
139139
/// ```
140140
///
141-
/// An example for a class device implementation is [`drm::Device`].
141+
/// An example for a class device implementation is
142+
#[cfg_attr(CONFIG_DRM = "y", doc = "[`drm::Device`](kernel::drm::Device).")]
143+
#[cfg_attr(not(CONFIG_DRM = "y"), doc = "`drm::Device`.")]
142144
///
143145
/// # Invariants
144146
///
@@ -151,7 +153,6 @@ pub mod property;
151153
/// dropped from any thread.
152154
///
153155
/// [`AlwaysRefCounted`]: kernel::types::AlwaysRefCounted
154-
/// [`drm::Device`]: kernel::drm::Device
155156
/// [`impl_device_context_deref`]: kernel::impl_device_context_deref
156157
/// [`pci::Device`]: kernel::pci::Device
157158
/// [`platform::Device`]: kernel::platform::Device

0 commit comments

Comments
 (0)