File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,28 @@ DEFINE_MUTEX(of_mutex);
54
54
*/
55
55
DEFINE_RAW_SPINLOCK (devtree_lock );
56
56
57
+ bool of_node_name_eq (const struct device_node * np , const char * name )
58
+ {
59
+ const char * node_name ;
60
+ size_t len ;
61
+
62
+ if (!np )
63
+ return false;
64
+
65
+ node_name = kbasename (np -> full_name );
66
+ len = strchrnul (node_name , '@' ) - node_name ;
67
+
68
+ return (strlen (name ) == len ) && (strncmp (node_name , name , len ) == 0 );
69
+ }
70
+
71
+ bool of_node_name_prefix (const struct device_node * np , const char * prefix )
72
+ {
73
+ if (!np )
74
+ return false;
75
+
76
+ return strncmp (kbasename (np -> full_name ), prefix , strlen (prefix )) == 0 ;
77
+ }
78
+
57
79
int of_n_addr_cells (struct device_node * np )
58
80
{
59
81
u32 cells ;
Original file line number Diff line number Diff line change @@ -256,6 +256,9 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
256
256
#define OF_IS_DYNAMIC (x ) test_bit(OF_DYNAMIC, &x->_flags)
257
257
#define OF_MARK_DYNAMIC (x ) set_bit(OF_DYNAMIC, &x->_flags)
258
258
259
+ extern bool of_node_name_eq (const struct device_node * np , const char * name );
260
+ extern bool of_node_name_prefix (const struct device_node * np , const char * prefix );
261
+
259
262
static inline const char * of_node_full_name (const struct device_node * np )
260
263
{
261
264
return np ? np -> full_name : "<no-node>" ;
@@ -563,6 +566,16 @@ static inline struct device_node *to_of_node(const struct fwnode_handle *fwnode)
563
566
return NULL ;
564
567
}
565
568
569
+ static inline bool of_node_name_eq (const struct device_node * np , const char * name )
570
+ {
571
+ return false;
572
+ }
573
+
574
+ static inline bool of_node_name_prefix (const struct device_node * np , const char * prefix )
575
+ {
576
+ return false;
577
+ }
578
+
566
579
static inline const char * of_node_full_name (const struct device_node * np )
567
580
{
568
581
return "<no-node>" ;
You can’t perform that action at this time.
0 commit comments