ata: libata-core: Synchronize ata_port_detach() with hotplug
[linux-2.6-microblaze.git] / drivers / ata / libata-core.c
index 5afd30d..2b7b88e 100644 (file)
@@ -6065,6 +6065,9 @@ static void ata_port_detach(struct ata_port *ap)
        struct ata_link *link;
        struct ata_device *dev;
 
+       /* Ensure ata_port probe has completed */
+       async_synchronize_cookie(ap->cookie + 1);
+
        /* Wait for any ongoing EH */
        ata_port_wait_eh(ap);
 
@@ -6129,11 +6132,8 @@ void ata_host_detach(struct ata_host *host)
 {
        int i;
 
-       for (i = 0; i < host->n_ports; i++) {
-               /* Ensure ata_port probe has completed */
-               async_synchronize_cookie(host->ports[i]->cookie + 1);
+       for (i = 0; i < host->n_ports; i++)
                ata_port_detach(host->ports[i]);
-       }
 
        /* the host is dead now, dissociate ACPI */
        ata_acpi_dissociate(host);