2 * property.h - Unified device property interface.
4 * Copyright (C) 2014, Intel Corporation
5 * Authors: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 * Mika Westerberg <mika.westerberg@linux.intel.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #ifndef _LINUX_PROPERTY_H_
14 #define _LINUX_PROPERTY_H_
16 #include <linux/types.h>
29 bool device_property_present(struct device
*dev
, const char *propname
);
30 int device_property_read_u8_array(struct device
*dev
, const char *propname
,
31 u8
*val
, size_t nval
);
32 int device_property_read_u16_array(struct device
*dev
, const char *propname
,
33 u16
*val
, size_t nval
);
34 int device_property_read_u32_array(struct device
*dev
, const char *propname
,
35 u32
*val
, size_t nval
);
36 int device_property_read_u64_array(struct device
*dev
, const char *propname
,
37 u64
*val
, size_t nval
);
38 int device_property_read_string_array(struct device
*dev
, const char *propname
,
39 const char **val
, size_t nval
);
40 int device_property_read_string(struct device
*dev
, const char *propname
,
49 struct fwnode_handle
{
50 enum fwnode_type type
;
53 bool fwnode_property_present(struct fwnode_handle
*fwnode
, const char *propname
);
54 int fwnode_property_read_u8_array(struct fwnode_handle
*fwnode
,
55 const char *propname
, u8
*val
,
57 int fwnode_property_read_u16_array(struct fwnode_handle
*fwnode
,
58 const char *propname
, u16
*val
,
60 int fwnode_property_read_u32_array(struct fwnode_handle
*fwnode
,
61 const char *propname
, u32
*val
,
63 int fwnode_property_read_u64_array(struct fwnode_handle
*fwnode
,
64 const char *propname
, u64
*val
,
66 int fwnode_property_read_string_array(struct fwnode_handle
*fwnode
,
67 const char *propname
, const char **val
,
69 int fwnode_property_read_string(struct fwnode_handle
*fwnode
,
70 const char *propname
, const char **val
);
72 struct fwnode_handle
*device_get_next_child_node(struct device
*dev
,
73 struct fwnode_handle
*child
);
75 #define device_for_each_child_node(dev, child) \
76 for (child = device_get_next_child_node(dev, NULL); child; \
77 child = device_get_next_child_node(dev, child))
79 void fwnode_handle_put(struct fwnode_handle
*fwnode
);
81 unsigned int device_get_child_node_count(struct device
*dev
);
83 static inline bool device_property_read_bool(struct device
*dev
,
86 return device_property_present(dev
, propname
);
89 static inline int device_property_read_u8(struct device
*dev
,
90 const char *propname
, u8
*val
)
92 return device_property_read_u8_array(dev
, propname
, val
, 1);
95 static inline int device_property_read_u16(struct device
*dev
,
96 const char *propname
, u16
*val
)
98 return device_property_read_u16_array(dev
, propname
, val
, 1);
101 static inline int device_property_read_u32(struct device
*dev
,
102 const char *propname
, u32
*val
)
104 return device_property_read_u32_array(dev
, propname
, val
, 1);
107 static inline int device_property_read_u64(struct device
*dev
,
108 const char *propname
, u64
*val
)
110 return device_property_read_u64_array(dev
, propname
, val
, 1);
113 static inline bool fwnode_property_read_bool(struct fwnode_handle
*fwnode
,
114 const char *propname
)
116 return fwnode_property_present(fwnode
, propname
);
119 static inline int fwnode_property_read_u8(struct fwnode_handle
*fwnode
,
120 const char *propname
, u8
*val
)
122 return fwnode_property_read_u8_array(fwnode
, propname
, val
, 1);
125 static inline int fwnode_property_read_u16(struct fwnode_handle
*fwnode
,
126 const char *propname
, u16
*val
)
128 return fwnode_property_read_u16_array(fwnode
, propname
, val
, 1);
131 static inline int fwnode_property_read_u32(struct fwnode_handle
*fwnode
,
132 const char *propname
, u32
*val
)
134 return fwnode_property_read_u32_array(fwnode
, propname
, val
, 1);
137 static inline int fwnode_property_read_u64(struct fwnode_handle
*fwnode
,
138 const char *propname
, u64
*val
)
140 return fwnode_property_read_u64_array(fwnode
, propname
, val
, 1);
143 #endif /* _LINUX_PROPERTY_H_ */
This page took 0.039904 seconds and 5 git commands to generate.