Commit 0529c159 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

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: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 9ac7849e
...@@ -1792,8 +1792,7 @@ static void ahci_remove_one (struct pci_dev *pdev) ...@@ -1792,8 +1792,7 @@ static void ahci_remove_one (struct pci_dev *pdev)
unsigned int i; unsigned int i;
int have_msi; int have_msi;
for (i = 0; i < host->n_ports; i++) ata_host_detach(host);
ata_port_detach(host->ports[i]);
have_msi = hpriv->flags & AHCI_FLAG_MSI; have_msi = hpriv->flags & AHCI_FLAG_MSI;
free_irq(host->irq, host); free_irq(host->irq, host);
......
...@@ -5991,6 +5991,23 @@ void ata_port_detach(struct ata_port *ap) ...@@ -5991,6 +5991,23 @@ void ata_port_detach(struct ata_port *ap)
scsi_remove_host(ap->scsi_host); scsi_remove_host(ap->scsi_host);
} }
/**
* 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 * ata_host_remove - PCI layer callback for device removal
* @host: ATA host set that was removed * @host: ATA host set that was removed
...@@ -6006,8 +6023,7 @@ void ata_host_remove(struct ata_host *host) ...@@ -6006,8 +6023,7 @@ void ata_host_remove(struct ata_host *host)
{ {
unsigned int i; unsigned int i;
for (i = 0; i < host->n_ports; i++) ata_host_detach(host);
ata_port_detach(host->ports[i]);
free_irq(host->irq, host); free_irq(host->irq, host);
if (host->irq2) if (host->irq2)
...@@ -6382,7 +6398,7 @@ EXPORT_SYMBOL_GPL(ata_std_bios_param); ...@@ -6382,7 +6398,7 @@ EXPORT_SYMBOL_GPL(ata_std_bios_param);
EXPORT_SYMBOL_GPL(ata_std_ports); EXPORT_SYMBOL_GPL(ata_std_ports);
EXPORT_SYMBOL_GPL(ata_host_init); EXPORT_SYMBOL_GPL(ata_host_init);
EXPORT_SYMBOL_GPL(ata_device_add); 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_host_remove);
EXPORT_SYMBOL_GPL(ata_sg_init); EXPORT_SYMBOL_GPL(ata_sg_init);
EXPORT_SYMBOL_GPL(ata_sg_init_one); EXPORT_SYMBOL_GPL(ata_sg_init_one);
......
...@@ -719,7 +719,7 @@ extern int ata_pci_device_resume(struct pci_dev *pdev); ...@@ -719,7 +719,7 @@ extern int ata_pci_device_resume(struct pci_dev *pdev);
extern int ata_pci_clear_simplex(struct pci_dev *pdev); extern int ata_pci_clear_simplex(struct pci_dev *pdev);
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
extern int ata_device_add(const struct ata_probe_ent *ent); extern int ata_device_add(const struct ata_probe_ent *ent);
extern void ata_port_detach(struct ata_port *ap); extern void ata_host_detach(struct ata_host *host);
extern void ata_host_init(struct ata_host *, struct device *, extern void ata_host_init(struct ata_host *, struct device *,
unsigned long, const struct ata_port_operations *); unsigned long, const struct ata_port_operations *);
extern void ata_host_remove(struct ata_host *host); extern void ata_host_remove(struct ata_host *host);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment