Re: [PATCH v4 02/14] rust: hrtimer: introduce hrtimer support
From: Andreas Hindborg
Date: Sat Dec 07 2024 - 12:37:01 EST
"Guangbo Cui" <2407018371@xxxxxx> writes:
>> +#[macro_export]
>> +macro_rules! impl_has_timer {
>> + (
>> + impl$({$($generics:tt)*})?
>> + HasTimer<$timer_type:ty>
>> + for $self:ty
>> + { self.$field:ident }
>> + $($rest:tt)*
>> + ) => {
>> + // SAFETY: This implementation of `raw_get_timer` only compiles if the
>> + // field has the right type.
>> + unsafe impl$(<$($generics)*>)? $crate::time::hrtimer::HasTimer<$timer_type> for $self {
>> + const OFFSET: usize = ::core::mem::offset_of!(Self, $field) as usize;
>> +
>> + #[inline]
>> + unsafe fn raw_get_timer(ptr: *const Self) ->
>> + *const $crate::::time::hrtimer::Timer<$timer_type>
>
> Hi Andreas, an extra `::` here.
One of these days I hope to have refined my workflow to a degree that
would prevent things like this. I thought I was there, but not yet it
seems. Thanks for spotting.
I _did_ actually fix this, but the fix was hiding in a commit with test
code that did not make it in to the series 🤦 And when ran my script to
make sure all the commits build, this macro was no longer invoked and
the typo was hiding.
For reference, I am holding the examples back until we get either a
spinlock/condvar combo that can work in irq disabled context, or atomics
that work with LKMM.
Best regards,
Andreas Hindborg