Re: [PATCH 2/2] rust: device: make example buildable

From: Alice Ryhl

Date: Mon Nov 10 2025 - 06:55:07 EST


On Mon, Nov 10, 2025 at 12:35:28PM +0100, Miguel Ojeda wrote:
> This example can easily be made buildable, thus do so.
>
> It would have triggered an `unreachable_pub` warning without the previous
> commit.
>
> Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

> rust/kernel/device.rs | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs
> index a849b7dde2fd..d00f4af507db 100644
> --- a/rust/kernel/device.rs
> +++ b/rust/kernel/device.rs
> @@ -67,7 +67,16 @@
> ///
> /// A bus specific device should be defined as follows.
> ///
> -/// ```ignore
> +/// ```
> +/// # use core::marker::PhantomData;
> +/// # use kernel::{
> +/// # device,
> +/// # types::Opaque, //
> +/// # };
> +/// # mod bindings {
> +/// # #[expect(non_camel_case_types)]
> +/// # pub struct bus_device_type;
> +/// # }
> /// #[repr(transparent)]
> /// pub struct Device<Ctx: device::DeviceContext = device::Normal>(
> /// Opaque<bindings::bus_device_type>,
> --
> 2.51.2
>