diff options
author | Tejun Heo <htejun@gmail.com> | 2007-01-20 02:00:26 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-09 17:39:37 -0500 |
commit | 0529c159dbdd79794796c1b50b39442d72efbe97 (patch) | |
tree | 417e2285c048ca582ba6e1f40119930c460250ad | |
parent | 9ac7849e35f705830f7b016ff272b0ff1f7ff759 (diff) |
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>
-rw-r--r-- | drivers/ata/ahci.c | 3 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 22 | ||||
-rw-r--r-- | include/linux/libata.h | 2 |
3 files changed, 21 insertions, 6 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) | |||
1792 | unsigned int i; | 1792 | unsigned int i; |
1793 | int have_msi; | 1793 | int have_msi; |
1794 | 1794 | ||
1795 | for (i = 0; i < host->n_ports; i++) | 1795 | ata_host_detach(host); |
1796 | ata_port_detach(host->ports[i]); | ||
1797 | 1796 | ||
1798 | have_msi = hpriv->flags & AHCI_FLAG_MSI; | 1797 | have_msi = hpriv->flags & AHCI_FLAG_MSI; |
1799 | free_irq(host->irq, host); | 1798 | 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) | |||
5992 | } | 5992 | } |
5993 | 5993 | ||
5994 | /** | 5994 | /** |
5995 | * ata_host_detach - Detach all ports of an ATA host | ||
5996 | * @host: Host to detach | ||
5997 | * | ||
5998 | * Detach all ports of @host. | ||
5999 | * | ||
6000 | * LOCKING: | ||
6001 | * Kernel thread context (may sleep). | ||
6002 | */ | ||
6003 | void ata_host_detach(struct ata_host *host) | ||
6004 | { | ||
6005 | int i; | ||
6006 | |||
6007 | for (i = 0; i < host->n_ports; i++) | ||
6008 | ata_port_detach(host->ports[i]); | ||
6009 | } | ||
6010 | |||
6011 | /** | ||
5995 | * ata_host_remove - PCI layer callback for device removal | 6012 | * ata_host_remove - PCI layer callback for device removal |
5996 | * @host: ATA host set that was removed | 6013 | * @host: ATA host set that was removed |
5997 | * | 6014 | * |
@@ -6006,8 +6023,7 @@ void ata_host_remove(struct ata_host *host) | |||
6006 | { | 6023 | { |
6007 | unsigned int i; | 6024 | unsigned int i; |
6008 | 6025 | ||
6009 | for (i = 0; i < host->n_ports; i++) | 6026 | ata_host_detach(host); |
6010 | ata_port_detach(host->ports[i]); | ||
6011 | 6027 | ||
6012 | free_irq(host->irq, host); | 6028 | free_irq(host->irq, host); |
6013 | if (host->irq2) | 6029 | if (host->irq2) |
@@ -6382,7 +6398,7 @@ EXPORT_SYMBOL_GPL(ata_std_bios_param); | |||
6382 | EXPORT_SYMBOL_GPL(ata_std_ports); | 6398 | EXPORT_SYMBOL_GPL(ata_std_ports); |
6383 | EXPORT_SYMBOL_GPL(ata_host_init); | 6399 | EXPORT_SYMBOL_GPL(ata_host_init); |
6384 | EXPORT_SYMBOL_GPL(ata_device_add); | 6400 | EXPORT_SYMBOL_GPL(ata_device_add); |
6385 | EXPORT_SYMBOL_GPL(ata_port_detach); | 6401 | EXPORT_SYMBOL_GPL(ata_host_detach); |
6386 | EXPORT_SYMBOL_GPL(ata_host_remove); | 6402 | EXPORT_SYMBOL_GPL(ata_host_remove); |
6387 | EXPORT_SYMBOL_GPL(ata_sg_init); | 6403 | EXPORT_SYMBOL_GPL(ata_sg_init); |
6388 | EXPORT_SYMBOL_GPL(ata_sg_init_one); | 6404 | EXPORT_SYMBOL_GPL(ata_sg_init_one); |
diff --git a/include/linux/libata.h b/include/linux/libata.h index a2458dfefb17..e9a0cfdcfe2c 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -719,7 +719,7 @@ extern int ata_pci_device_resume(struct pci_dev *pdev); | |||
719 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | 719 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); |
720 | #endif /* CONFIG_PCI */ | 720 | #endif /* CONFIG_PCI */ |
721 | extern int ata_device_add(const struct ata_probe_ent *ent); | 721 | extern int ata_device_add(const struct ata_probe_ent *ent); |
722 | extern void ata_port_detach(struct ata_port *ap); | 722 | extern void ata_host_detach(struct ata_host *host); |
723 | extern void ata_host_init(struct ata_host *, struct device *, | 723 | extern void ata_host_init(struct ata_host *, struct device *, |
724 | unsigned long, const struct ata_port_operations *); | 724 | unsigned long, const struct ata_port_operations *); |
725 | extern void ata_host_remove(struct ata_host *host); | 725 | extern void ata_host_remove(struct ata_host *host); |