mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Reviewed-by: Aaron Lu <[email protected]> Tested-by: Aaron Lu <[email protected]> # for ATA binding
This commit is contained in:
parent
11dcc75dba
commit
9c5ad36d98
5 changed files with 21 additions and 24 deletions
|
|
@ -178,12 +178,12 @@ static const struct acpi_dock_ops ata_acpi_ap_dock_ops = {
|
|||
/* bind acpi handle to pata port */
|
||||
void ata_acpi_bind_port(struct ata_port *ap)
|
||||
{
|
||||
acpi_handle host_handle = ACPI_HANDLE(ap->host->dev);
|
||||
struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev);
|
||||
|
||||
if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_handle)
|
||||
if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_companion)
|
||||
return;
|
||||
|
||||
acpi_preset_companion(&ap->tdev, host_handle, ap->port_no);
|
||||
acpi_preset_companion(&ap->tdev, host_companion, ap->port_no);
|
||||
|
||||
if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0)
|
||||
ap->pflags |= ATA_PFLAG_INIT_GTM_VALID;
|
||||
|
|
@ -196,17 +196,17 @@ void ata_acpi_bind_port(struct ata_port *ap)
|
|||
void ata_acpi_bind_dev(struct ata_device *dev)
|
||||
{
|
||||
struct ata_port *ap = dev->link->ap;
|
||||
acpi_handle port_handle = ACPI_HANDLE(&ap->tdev);
|
||||
acpi_handle host_handle = ACPI_HANDLE(ap->host->dev);
|
||||
acpi_handle parent_handle;
|
||||
struct acpi_device *port_companion = ACPI_COMPANION(&ap->tdev);
|
||||
struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev);
|
||||
struct acpi_device *parent;
|
||||
u64 adr;
|
||||
|
||||
/*
|
||||
* For both sata/pata devices, host handle is required.
|
||||
* For pata device, port handle is also required.
|
||||
* For both sata/pata devices, host companion device is required.
|
||||
* For pata device, port companion device is also required.
|
||||
*/
|
||||
if (libata_noacpi || !host_handle ||
|
||||
(!(ap->flags & ATA_FLAG_ACPI_SATA) && !port_handle))
|
||||
if (libata_noacpi || !host_companion ||
|
||||
(!(ap->flags & ATA_FLAG_ACPI_SATA) && !port_companion))
|
||||
return;
|
||||
|
||||
if (ap->flags & ATA_FLAG_ACPI_SATA) {
|
||||
|
|
@ -214,13 +214,13 @@ void ata_acpi_bind_dev(struct ata_device *dev)
|
|||
adr = SATA_ADR(ap->port_no, NO_PORT_MULT);
|
||||
else
|
||||
adr = SATA_ADR(ap->port_no, dev->link->pmp);
|
||||
parent_handle = host_handle;
|
||||
parent = host_companion;
|
||||
} else {
|
||||
adr = dev->devno;
|
||||
parent_handle = port_handle;
|
||||
parent = port_companion;
|
||||
}
|
||||
|
||||
acpi_preset_companion(&dev->tdev, parent_handle, adr);
|
||||
acpi_preset_companion(&dev->tdev, parent, adr);
|
||||
|
||||
register_hotplug_dock_device(ata_dev_acpi_handle(dev),
|
||||
&ata_acpi_dev_dock_ops, dev, NULL, NULL);
|
||||
|
|
|
|||
Loading…
Reference in a new issue