]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/base/property.c
iommu/rockchip: Don't use platform_get_irq to implicitly count irqs
[linux.git] / drivers / base / property.c
index 348b37e64944ca053f02b497faadbad271052612..81bd01ed4042784b1d6b531720330353626de282 100644 (file)
@@ -484,6 +484,30 @@ int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode,
 }
 EXPORT_SYMBOL_GPL(fwnode_property_get_reference_args);
 
+/**
+ * fwnode_find_reference - Find named reference to a fwnode_handle
+ * @fwnode: Firmware node where to look for the reference
+ * @name: The name of the reference
+ * @index: Index of the reference
+ *
+ * @index can be used when the named reference holds a table of references.
+ *
+ * Returns pointer to the reference fwnode, or ERR_PTR. Caller is responsible to
+ * call fwnode_handle_put() on the returned fwnode pointer.
+ */
+struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode,
+                                           const char *name,
+                                           unsigned int index)
+{
+       struct fwnode_reference_args args;
+       int ret;
+
+       ret = fwnode_property_get_reference_args(fwnode, name, NULL, 0, index,
+                                                &args);
+       return ret ? ERR_PTR(ret) : args.fwnode;
+}
+EXPORT_SYMBOL_GPL(fwnode_find_reference);
+
 /**
  * device_remove_properties - Remove properties from a device object.
  * @dev: Device whose properties to remove.