summaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-01-20 16:00:26 +0900
committerJeff Garzik <jeff@garzik.org>2007-02-09 17:39:37 -0500
commit0529c159dbdd79794796c1b50b39442d72efbe97 (patch)
tree417e2285c048ca582ba6e1f40119930c460250ad /drivers/ata
parent9ac7849e35f705830f7b016ff272b0ff1f7ff759 (diff)
downloadlinux-0529c159dbdd79794796c1b50b39442d72efbe97.tar.gz
linux-0529c159dbdd79794796c1b50b39442d72efbe97.tar.bz2
linux-0529c159dbdd79794796c1b50b39442d72efbe97.zip
libata: implement ata_host_detach()
Implement ata_host_detach() which calls ata_port_detach() for each port in the host and export it. ata_port_detach() is now internal and thus un-exported. ata_host_detach() will be used as the 'deregister from libata layer' function after devres conversion. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c3
-rw-r--r--drivers/ata/libata-core.c22
2 files changed, 20 insertions, 5 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 03b7a0051887..649dfa57e51c 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1792,8 +1792,7 @@ static void ahci_remove_one (struct pci_dev *pdev)
unsigned int i;
int have_msi;
- for (i = 0; i < host->n_ports; i++)
- ata_port_detach(host->ports[i]);
+ ata_host_detach(host);
have_msi = hpriv->flags & AHCI_FLAG_MSI;
free_irq(host->irq, host);
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 781d0959a228..a927c4c8bef3 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5992,6 +5992,23 @@ void ata_port_detach(struct ata_port *ap)
}
/**
+ * ata_host_detach - Detach all ports of an ATA host
+ * @host: Host to detach
+ *
+ * Detach all ports of @host.
+ *
+ * LOCKING:
+ * Kernel thread context (may sleep).
+ */
+void ata_host_detach(struct ata_host *host)
+{
+ int i;
+
+ for (i = 0; i < host->n_ports; i++)
+ ata_port_detach(host->ports[i]);
+}
+
+/**
* ata_host_remove - PCI layer callback for device removal
* @host: ATA host set that was removed
*
@@ -6006,8 +6023,7 @@ void ata_host_remove(struct ata_host *host)
{
unsigned int i;
- for (i = 0; i < host->n_ports; i++)
- ata_port_detach(host->ports[i]);
+ ata_host_detach(host);
free_irq(host->irq, host);
if (host->irq2)
@@ -6382,7 +6398,7 @@ EXPORT_SYMBOL_GPL(ata_std_bios_param);
EXPORT_SYMBOL_GPL(ata_std_ports);
EXPORT_SYMBOL_GPL(ata_host_init);
EXPORT_SYMBOL_GPL(ata_device_add);
-EXPORT_SYMBOL_GPL(ata_port_detach);
+EXPORT_SYMBOL_GPL(ata_host_detach);
EXPORT_SYMBOL_GPL(ata_host_remove);
EXPORT_SYMBOL_GPL(ata_sg_init);
EXPORT_SYMBOL_GPL(ata_sg_init_one);