Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

of: Add of_property_present() helper

Add an of_property_present() function similar to
fwnode_property_present(). of_property_read_bool() could be used
directly, but it is cleaner to not use it on non-boolean properties.

Reviewed-by: Frank Rowand <frowand.list@gmail.com>
Tested-by: Frank Rowand <frowand.list@gmail.com>
Link: https://lore.kernel.org/all/20230215215547.691573-1-robh@kernel.org/
Signed-off-by: Rob Herring <robh@kernel.org>

+16 -1
+16 -1
include/linux/of.h
··· 1155 1155 * @np: device node from which the property value is to be read. 1156 1156 * @propname: name of the property to be searched. 1157 1157 * 1158 - * Search for a property in a device node. 1158 + * Search for a boolean property in a device node. Usage on non-boolean 1159 + * property types is deprecated. 1159 1160 * 1160 1161 * Return: true if the property exists false otherwise. 1161 1162 */ ··· 1166 1165 struct property *prop = of_find_property(np, propname, NULL); 1167 1166 1168 1167 return prop ? true : false; 1168 + } 1169 + 1170 + /** 1171 + * of_property_present - Test if a property is present in a node 1172 + * @np: device node to search for the property. 1173 + * @propname: name of the property to be searched. 1174 + * 1175 + * Test for a property present in a device node. 1176 + * 1177 + * Return: true if the property exists false otherwise. 1178 + */ 1179 + static inline bool of_property_present(const struct device_node *np, const char *propname) 1180 + { 1181 + return of_property_read_bool(np, propname); 1169 1182 } 1170 1183 1171 1184 /**