Skip to contentSkip to conversation

rust: device: fix unresolved link to drm::Device

PATCH Applied Danilo Krummrich 3 participants 4 messages Aug 29, 2025 – Sep 2, 2025

Subsystems (2)
lore
Share & tools
lore

Danilo Krummrich

author maintainer
#0 lore raw

PATCH 1/1 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.

Quoted 1 line
Quoted 1 line

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 d6e26c1ae4a6 ("device: rust: expand documentation for Device")
---
 rust/kernel/device.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
rust/kernel/device.rs +3 -2
index 5902b3714a16..a1db49eb159a 100644
@@ -138,7 +138,9 @@
 /// }
 /// ```
 ///
-/// An example for a class device implementation is [`drm::Device`].
+/// An example for a class device implementation is
+#[cfg_attr(CONFIG_DRM = "y", doc = "[`drm::Device`](kernel::drm::Device).")]
+#[cfg_attr(not(CONFIG_DRM = "y"), doc = "`drm::Device`.")]
 ///
 /// # Invariants
 ///
@@ -151,7 +153,6 @@
 /// dropped from any thread.
 ///
 /// [`AlwaysRefCounted`]: kernel::types::AlwaysRefCounted
-/// [`drm::Device`]: kernel::drm::Device
 /// [`impl_device_context_deref`]: kernel::impl_device_context_deref
 /// [`pci::Device`]: kernel::pci::Device
 /// [`platform::Device`]: kernel::platform::Device

base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00

Signature · 1 line
2.51.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · Danilo Krummrich

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.

Quoted 1 line
Quoted 1 line

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.

Quoted 8 lines
Fixes d6e26c1ae4a6 ("device: rust: expand documentation for Device")
---
 rust/kernel/device.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Danilo Krummrich
Quoted 13 lines · Danilo Krummrich

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.

Quoted 1 line
Quoted 1 line

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

Quoted 7 lines

Fix this by making the intra-doc link conditional on CONFIG_DRM being enabled.

Fixes d6e26c1ae4a6 ("device: rust: expand documentation for Device")
author maintainer Applied
#3 lore raw
In reply to Danilo Krummrich
Quoted 12 lines · Danilo Krummrich

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.

Quoted 1 line
Quoted 1 line

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

Quoted 7 lines

Fix this by making the intra-doc link conditional on CONFIG_DRM being enabled.

Fixes d6e26c1ae4a6 ("device: rust: expand documentation for Device")

Applied to driver-core-linus, thanks!