summaryrefslogtreecommitdiffstats
path: root/include/linux/acpi.h
diff options
context:
space:
mode:
authorRafael J. Wysocki2013-11-28 23:58:28 +0100
committerRafael J. Wysocki2013-12-07 01:05:49 +0100
commit9c5ad36d987a1b06f6b0b9dc7bc61a45d277455d (patch)
treef62910cb67ab6912ae1d753a0940f76bb3f47e00 /include/linux/acpi.h
parentACPI / bind: Redefine acpi_get_child() (diff)
downloadkernel-qcow2-linux-9c5ad36d987a1b06f6b0b9dc7bc61a45d277455d.tar.gz
kernel-qcow2-linux-9c5ad36d987a1b06f6b0b9dc7bc61a45d277455d.tar.xz
kernel-qcow2-linux-9c5ad36d987a1b06f6b0b9dc7bc61a45d277455d.zip
ACPI / bind: Redefine acpi_preset_companion()
Modify acpi_preset_companion() to take a struct acpi_device pointer instead of an ACPI handle as its second argument and redefine it as a static inline wrapper around ACPI_COMPANION_SET() passing the return value of acpi_find_child_device() directly as the second argument to it. Update its users to pass struct acpi_device pointers instead of ACPI handles to it. This allows some unnecessary acpi_bus_get_device() calls to be avoided. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Aaron Lu <aaron.lu@intel.com> Tested-by: Aaron Lu <aaron.lu@intel.com> # for ATA binding
Diffstat (limited to 'include/linux/acpi.h')
-rw-r--r--include/linux/acpi.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index d9099b15b472..115c610324d1 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -53,6 +53,12 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
#define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev)
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
+static inline void acpi_preset_companion(struct device *dev,
+ struct acpi_device *parent, u64 addr)
+{
+ ACPI_COMPANION_SET(dev, acpi_find_child_device(parent, addr, NULL));
+}
+
static inline const char *acpi_dev_name(struct acpi_device *adev)
{
return dev_name(&adev->dev);