Re: [PATCH v2 1/9] rust: device: implement impl_device_context_deref!
From: Benno Lossin
Date: Mon Apr 14 2025 - 06:41:48 EST
On Sun Apr 13, 2025 at 7:36 PM CEST, Danilo Krummrich wrote:
> +/// Implement [`core::ops::Deref`] traits for allowed [`DeviceContext`] conversions of a (bus
> +/// specific) device.
> +///
> +/// # Safety
> +///
> +/// The type given as `$device` must be a transparent wrapper of a type that doesn't depend on the
> +/// generic argument of `$device`.
> +#[macro_export]
> +macro_rules! impl_device_context_deref {
> + (unsafe { $device:ident }) => {
> + // SAFETY: This macro has the exact same safety requirement as
> + // `__impl_device_context_deref!`.
> + kernel::__impl_device_context_deref!(unsafe {
Missing `::` in front of `kernel`.
---
Cheers,
Benno
> + $device,
> + $crate::device::Core => $crate::device::Normal
> + });
> + };
> +}
> +
> #[doc(hidden)]
> #[macro_export]
> macro_rules! dev_printk {