@@ -50,6 +50,12 @@ static struct unittest_results {
50
50
failed; \
51
51
})
52
52
53
+ #ifdef CONFIG_OF_KOBJ
54
+ #define OF_KREF_READ (NODE ) kref_read(&(NODE)->kobj.kref)
55
+ #else
56
+ #define OF_KREF_READ (NODE ) 1
57
+ #endif
58
+
53
59
/*
54
60
* Expected message may have a message level other than KERN_INFO.
55
61
* Print the expected message only if the current loglevel will allow
@@ -570,7 +576,7 @@ static void __init of_unittest_parse_phandle_with_args_map(void)
570
576
pr_err ("missing testcase data\n" );
571
577
return ;
572
578
}
573
- prefs [i ] = kref_read ( & p [i ]-> kobj . kref );
579
+ prefs [i ] = OF_KREF_READ ( p [i ]);
574
580
}
575
581
576
582
rc = of_count_phandle_with_args (np , "phandle-list" , "#phandle-cells" );
@@ -693,9 +699,9 @@ static void __init of_unittest_parse_phandle_with_args_map(void)
693
699
unittest (rc == - EINVAL , "expected:%i got:%i\n" , - EINVAL , rc );
694
700
695
701
for (i = 0 ; i < ARRAY_SIZE (p ); ++ i ) {
696
- unittest (prefs [i ] == kref_read ( & p [i ]-> kobj . kref ),
702
+ unittest (prefs [i ] == OF_KREF_READ ( p [i ]),
697
703
"provider%d: expected:%d got:%d\n" ,
698
- i , prefs [i ], kref_read ( & p [i ]-> kobj . kref ));
704
+ i , prefs [i ], OF_KREF_READ ( p [i ]));
699
705
of_node_put (p [i ]);
700
706
}
701
707
}
0 commit comments