aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-01-20 02:00:28 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-09 17:39:37 -0500
commitf0d36efdc624beb3d9e29b9ab9e9537bf0f25d5b (patch)
treeeac4efb465aa682d6eaac61f76b3174ffd9fd8cd /drivers/ata/ahci.c
parent0529c159dbdd79794796c1b50b39442d72efbe97 (diff)
libata: update libata core layer to use devres
Update libata core layer to use devres. * ata_device_add() acquires all resources in managed mode. * ata_host is allocated as devres associated with ata_host_release. * Port attached status is handled as devres associated with ata_host_attach_release(). * Initialization failure and host removal is handedl by releasing devres group. * Except for ata_scsi_release() removal, LLD interface remains the same. Some functions use hacky is_managed test to support both managed and unmanaged devices. These will go away once all LLDs are updated to use devres. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 649dfa57e51c..d72568392e6c 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1784,37 +1784,24 @@ err_out:
1784 return rc; 1784 return rc;
1785} 1785}
1786 1786
1787static void ahci_remove_one (struct pci_dev *pdev) 1787static void ahci_remove_one(struct pci_dev *pdev)
1788{ 1788{
1789 struct device *dev = pci_dev_to_dev(pdev); 1789 struct device *dev = pci_dev_to_dev(pdev);
1790 struct ata_host *host = dev_get_drvdata(dev); 1790 struct ata_host *host = dev_get_drvdata(dev);
1791 struct ahci_host_priv *hpriv = host->private_data; 1791 struct ahci_host_priv *hpriv = host->private_data;
1792 unsigned int i;
1793 int have_msi;
1794 1792
1795 ata_host_detach(host); 1793 ata_host_remove(host);
1796 1794
1797 have_msi = hpriv->flags & AHCI_FLAG_MSI;
1798 free_irq(host->irq, host);
1799
1800 for (i = 0; i < host->n_ports; i++) {
1801 struct ata_port *ap = host->ports[i];
1802
1803 ata_scsi_release(ap->scsi_host);
1804 scsi_host_put(ap->scsi_host);
1805 }
1806
1807 kfree(hpriv);
1808 pci_iounmap(pdev, host->mmio_base); 1795 pci_iounmap(pdev, host->mmio_base);
1809 kfree(host);
1810 1796
1811 if (have_msi) 1797 if (hpriv->flags & AHCI_FLAG_MSI)
1812 pci_disable_msi(pdev); 1798 pci_disable_msi(pdev);
1813 else 1799 else
1814 pci_intx(pdev, 0); 1800 pci_intx(pdev, 0);
1815 pci_release_regions(pdev); 1801 pci_release_regions(pdev);
1816 pci_disable_device(pdev); 1802 pci_disable_device(pdev);
1817 dev_set_drvdata(dev, NULL); 1803 dev_set_drvdata(dev, NULL);
1804 kfree(hpriv);
1818} 1805}
1819 1806
1820static int __init ahci_init(void) 1807static int __init ahci_init(void)