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

Merge tag 'devprop-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull device properties framework updates from Rafael Wysocki:
"These make the fwnode_handle_get() function return a pointer to the
target fwnode object, which reflects the of_node_get() behavior, and
add a macro for iterating over graph endpoints (Sakari Ailus)"

* tag 'devprop-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
device property: Add a macro for interating over graph endpoints
device property: Make fwnode_handle_get() return the fwnode

+15 -6
+7 -2
drivers/base/property.c
··· 1044 1044 /** 1045 1045 * fwnode_handle_get - Obtain a reference to a device node 1046 1046 * @fwnode: Pointer to the device node to obtain the reference to. 1047 + * 1048 + * Returns the fwnode handle. 1047 1049 */ 1048 - void fwnode_handle_get(struct fwnode_handle *fwnode) 1050 + struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode) 1049 1051 { 1050 - fwnode_call_void_op(fwnode, get); 1052 + if (!fwnode_has_op(fwnode, get)) 1053 + return fwnode; 1054 + 1055 + return fwnode_call_ptr_op(fwnode, get); 1051 1056 } 1052 1057 EXPORT_SYMBOL_GPL(fwnode_handle_get); 1053 1058
+2 -2
drivers/of/property.c
··· 817 817 } 818 818 EXPORT_SYMBOL(of_graph_get_remote_node); 819 819 820 - static void of_fwnode_get(struct fwnode_handle *fwnode) 820 + static struct fwnode_handle *of_fwnode_get(struct fwnode_handle *fwnode) 821 821 { 822 - of_node_get(to_of_node(fwnode)); 822 + return of_fwnode_handle(of_node_get(to_of_node(fwnode))); 823 823 } 824 824 825 825 static void of_fwnode_put(struct fwnode_handle *fwnode)
+1 -1
include/linux/fwnode.h
··· 68 68 * @graph_parse_endpoint: Parse endpoint for port and endpoint id. 69 69 */ 70 70 struct fwnode_operations { 71 - void (*get)(struct fwnode_handle *fwnode); 71 + struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); 72 72 void (*put)(struct fwnode_handle *fwnode); 73 73 bool (*device_is_available)(const struct fwnode_handle *fwnode); 74 74 bool (*property_present)(const struct fwnode_handle *fwnode,
+5 -1
include/linux/property.h
··· 100 100 struct fwnode_handle *device_get_named_child_node(struct device *dev, 101 101 const char *childname); 102 102 103 - void fwnode_handle_get(struct fwnode_handle *fwnode); 103 + struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode); 104 104 void fwnode_handle_put(struct fwnode_handle *fwnode); 105 105 106 106 unsigned int device_get_child_node_count(struct device *dev); ··· 292 292 struct fwnode_handle * 293 293 fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port, 294 294 u32 endpoint); 295 + 296 + #define fwnode_graph_for_each_endpoint(fwnode, child) \ 297 + for (child = NULL; \ 298 + (child = fwnode_graph_get_next_endpoint(fwnode, child)); ) 295 299 296 300 int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, 297 301 struct fwnode_endpoint *endpoint);