diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2017-07-21 15:11:49 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-07-22 00:04:51 +0200 |
commit | 3e3119d3088f41106f3581d39e7694a50ca3fc02 (patch) | |
tree | b7215757dd95eda454860929de50319ca5f5d432 /drivers/base/property.c | |
parent | 37ba983cfb47cc7b353146422c437468fcb29c61 (diff) | |
download | lwn-3e3119d3088f41106f3581d39e7694a50ca3fc02.tar.gz lwn-3e3119d3088f41106f3581d39e7694a50ca3fc02.zip |
device property: Introduce fwnode_property_get_reference_args
The new fwnode_property_get_reference_args() interface amends the fwnode
property API with the functionality of both of_parse_phandle_with_args()
and __acpi_node_get_property_reference().
The semantics is slightly different: the cells property is ignored on ACPI
as the number of arguments can be explicitly obtained from the firmware
interface.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/property.c')
-rw-r--r-- | drivers/base/property.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c index 673e2353a2fb..d0b65bbe7e15 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -665,6 +665,34 @@ out: } EXPORT_SYMBOL_GPL(fwnode_property_match_string); +/** + * fwnode_property_get_reference_args() - Find a reference with arguments + * @fwnode: Firmware node where to look for the reference + * @prop: The name of the property + * @nargs_prop: The name of the property telling the number of + * arguments in the referred node. NULL if @nargs is known, + * otherwise @nargs is ignored. Only relevant on OF. + * @nargs: Number of arguments. Ignored if @nargs_prop is non-NULL. + * @index: Index of the reference, from zero onwards. + * @args: Result structure with reference and integer arguments. + * + * Obtain a reference based on a named property in an fwnode, with + * integer arguments. + * + * Caller is responsible to call fwnode_handle_put() on the returned + * args->fwnode pointer. + * + */ +int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, + const char *prop, const char *nargs_prop, + unsigned int nargs, unsigned int index, + struct fwnode_reference_args *args) +{ + return fwnode_call_int_op(fwnode, get_reference_args, prop, nargs_prop, + nargs, index, args); +} +EXPORT_SYMBOL_GPL(fwnode_property_get_reference_args); + static int property_copy_string_array(struct property_entry *dst, const struct property_entry *src) { |