@@ -247,7 +247,9 @@ fn decode_gpios_gpio(unique: &Ident, entry: &Value) -> TokenStream {
247
247
#[ serde( tag = "type" , rename_all = "snake_case" , content = "value" ) ]
248
248
pub enum RawInfo {
249
249
/// Get the raw device directly from this node.
250
- Myself ,
250
+ Myself {
251
+ args : Vec < ArgInfo > ,
252
+ } ,
251
253
/// Get the reference from a parent of this node, at a given level.
252
254
Parent {
253
255
/// How many levels to look up. 0 would refer to this node (but would also be an error).
@@ -272,7 +274,9 @@ impl RawInfo {
272
274
} ;
273
275
274
276
match self {
275
- RawInfo :: Myself => {
277
+ RawInfo :: Myself { args } => {
278
+ let get_args = args. iter ( ) . map ( |arg| arg. args ( node) ) ;
279
+
276
280
let ord = node. ord ;
277
281
let rawdev = format_ident ! ( "__device_dts_ord_{}" , ord) ;
278
282
quote ! {
@@ -288,7 +292,7 @@ impl RawInfo {
288
292
pub fn get_instance( ) -> Option <#device_id> {
289
293
unsafe {
290
294
let device = get_instance_raw( ) ;
291
- #device_id:: new( & UNIQUE , device)
295
+ #device_id:: new( & UNIQUE , device, # ( #get_args ) , * )
292
296
}
293
297
}
294
298
}
@@ -354,6 +358,8 @@ impl RawInfo {
354
358
pub enum ArgInfo {
355
359
/// The arguments come from a 'reg' property.
356
360
Reg ,
361
+ /// A count of the number of child nodes.
362
+ ChildCount ,
357
363
}
358
364
359
365
impl ArgInfo {
@@ -366,6 +372,12 @@ impl ArgInfo {
366
372
#( #reg) , *
367
373
}
368
374
}
375
+ ArgInfo :: ChildCount => {
376
+ let count = node. children . len ( ) ;
377
+ quote ! {
378
+ #count
379
+ }
380
+ }
369
381
}
370
382
}
371
383
}
0 commit comments