11#![ cfg( unix) ]
22
33use dtb_file:: * ;
4+ use fdt_edit:: NodeKind ;
45use fdt_edit:: * ;
56
67#[ cfg( test) ]
@@ -16,7 +17,7 @@ mod tests {
1617 // 遍历查找中断控制器节点
1718 let mut irq_count = 0 ;
1819 for node in fdt. all_nodes ( ) {
19- if let Node :: InterruptController ( ic) = node. as_ref ( ) {
20+ if let NodeKind :: InterruptController ( ic) = node. as_ref ( ) {
2021 irq_count += 1 ;
2122 println ! (
2223 "Interrupt controller: {} (#interrupt-cells={:?})" ,
@@ -26,7 +27,10 @@ mod tests {
2627 }
2728 }
2829 println ! ( "Found {} interrupt controllers" , irq_count) ;
29- assert ! ( irq_count > 0 , "Should find at least one interrupt controller" ) ;
30+ assert ! (
31+ irq_count > 0 ,
32+ "Should find at least one interrupt controller"
33+ ) ;
3034 }
3135
3236 #[ test]
@@ -35,7 +39,7 @@ mod tests {
3539 let fdt = Fdt :: from_bytes ( & raw_data) . unwrap ( ) ;
3640
3741 for node in fdt. all_nodes ( ) {
38- if let Node :: InterruptController ( ic) = node. as_ref ( ) {
42+ if let NodeKind :: InterruptController ( ic) = node. as_ref ( ) {
3943 // 获取 #interrupt-cells
4044 let cells = ic. interrupt_cells ( ) ;
4145 println ! ( "IRQ Controller: {} cells={:?}" , ic. name( ) , cells) ;
@@ -69,7 +73,7 @@ mod tests {
6973 // 查找 GIC (ARM Generic Interrupt Controller)
7074 let mut found_gic = false ;
7175 for node in fdt. all_nodes ( ) {
72- if let Node :: InterruptController ( ic) = node. as_ref ( ) {
76+ if let NodeKind :: InterruptController ( ic) = node. as_ref ( ) {
7377 let compat = ic. compatibles ( ) ;
7478 if compat. iter ( ) . any ( |c| c. contains ( "gic" ) ) {
7579 found_gic = true ;
@@ -95,7 +99,7 @@ mod tests {
9599
96100 let mut controllers = Vec :: new ( ) ;
97101 for node in fdt. all_nodes ( ) {
98- if let Node :: InterruptController ( ic) = node. as_ref ( ) {
102+ if let NodeKind :: InterruptController ( ic) = node. as_ref ( ) {
99103 controllers. push ( (
100104 ic. name ( ) . to_string ( ) ,
101105 ic. interrupt_cells ( ) ,
@@ -106,7 +110,10 @@ mod tests {
106110
107111 println ! ( "Interrupt controllers in Phytium DTB:" ) ;
108112 for ( name, cells, compat) in & controllers {
109- println ! ( " {} (#interrupt-cells={:?}, compatible={})" , name, cells, compat) ;
113+ println ! (
114+ " {} (#interrupt-cells={:?}, compatible={})" ,
115+ name, cells, compat
116+ ) ;
110117 }
111118
112119 assert ! (
@@ -123,7 +130,7 @@ mod tests {
123130
124131 for node in fdt. all_nodes ( ) {
125132 let name = node. name ( ) ;
126- let is_ic = matches ! ( node. as_ref( ) , Node :: InterruptController ( _) ) ;
133+ let is_ic = matches ! ( node. as_ref( ) , NodeKind :: InterruptController ( _) ) ;
127134
128135 // 如果节点名以 interrupt-controller 开头,应该被识别
129136 if name. starts_with ( "interrupt-controller" ) && !is_ic {
@@ -149,7 +156,7 @@ mod tests {
149156 let fdt = Fdt :: from_bytes ( & raw_data) . unwrap ( ) ;
150157
151158 for node in fdt. all_nodes ( ) {
152- if let Node :: InterruptController ( ic) = node. as_ref ( ) {
159+ if let NodeKind :: InterruptController ( ic) = node. as_ref ( ) {
153160 if let Some ( cells) = ic. interrupt_cells ( ) {
154161 // 常见的 interrupt-cells 值:1, 2, 3
155162 assert ! (
0 commit comments