@@ -482,24 +482,26 @@ pub unsafe trait HasWork<T, const ID: u64 = 0> {
482482/// use kernel::sync::Arc;
483483/// use kernel::workqueue::{self, impl_has_work, Work};
484484///
485- /// struct MyStruct {
486- /// work_field: Work<MyStruct, 17>,
485+ /// struct MyStruct<'a, T, const N: usize> {
486+ /// work_field: Work<MyStruct<'a, T, N>, 17>,
487+ /// f: fn(&'a [T; N]),
487488/// }
488489///
489490/// impl_has_work! {
490- /// impl HasWork<MyStruct, 17> for MyStruct { self.work_field }
491+ /// impl{'a, T, const N: usize} HasWork<MyStruct<'a, T, N>, 17>
492+ /// for MyStruct<'a, T, N> { self.work_field }
491493/// }
492494/// ```
493495#[ macro_export]
494496macro_rules! impl_has_work {
495- ( $( impl $( < $( $implarg : ident ) , * > ) ?
497+ ( $( impl $( { $( $generics : tt ) * } ) ?
496498 HasWork <$work_type: ty $( , $id: tt) ?>
497- for $self: ident $ ( <$ ( $selfarg : ident ) , * > ) ?
499+ for $self: ty
498500 { self . $field: ident }
499501 ) * ) => { $(
500502 // SAFETY: The implementation of `raw_get_work` only compiles if the field has the right
501503 // type.
502- unsafe impl $( <$( $implarg ) , * >) ? $crate:: workqueue:: HasWork <$work_type $( , $id) ?> for $self $ ( <$ ( $selfarg ) , * > ) ? {
504+ unsafe impl $( <$( $generics ) + >) ? $crate:: workqueue:: HasWork <$work_type $( , $id) ?> for $self {
503505 const OFFSET : usize = :: core:: mem:: offset_of!( Self , $field) as usize ;
504506
505507 #[ inline]
@@ -515,7 +517,7 @@ macro_rules! impl_has_work {
515517pub use impl_has_work;
516518
517519impl_has_work ! {
518- impl < T > HasWork <Self > for ClosureWork <T > { self . work }
520+ impl { T } HasWork <Self > for ClosureWork <T > { self . work }
519521}
520522
521523unsafe impl < T , const ID : u64 > WorkItemPointer < ID > for Arc < T >
0 commit comments