aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2018-09-05 18:21:22 -0400
committerJason Gunthorpe <jgg@mellanox.com>2018-09-05 18:21:22 -0400
commit2c910cb75e1fe6de52d95c8e32caedd1629a33a5 (patch)
tree94a0eea6f8cde689d11e7583ddd0a930b8785ab4 /include/linux/of.h
parent627212c9d49ba2759b699450f5d8f45f73e062fa (diff)
parentb53b1c08a23eb1091982daacb2122f90a7094a77 (diff)
Merge branch 'uverbs_dev_cleanups' into rdma.git for-next
For dependencies, branch based on rdma.git 'for-rc' of https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/ Pull 'uverbs_dev_cleanups' from Leon Romanovsky: ==================== Reuse the char device code interfaces to simplify ib_uverbs_device creation and destruction. As part of this series, we are sending fix to cleanup path, which was discovered during internal review, The fix definitely can go to -rc, but it means that this series will be dependent on rdma-rc. ==================== * branch 'uverbs_dev_cleanups': RDMA/uverbs: Use device.groups to initialize device attributes RDMA/uverbs: Use cdev_device_add() instead of cdev_add() RDMA/core: Depend on device_add() to add device attributes RDMA/uverbs: Fix error cleanup path of ib_uverbs_add_one() Resolved conflict in ib_device_unregister_sysfs() Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 4d25e4f952d9..99b0ebf49632 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -256,6 +256,9 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
256#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 256#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
257#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 257#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
258 258
259extern bool of_node_name_eq(const struct device_node *np, const char *name);
260extern bool of_node_name_prefix(const struct device_node *np, const char *prefix);
261
259static inline const char *of_node_full_name(const struct device_node *np) 262static inline const char *of_node_full_name(const struct device_node *np)
260{ 263{
261 return np ? np->full_name : "<no-node>"; 264 return np ? np->full_name : "<no-node>";
@@ -290,6 +293,8 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
290extern struct device_node *of_get_next_available_child( 293extern struct device_node *of_get_next_available_child(
291 const struct device_node *node, struct device_node *prev); 294 const struct device_node *node, struct device_node *prev);
292 295
296extern struct device_node *of_get_compatible_child(const struct device_node *parent,
297 const char *compatible);
293extern struct device_node *of_get_child_by_name(const struct device_node *node, 298extern struct device_node *of_get_child_by_name(const struct device_node *node,
294 const char *name); 299 const char *name);
295 300
@@ -561,6 +566,16 @@ static inline struct device_node *to_of_node(const struct fwnode_handle *fwnode)
561 return NULL; 566 return NULL;
562} 567}
563 568
569static inline bool of_node_name_eq(const struct device_node *np, const char *name)
570{
571 return false;
572}
573
574static inline bool of_node_name_prefix(const struct device_node *np, const char *prefix)
575{
576 return false;
577}
578
564static inline const char* of_node_full_name(const struct device_node *np) 579static inline const char* of_node_full_name(const struct device_node *np)
565{ 580{
566 return "<no-node>"; 581 return "<no-node>";
@@ -632,6 +647,12 @@ static inline bool of_have_populated_dt(void)
632 return false; 647 return false;
633} 648}
634 649
650static inline struct device_node *of_get_compatible_child(const struct device_node *parent,
651 const char *compatible)
652{
653 return NULL;
654}
655
635static inline struct device_node *of_get_child_by_name( 656static inline struct device_node *of_get_child_by_name(
636 const struct device_node *node, 657 const struct device_node *node,
637 const char *name) 658 const char *name)
@@ -967,6 +988,18 @@ static inline struct device_node *of_find_matching_node(
967 return of_find_matching_node_and_match(from, matches, NULL); 988 return of_find_matching_node_and_match(from, matches, NULL);
968} 989}
969 990
991static inline const char *of_node_get_device_type(const struct device_node *np)
992{
993 return of_get_property(np, "type", NULL);
994}
995
996static inline bool of_node_is_type(const struct device_node *np, const char *type)
997{
998 const char *match = of_node_get_device_type(np);
999
1000 return np && match && type && !strcmp(match, type);
1001}
1002
970/** 1003/**
971 * of_property_count_u8_elems - Count the number of u8 elements in a property 1004 * of_property_count_u8_elems - Count the number of u8 elements in a property
972 * 1005 *