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
This commit is contained in:
Rafael J. Wysocki
2013-11-28 23:58:28 +01:00
parent 11dcc75dba
commit 9c5ad36d98
5 changed files with 21 additions and 24 deletions

View File

@@ -149,6 +149,7 @@ struct acpi_device *acpi_find_child_device(struct acpi_device *parent,
}
return ret;
}
EXPORT_SYMBOL_GPL(acpi_find_child_device);
acpi_handle acpi_get_child(acpi_handle handle, u64 addr)
{
@@ -298,15 +299,6 @@ int acpi_unbind_one(struct device *dev)
}
EXPORT_SYMBOL_GPL(acpi_unbind_one);
void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr)
{
struct acpi_device *adev;
if (!acpi_bus_get_device(acpi_get_child(parent, addr), &adev))
ACPI_COMPANION_SET(dev, adev);
}
EXPORT_SYMBOL_GPL(acpi_preset_companion);
static int acpi_platform_notify(struct device *dev)
{
struct acpi_bus_type *type = acpi_get_bus_type(dev);