From 96f9b8389082133c7d79d631e3c03a1a272b35d3 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Sat, 20 Jan 2007 16:00:26 +0900 Subject: [PATCH] --- yaml --- r: 47365 b: refs/heads/master c: 0529c159dbdd79794796c1b50b39442d72efbe97 h: refs/heads/master i: 47363: c842ebbe53a65c5a244424f2eade8f69085f86c3 v: v3 --- [refs] | 2 +- trunk/drivers/ata/ahci.c | 3 +-- trunk/drivers/ata/libata-core.c | 22 +++++++++++++++++++--- trunk/include/linux/libata.h | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index ae8f148b538a..d497c73e64f3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9ac7849e35f705830f7b016ff272b0ff1f7ff759 +refs/heads/master: 0529c159dbdd79794796c1b50b39442d72efbe97 diff --git a/trunk/drivers/ata/ahci.c b/trunk/drivers/ata/ahci.c index 03b7a0051887..649dfa57e51c 100644 --- a/trunk/drivers/ata/ahci.c +++ b/trunk/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/trunk/drivers/ata/libata-core.c b/trunk/drivers/ata/libata-core.c index 781d0959a228..a927c4c8bef3 100644 --- a/trunk/drivers/ata/libata-core.c +++ b/trunk/drivers/ata/libata-core.c @@ -5991,6 +5991,23 @@ void ata_port_detach(struct ata_port *ap) 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 * @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); diff --git a/trunk/include/linux/libata.h b/trunk/include/linux/libata.h index a2458dfefb17..e9a0cfdcfe2c 100644 --- a/trunk/include/linux/libata.h +++ b/trunk/include/linux/libata.h @@ -719,7 +719,7 @@ extern int ata_pci_device_resume(struct pci_dev *pdev); extern int ata_pci_clear_simplex(struct pci_dev *pdev); #endif /* CONFIG_PCI */ 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 *, unsigned long, const struct ata_port_operations *); extern void ata_host_remove(struct ata_host *host);