summaryrefslogtreecommitdiffstats
path: root/include/linux/acpi.h
diff options
context:
space:
mode:
authorRafael J. Wysocki2015-04-03 23:23:37 +0200
committerRafael J. Wysocki2015-04-03 23:23:37 +0200
commit97badf873ab60e841243b66133ff9eff2a46ef29 (patch)
tree3504372747c1610d89f5e3909667603beaf1a335 /include/linux/acpi.h
parentdriver core: Implement device property accessors through fwnode ones (diff)
downloadkernel-qcow2-linux-97badf873ab60e841243b66133ff9eff2a46ef29.tar.gz
kernel-qcow2-linux-97badf873ab60e841243b66133ff9eff2a46ef29.tar.xz
kernel-qcow2-linux-97badf873ab60e841243b66133ff9eff2a46ef29.zip
device property: Make it possible to use secondary firmware nodes
Add a secondary pointer to struct fwnode_handle so as to make it possible for a device to have two firmware nodes associated with it at the same time, for example, an ACPI node and a node with a set of properties provided by platform initialization code. In the future that will allow device property lookup to fall back from the primary firmware node to the secondary one if the given property is not present there to make it easier to provide defaults for device properties used by device drivers. Introduce two helper routines, set_primary_fwnode() and set_secondary_fwnode() allowing callers to add a primary/secondary firmware node to the given device in such a way that (1) If there's only one firmware node for that device, it will be pointed to by the device's firmware node pointer. (2) If both the primary and secondary firmware nodes are present, the primary one will be pointed to by the device's firmware node pointer, while the secondary one will be pointed to by the primary node's secondary pointer. (3) If one of these nodes is removed (by calling one of the new nelpers with NULL as the second argument), the other one will be preserved. Make ACPI use set_primary_fwnode() for attaching its firmware nodes to devices. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/acpi.h')
-rw-r--r--include/linux/acpi.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ec488d03b518..dd12127f171c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -54,8 +54,8 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
}
#define ACPI_COMPANION(dev) acpi_node((dev)->fwnode)
-#define ACPI_COMPANION_SET(dev, adev) (dev)->fwnode = (adev) ? \
- acpi_fwnode_handle(adev) : NULL
+#define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \
+ acpi_fwnode_handle(adev) : NULL)
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
static inline bool has_acpi_companion(struct device *dev)