@@ -978,7 +978,7 @@ void ata_acpi_on_disable(struct ata_device *dev)
static int compat_pci_ata(struct ata_port *ap)
{
- struct device *dev = ap->tdev.parent;
+ struct device *dev = ap->host->dev;
struct pci_dev *pdev;
if (!is_pci_dev(dev))
@@ -998,7 +998,7 @@ static int ata_acpi_bind_host(struct ata_port *ap, acpi_handle *handle)
if (ap->flags & ATA_FLAG_ACPI_SATA)
return -ENODEV;
- *handle = acpi_get_child(DEVICE_ACPI_HANDLE(ap->tdev.parent),
+ *handle = acpi_get_child(DEVICE_ACPI_HANDLE(ap->host->dev),
ap->port_no);
if (!*handle)
@@ -1061,7 +1061,12 @@ static struct ata_port *dev_to_ata_port(struct device *dev)
static int ata_acpi_find_device(struct device *dev, acpi_handle *handle)
{
- struct ata_port *ap = dev_to_ata_port(dev);
+ struct ata_port *ap;
+
+ if (scsi_is_host_device(dev))
+ ap = ata_shost_to_port(dev_to_shost(dev));
+ else
+ ap = dev_to_ata_port(dev);
if (!ap)
return -ENODEV;
And to make zero power ODD function, the following changes to enable
runtime pm with no callbacks for the ata_link/ata_device transport
devices are necessary.
@@ -421,6 +421,10 @@ int ata_tlink_add(struct ata_link *link)
goto tlink_err;
}
+ pm_runtime_no_callbacks(dev);
+ pm_runtime_set_active(dev);
+ pm_runtime_enable(dev);
+
transport_add_device(dev);
transport_configure_device(dev);
@@ -649,6 +653,10 @@ static int ata_tdev_add(struct ata_device *ata_dev)
return error;
}
+ pm_runtime_no_callbacks(dev);
+ pm_runtime_set_active(dev);
+ pm_runtime_enable(dev);
+
transport_add_device(dev);
transport_configure_device(dev);
return 0;