Driver core: Unified interface for firmware node properties
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 4 Nov 2014 13:03:59 +0000 (14:03 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 4 Nov 2014 20:58:23 +0000 (21:58 +0100)
commit8a0662d9ed2968e1186208336a8e1fab3fdfea63
tree2109aed71b5279750754f1417e9b0ba0c519caa7
parent633a21d80b4a2cd648aa2dacdb22494ffb2f28f0
Driver core: Unified interface for firmware node properties

Add new generic routines are provided for retrieving properties from
device description objects in the platform firmware in case there are
no struct device objects for them (either those objects have not been
created yet or they do not exist at all).

The following functions are provided:

fwnode_property_present()
fwnode_property_read_u8()
fwnode_property_read_u16()
fwnode_property_read_u32()
fwnode_property_read_u64()
fwnode_property_read_string()
fwnode_property_read_u8_array()
fwnode_property_read_u16_array()
fwnode_property_read_u32_array()
fwnode_property_read_u64_array()
fwnode_property_read_string_array()

in analogy with the corresponding functions for struct device added
previously.  For all of them, the first argument is a pointer to struct
fwnode_handle (new type) that allows a device description object
(depending on what platform firmware interface is in use) to be
obtained.

Add a new macro device_for_each_child_node() for iterating over the
children of the device description object associated with a given
device and a new function device_get_child_node_count() returning the
number of a given device's child nodes.

The interface covers both ACPI and Device Trees.

Suggested-by: Grant Likely <grant.likely@linaro.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/scan.c
drivers/base/property.c
include/acpi/acpi_bus.h
include/linux/acpi.h
include/linux/of.h
include/linux/property.h