]> git.baikalelectronics.ru Git - kernel.git/commit
device property: Make it possible to use secondary firmware nodes
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 3 Apr 2015 21:23:37 +0000 (23:23 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 3 Apr 2015 21:23:37 +0000 (23:23 +0200)
commit6b0ad02ad1c711d12a588d63c400ecc772a1f847
tree3504372747c1610d89f5e3909667603beaf1a335
parent1a90225dd2f1d9d864f4fd8fb099a22bb3085dec
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>
drivers/base/core.c
include/linux/acpi.h
include/linux/device.h
include/linux/fwnode.h