summaryrefslogtreecommitdiffstats
path: root/include/linux/acpi.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-11-04 08:03:59 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-11-04 15:58:23 -0500
commit8a0662d9ed2968e1186208336a8e1fab3fdfea63 (patch)
tree2109aed71b5279750754f1417e9b0ba0c519caa7 /include/linux/acpi.h
parent633a21d80b4a2cd648aa2dacdb22494ffb2f28f0 (diff)
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>
Diffstat (limited to 'include/linux/acpi.h')
-rw-r--r--include/linux/acpi.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 38296d686c55..5b8802216a93 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -440,6 +440,23 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *);
440#define ACPI_COMPANION_SET(dev, adev) do { } while (0) 440#define ACPI_COMPANION_SET(dev, adev) do { } while (0)
441#define ACPI_HANDLE(dev) (NULL) 441#define ACPI_HANDLE(dev) (NULL)
442 442
443struct fwnode_handle;
444
445static inline bool is_acpi_node(struct fwnode_handle *fwnode)
446{
447 return false;
448}
449
450static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode)
451{
452 return NULL;
453}
454
455static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
456{
457 return NULL;
458}
459
443static inline const char *acpi_dev_name(struct acpi_device *adev) 460static inline const char *acpi_dev_name(struct acpi_device *adev)
444{ 461{
445 return NULL; 462 return NULL;
@@ -681,6 +698,9 @@ int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname,
681 enum dev_prop_type proptype, void *val); 698 enum dev_prop_type proptype, void *val);
682int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, 699int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
683 enum dev_prop_type proptype, void *val, size_t nval); 700 enum dev_prop_type proptype, void *val, size_t nval);
701
702struct acpi_device *acpi_get_next_child(struct device *dev,
703 struct acpi_device *child);
684#else 704#else
685static inline int acpi_dev_get_property(struct acpi_device *adev, 705static inline int acpi_dev_get_property(struct acpi_device *adev,
686 const char *name, acpi_object_type type, 706 const char *name, acpi_object_type type,
@@ -725,6 +745,12 @@ static inline int acpi_dev_prop_read(struct acpi_device *adev,
725 return -ENXIO; 745 return -ENXIO;
726} 746}
727 747
748static inline struct acpi_device *acpi_get_next_child(struct device *dev,
749 struct acpi_device *child)
750{
751 return NULL;
752}
753
728#endif 754#endif
729 755
730#endif /*_LINUX_ACPI_H*/ 756#endif /*_LINUX_ACPI_H*/