libata: update libata LLDs to use devres
authorTejun Heo <htejun@gmail.com>
Sat, 20 Jan 2007 07:00:28 +0000 (16:00 +0900)
committerJeff Garzik <jeff@garzik.org>
Fri, 9 Feb 2007 22:39:37 +0000 (17:39 -0500)
Update libata LLDs to use devres.  Core layer is already converted to
support managed LLDs.  This patch simplifies initialization and fixes
many resource related bugs in init failure and detach path.  For
example, all converted drivers now handle ata_device_add() failure
gracefully without excessive resource rollback code.

As most resources are released automatically on driver detach, many
drivers don't need or can do with much simpler ->{port|host}_stop().
In general, stop callbacks are need iff port or host needs to be given
commands to shut it down.  Note that freezing is enough in many cases
and ports are automatically frozen before being detached.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
59 files changed:
drivers/ata/ahci.c
drivers/ata/ata_generic.c
drivers/ata/ata_piix.c
drivers/ata/pata_ali.c
drivers/ata/pata_amd.c
drivers/ata/pata_artop.c
drivers/ata/pata_atiixp.c
drivers/ata/pata_cmd64x.c
drivers/ata/pata_cs5520.c
drivers/ata/pata_cs5530.c
drivers/ata/pata_cs5535.c
drivers/ata/pata_cypress.c
drivers/ata/pata_efar.c
drivers/ata/pata_hpt366.c
drivers/ata/pata_hpt37x.c
drivers/ata/pata_hpt3x2n.c
drivers/ata/pata_hpt3x3.c
drivers/ata/pata_isapnp.c
drivers/ata/pata_it8213.c
drivers/ata/pata_it821x.c
drivers/ata/pata_ixp4xx_cf.c
drivers/ata/pata_jmicron.c
drivers/ata/pata_legacy.c
drivers/ata/pata_marvell.c
drivers/ata/pata_mpc52xx.c
drivers/ata/pata_mpiix.c
drivers/ata/pata_netcell.c
drivers/ata/pata_ns87410.c
drivers/ata/pata_oldpiix.c
drivers/ata/pata_opti.c
drivers/ata/pata_optidma.c
drivers/ata/pata_pcmcia.c
drivers/ata/pata_pdc2027x.c
drivers/ata/pata_pdc202xx_old.c
drivers/ata/pata_qdi.c
drivers/ata/pata_radisys.c
drivers/ata/pata_rz1000.c
drivers/ata/pata_sc1200.c
drivers/ata/pata_serverworks.c
drivers/ata/pata_sil680.c
drivers/ata/pata_sis.c
drivers/ata/pata_sl82c105.c
drivers/ata/pata_triflex.c
drivers/ata/pata_via.c
drivers/ata/pata_winbond.c
drivers/ata/pdc_adma.c
drivers/ata/sata_inic162x.c
drivers/ata/sata_mv.c
drivers/ata/sata_nv.c
drivers/ata/sata_promise.c
drivers/ata/sata_qstor.c
drivers/ata/sata_sil.c
drivers/ata/sata_sil24.c
drivers/ata/sata_sis.c
drivers/ata/sata_svw.c
drivers/ata/sata_sx4.c
drivers/ata/sata_uli.c
drivers/ata/sata_via.c
drivers/ata/sata_vsc.c

index d725683..20ab3ff 100644 (file)
@@ -45,7 +45,6 @@
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_cmnd.h>
 #include <linux/libata.h>
-#include <asm/io.h>
 
 #define DRV_NAME       "ahci"
 #define DRV_VERSION    "2.0"
@@ -166,9 +165,6 @@ enum {
        PORT_CMD_ICC_PARTIAL    = (0x2 << 28), /* Put i/f in partial state */
        PORT_CMD_ICC_SLUMBER    = (0x6 << 28), /* Put i/f in slumber state */
 
-       /* hpriv->flags bits */
-       AHCI_FLAG_MSI           = (1 << 0),
-
        /* ap->flags bits */
        AHCI_FLAG_NO_NCQ                = (1 << 24),
        AHCI_FLAG_IGN_IRQ_IF_ERR        = (1 << 25), /* ignore IRQ_IF_ERR */
@@ -191,7 +187,6 @@ struct ahci_sg {
 };
 
 struct ahci_host_priv {
-       unsigned long           flags;
        u32                     cap;    /* cache of HOST_CAP register */
        u32                     port_map; /* cache of HOST_PORTS_IMPL reg */
 };
@@ -229,7 +224,6 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
 static int ahci_port_resume(struct ata_port *ap);
 static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
 static int ahci_pci_device_resume(struct pci_dev *pdev);
-static void ahci_remove_one (struct pci_dev *pdev);
 
 static struct scsi_host_template ahci_sht = {
        .module                 = THIS_MODULE,
@@ -441,9 +435,9 @@ static struct pci_driver ahci_pci_driver = {
        .name                   = DRV_NAME,
        .id_table               = ahci_pci_tbl,
        .probe                  = ahci_init_one,
+       .remove                 = ata_pci_remove_one,
        .suspend                = ahci_pci_device_suspend,
        .resume                 = ahci_pci_device_resume,
-       .remove                 = ahci_remove_one,
 };
 
 
@@ -1426,23 +1420,18 @@ static int ahci_port_start(struct ata_port *ap)
        dma_addr_t mem_dma;
        int rc;
 
-       pp = kmalloc(sizeof(*pp), GFP_KERNEL);
+       pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
        if (!pp)
                return -ENOMEM;
-       memset(pp, 0, sizeof(*pp));
 
        rc = ata_pad_alloc(ap, dev);
-       if (rc) {
-               kfree(pp);
+       if (rc)
                return rc;
-       }
 
-       mem = dma_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, GFP_KERNEL);
-       if (!mem) {
-               ata_pad_free(ap, dev);
-               kfree(pp);
+       mem = dmam_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma,
+                                 GFP_KERNEL);
+       if (!mem)
                return -ENOMEM;
-       }
        memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ);
 
        /*
@@ -1484,9 +1473,7 @@ static int ahci_port_start(struct ata_port *ap)
 
 static void ahci_port_stop(struct ata_port *ap)
 {
-       struct device *dev = ap->host->dev;
        struct ahci_host_priv *hpriv = ap->host->private_data;
-       struct ahci_port_priv *pp = ap->private_data;
        void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
        const char *emsg = NULL;
@@ -1496,12 +1483,6 @@ static void ahci_port_stop(struct ata_port *ap)
        rc = ahci_deinit_port(port_mmio, hpriv->cap, &emsg);
        if (rc)
                ata_port_printk(ap, KERN_WARNING, "%s (%d)\n", emsg, rc);
-
-       ap->private_data = NULL;
-       dma_free_coherent(dev, AHCI_PORT_PRIV_DMA_SZ,
-                         pp->cmd_slot, pp->cmd_slot_dma);
-       ata_pad_free(ap, dev);
-       kfree(pp);
 }
 
 static void ahci_setup_port(struct ata_ioports *port, unsigned long base,
@@ -1669,15 +1650,15 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent)
                );
 }
 
-static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
+static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        static int printed_version;
-       struct ata_probe_ent *probe_ent = NULL;
+       unsigned int board_idx = (unsigned int) ent->driver_data;
+       struct device *dev = &pdev->dev;
+       struct ata_probe_ent *probe_ent;
        struct ahci_host_priv *hpriv;
        unsigned long base;
        void __iomem *mmio_base;
-       unsigned int board_idx = (unsigned int) ent->driver_data;
-       int have_msi, pci_dev_busy = 0;
        int rc;
 
        VPRINTK("ENTER\n");
@@ -1694,46 +1675,34 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
                        return -ENODEV;
        }
 
-       rc = pci_enable_device(pdev);
+       rc = pcim_enable_device(pdev);
        if (rc)
                return rc;
 
        rc = pci_request_regions(pdev, DRV_NAME);
        if (rc) {
-               pci_dev_busy = 1;
-               goto err_out;
+               pcim_pin_device(pdev);
+               return rc;
        }
 
-       if (pci_enable_msi(pdev) == 0)
-               have_msi = 1;
-       else {
+       if (pci_enable_msi(pdev))
                pci_intx(pdev, 1);
-               have_msi = 0;
-       }
 
-       probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL);
-       if (probe_ent == NULL) {
-               rc = -ENOMEM;
-               goto err_out_msi;
-       }
+       probe_ent = devm_kzalloc(dev, sizeof(*probe_ent), GFP_KERNEL);
+       if (probe_ent == NULL)
+               return -ENOMEM;
 
-       memset(probe_ent, 0, sizeof(*probe_ent));
        probe_ent->dev = pci_dev_to_dev(pdev);
        INIT_LIST_HEAD(&probe_ent->node);
 
-       mmio_base = pci_iomap(pdev, AHCI_PCI_BAR, 0);
-       if (mmio_base == NULL) {
-               rc = -ENOMEM;
-               goto err_out_free_ent;
-       }
+       mmio_base = pcim_iomap(pdev, AHCI_PCI_BAR, 0);
+       if (mmio_base == NULL)
+               return -ENOMEM;
        base = (unsigned long) mmio_base;
 
-       hpriv = kmalloc(sizeof(*hpriv), GFP_KERNEL);
-       if (!hpriv) {
-               rc = -ENOMEM;
-               goto err_out_iounmap;
-       }
-       memset(hpriv, 0, sizeof(*hpriv));
+       hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
+       if (!hpriv)
+               return -ENOMEM;
 
        probe_ent->sht          = ahci_port_info[board_idx].sht;
        probe_ent->port_flags   = ahci_port_info[board_idx].flags;
@@ -1746,13 +1715,10 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        probe_ent->mmio_base = mmio_base;
        probe_ent->private_data = hpriv;
 
-       if (have_msi)
-               hpriv->flags |= AHCI_FLAG_MSI;
-
        /* initialize adapter */
        rc = ahci_host_init(probe_ent);
        if (rc)
-               goto err_out_hpriv;
+               return rc;
 
        if (!(probe_ent->port_flags & AHCI_FLAG_NO_NCQ) &&
            (hpriv->cap & HOST_CAP_NCQ))
@@ -1760,48 +1726,11 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 
        ahci_print_info(probe_ent);
 
-       /* FIXME: check ata_device_add return value */
-       ata_device_add(probe_ent);
-       kfree(probe_ent);
+       if (!ata_device_add(probe_ent))
+               return -ENODEV;
 
+       devm_kfree(dev, probe_ent);
        return 0;
-
-err_out_hpriv:
-       kfree(hpriv);
-err_out_iounmap:
-       pci_iounmap(pdev, mmio_base);
-err_out_free_ent:
-       kfree(probe_ent);
-err_out_msi:
-       if (have_msi)
-               pci_disable_msi(pdev);
-       else
-               pci_intx(pdev, 0);
-       pci_release_regions(pdev);
-err_out:
-       if (!pci_dev_busy)
-               pci_disable_device(pdev);
-       return rc;
-}
-
-static void ahci_remove_one(struct pci_dev *pdev)
-{
-       struct device *dev = pci_dev_to_dev(pdev);
-       struct ata_host *host = dev_get_drvdata(dev);
-       struct ahci_host_priv *hpriv = host->private_data;
-
-       ata_host_remove(host);
-
-       pci_iounmap(pdev, host->mmio_base);
-
-       if (hpriv->flags & AHCI_FLAG_MSI)
-               pci_disable_msi(pdev);
-       else
-               pci_intx(pdev, 0);
-       pci_release_regions(pdev);
-       pci_disable_device(pdev);
-       dev_set_drvdata(dev, NULL);
-       kfree(hpriv);
 }
 
 static int __init ahci_init(void)
index 24af560..a25cbd6 100644 (file)
@@ -152,8 +152,6 @@ static struct ata_port_operations generic_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static int all_generic_ide;            /* Set to claim all devices */
index f15ef88..c6bf1a3 100644 (file)
@@ -154,7 +154,6 @@ struct piix_host_priv {
 
 static int piix_init_one (struct pci_dev *pdev,
                                    const struct pci_device_id *ent);
-static void piix_host_stop(struct ata_host *host);
 static void piix_pata_error_handler(struct ata_port *ap);
 static void ich_pata_error_handler(struct ata_port *ap);
 static void piix_sata_error_handler(struct ata_port *ap);
@@ -311,8 +310,6 @@ static const struct ata_port_operations piix_pata_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = piix_host_stop,
 };
 
 static const struct ata_port_operations ich_pata_ops = {
@@ -344,8 +341,6 @@ static const struct ata_port_operations ich_pata_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = piix_host_stop,
 };
 
 static const struct ata_port_operations piix_sata_ops = {
@@ -374,8 +369,6 @@ static const struct ata_port_operations piix_sata_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = piix_host_stop,
 };
 
 static const struct piix_map_db ich5_map_db = {
@@ -1072,6 +1065,7 @@ static void __devinit piix_init_sata_map(struct pci_dev *pdev,
 static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        static int printed_version;
+       struct device *dev = &pdev->dev;
        struct ata_port_info port_info[2];
        struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] };
        struct piix_host_priv *hpriv;
@@ -1085,7 +1079,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        if (!in_module_init)
                return -ENODEV;
 
-       hpriv = kzalloc(sizeof(*hpriv), GFP_KERNEL);
+       hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
        if (!hpriv)
                return -ENOMEM;
 
@@ -1135,15 +1129,6 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        return ata_pci_init_one(pdev, ppinfo, 2);
 }
 
-static void piix_host_stop(struct ata_host *host)
-{
-       struct piix_host_priv *hpriv = host->private_data;
-
-       ata_host_stop(host);
-
-       kfree(hpriv);
-}
-
 static int __init piix_init(void)
 {
        int rc;
index fde5ce9..f4fdb10 100644 (file)
@@ -376,8 +376,6 @@ static struct ata_port_operations ali_early_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -417,8 +415,6 @@ static struct ata_port_operations ali_20_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -455,8 +451,6 @@ static struct ata_port_operations ali_c2_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -492,8 +486,6 @@ static struct ata_port_operations ali_c5_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 
index a6b3300..7ee0c83 100644 (file)
@@ -368,8 +368,6 @@ static struct ata_port_operations amd33_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations amd66_port_ops = {
@@ -402,8 +400,6 @@ static struct ata_port_operations amd66_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations amd100_port_ops = {
@@ -436,8 +432,6 @@ static struct ata_port_operations amd100_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations amd133_port_ops = {
@@ -470,8 +464,6 @@ static struct ata_port_operations amd133_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations nv100_port_ops = {
@@ -504,8 +496,6 @@ static struct ata_port_operations nv100_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations nv133_port_ops = {
@@ -538,8 +528,6 @@ static struct ata_port_operations nv133_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
index 37bc132..5baea12 100644 (file)
@@ -347,8 +347,6 @@ static const struct ata_port_operations artop6210_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_host_stop,
 };
 
 static const struct ata_port_operations artop6260_ops = {
@@ -379,8 +377,6 @@ static const struct ata_port_operations artop6260_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_host_stop,
 };
 
 
index 504e1db..2bfb994 100644 (file)
@@ -258,8 +258,6 @@ static struct ata_port_operations atiixp_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
index 449162c..d97aa9b 100644 (file)
@@ -319,8 +319,6 @@ static struct ata_port_operations cmd64x_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations cmd646r1_port_ops = {
@@ -353,8 +351,6 @@ static struct ata_port_operations cmd646r1_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations cmd648_port_ops = {
@@ -387,8 +383,6 @@ static struct ata_port_operations cmd648_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
index 476b879..63bdcbe 100644 (file)
@@ -199,8 +199,6 @@ static struct ata_port_operations cs5520_port_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_host_stop,
 };
 
 static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id)
@@ -294,7 +292,7 @@ static void __devexit cs5520_remove_one(struct pci_dev *pdev)
        struct device *dev = pci_dev_to_dev(pdev);
        struct ata_host *host = dev_get_drvdata(dev);
 
-       ata_host_remove(host);
+       ata_host_detach(host);
        dev_set_drvdata(dev, NULL);
 }
 
index 611d90f..29d459b 100644 (file)
@@ -216,8 +216,6 @@ static struct ata_port_operations cs5530_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct dmi_system_id palmax_dmi_table[] = {
index e3efec4..dd3958d 100644 (file)
@@ -220,8 +220,6 @@ static struct ata_port_operations cs5535_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /**
index e2a9569..8479186 100644 (file)
@@ -171,8 +171,6 @@ static struct ata_port_operations cy82c693_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
index edf8a63..66814ee 100644 (file)
@@ -267,8 +267,6 @@ static const struct ata_port_operations efar_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_host_stop,
 };
 
 
index 2202c7e..8b82610 100644 (file)
@@ -367,8 +367,6 @@ static struct ata_port_operations hpt366_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /**
index 9e1eb47..09e8be5 100644 (file)
@@ -802,8 +802,6 @@ static struct ata_port_operations hpt370_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -841,8 +839,6 @@ static struct ata_port_operations hpt370a_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -881,8 +877,6 @@ static struct ata_port_operations hpt372_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -921,8 +915,6 @@ static struct ata_port_operations hpt374_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /**
index 886fab9..9f8ec57 100644 (file)
@@ -379,8 +379,6 @@ static struct ata_port_operations hpt3x2n_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /**
index 5caf167..faa2db4 100644 (file)
@@ -154,8 +154,6 @@ static struct ata_port_operations hpt3x3_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /**
index a97d55a..38a42ea 100644 (file)
@@ -59,8 +59,6 @@ static struct ata_port_operations isapnp_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /**
@@ -120,7 +118,7 @@ static void isapnp_remove_one(struct pnp_dev *idev)
        struct device *dev = &idev->dev;
        struct ata_host *host = dev_get_drvdata(dev);
 
-       ata_host_remove(host);
+       ata_host_detach(host);
        dev_set_drvdata(dev, NULL);
 }
 
index 7e9a416..383a611 100644 (file)
@@ -279,8 +279,6 @@ static const struct ata_port_operations it8213_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_host_stop,
 };
 
 
index 171fbd2..f23365b 100644 (file)
@@ -594,14 +594,10 @@ static int it821x_port_start(struct ata_port *ap)
        if (ret < 0)
                return ret;
 
-       ap->private_data = kmalloc(sizeof(struct it821x_dev), GFP_KERNEL);
-       if (ap->private_data == NULL) {
-               ata_port_stop(ap);
+       itdev = devm_kzalloc(&pdev->dev, sizeof(struct it821x_dev), GFP_KERNEL);
+       if (itdev == NULL)
                return -ENOMEM;
-       }
-
-       itdev = ap->private_data;
-       memset(itdev, 0, sizeof(struct it821x_dev));
+       ap->private_data = itdev;
 
        pci_read_config_byte(pdev, 0x50, &conf);
 
@@ -632,20 +628,6 @@ static int it821x_port_start(struct ata_port *ap)
        return 0;
 }
 
-/**
- *     it821x_port_stop        -       port shutdown
- *     @ap: ATA port being removed
- *
- *     Release the private objects we added in it821x_port_start
- */
-
-static void it821x_port_stop(struct ata_port *ap) {
-       kfree(ap->private_data);
-       ap->private_data = NULL;        /* We want an OOPS if we reuse this
-                                          too late! */
-       ata_port_stop(ap);
-}
-
 static struct scsi_host_template it821x_sht = {
        .module                 = THIS_MODULE,
        .name                   = DRV_NAME,
@@ -698,8 +680,6 @@ static struct ata_port_operations it821x_smart_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = it821x_port_start,
-       .port_stop      = it821x_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations it821x_passthru_port_ops = {
@@ -734,8 +714,6 @@ static struct ata_port_operations it821x_passthru_port_ops = {
        .irq_handler    = ata_interrupt,
 
        .port_start     = it821x_port_start,
-       .port_stop      = it821x_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static void __devinit it821x_disable_raid(struct pci_dev *pdev)
index 23b8aab..230067d 100644 (file)
@@ -95,14 +95,6 @@ static void ixp4xx_irq_clear(struct ata_port *ap)
 {
 }
 
-static void ixp4xx_host_stop (struct ata_host *host)
-{
-       struct ixp4xx_pata_data *data = host->dev->platform_data;
-
-       iounmap(data->cs0);
-       iounmap(data->cs1);
-}
-
 static struct scsi_host_template ixp4xx_sht = {
        .module                 = THIS_MODULE,
        .name                   = DRV_NAME,
@@ -141,8 +133,6 @@ static struct ata_port_operations ixp4xx_port_ops = {
        .irq_clear      = ixp4xx_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ixp4xx_host_stop,
 
        .phy_reset      = ixp4xx_phy_reset,
 };
@@ -195,8 +185,8 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
 
        pdev->dev.coherent_dma_mask = DMA_32BIT_MASK;
 
-       data->cs0 = ioremap(cs0->start, 0x1000);
-       data->cs1 = ioremap(cs1->start, 0x1000);
+       data->cs0 = devm_ioremap(&pdev->dev, cs0->start, 0x1000);
+       data->cs1 = devm_ioremap(&pdev->dev, cs1->start, 0x1000);
 
        irq = platform_get_irq(pdev, 0);
        if (irq)
@@ -238,7 +228,7 @@ static __devexit int ixp4xx_pata_remove(struct platform_device *dev)
 {
        struct ata_host *host = platform_get_drvdata(dev);
 
-       ata_host_remove(host);
+       ata_host_detach(host);
        platform_set_drvdata(dev, NULL);
 
        return 0;
index aaf6787..128a309 100644 (file)
@@ -169,8 +169,6 @@ static const struct ata_port_operations jmicron_ops = {
 
        /* Generic PATA PCI ATA helpers */
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_host_stop,
 };
 
 
index 581cb33..9532b9b 100644 (file)
@@ -170,8 +170,6 @@ static struct ata_port_operations simple_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations legacy_port_ops = {
@@ -195,8 +193,6 @@ static struct ata_port_operations legacy_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -305,8 +301,6 @@ static struct ata_port_operations pdc20230_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -357,8 +351,6 @@ static struct ata_port_operations ht6560a_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -420,8 +412,6 @@ static struct ata_port_operations ht6560b_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -538,8 +528,6 @@ static struct ata_port_operations opti82c611a_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /*
@@ -668,8 +656,6 @@ static struct ata_port_operations opti82c46x_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 
@@ -689,21 +675,19 @@ static __init int legacy_init_one(int port, unsigned long io, unsigned long ctrl
        struct legacy_data *ld = &legacy_data[nr_legacy_host];
        struct ata_probe_ent ae;
        struct platform_device *pdev;
-       int ret = -EBUSY;
        struct ata_port_operations *ops = &legacy_port_ops;
        int pio_modes = pio_mask;
        u32 mask = (1 << port);
-
-       if (request_region(io, 8, "pata_legacy") == NULL)
-               return -EBUSY;
-       if (request_region(ctrl, 1, "pata_legacy") == NULL)
-               goto fail_io;
+       int ret;
 
        pdev = platform_device_register_simple(DRV_NAME, nr_legacy_host, NULL, 0);
-       if (IS_ERR(pdev)) {
-               ret = PTR_ERR(pdev);
-               goto fail_dev;
-       }
+       if (IS_ERR(pdev))
+               return PTR_ERR(pdev);
+
+       ret = -EBUSY;
+       if (devm_request_region(&pdev->dev, io, 8, "pata_legacy") == NULL ||
+           devm_request_region(&pdev->dev, ctrl, 1, "pata_legacy") == NULL)
+               goto fail;
 
        if (ht6560a & mask) {
                ops = &ht6560a_port_ops;
@@ -776,21 +760,16 @@ static __init int legacy_init_one(int port, unsigned long io, unsigned long ctrl
        ata_std_ports(&ae.port[0]);
        ae.private_data = ld;
 
-       ret = ata_device_add(&ae);
-       if (ret == 0) {
-               ret = -ENODEV;
+       ret = -ENODEV;
+       if (!ata_device_add(&ae))
                goto fail;
-       }
+
        legacy_host[nr_legacy_host++] = dev_get_drvdata(&pdev->dev);
        ld->platform_dev = pdev;
        return 0;
 
 fail:
        platform_device_unregister(pdev);
-fail_dev:
-       release_region(ctrl, 1);
-fail_io:
-       release_region(io, 8);
        return ret;
 }
 
@@ -923,15 +902,11 @@ static __exit void legacy_exit(void)
 
        for (i = 0; i < nr_legacy_host; i++) {
                struct legacy_data *ld = &legacy_data[i];
-               struct ata_port *ap =legacy_host[i]->ports[0];
-               unsigned long io = ap->ioaddr.cmd_addr;
-               unsigned long ctrl = ap->ioaddr.ctl_addr;
-               ata_host_remove(legacy_host[i]);
+
+               ata_host_detach(legacy_host[i]);
                platform_device_unregister(ld->platform_dev);
                if (ld->timing)
                        release_region(ld->timing, 2);
-               release_region(io, 8);
-               release_region(ctrl, 1);
        }
 }
 
index af93533..0a44095 100644 (file)
@@ -137,8 +137,6 @@ static const struct ata_port_operations marvell_ops = {
 
        /* Generic PATA PCI ATA helpers */
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_host_stop,
 };
 
 
index 8b7019a..5320ea8 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/delay.h>
 #include <linux/libata.h>
 
-#include <asm/io.h>
 #include <asm/types.h>
 #include <asm/prom.h>
 #include <asm/of_platform.h>
@@ -300,8 +299,6 @@ static struct ata_port_operations mpc52xx_ata_port_ops = {
        .irq_handler            = ata_interrupt,
        .irq_clear              = ata_bmdma_irq_clear,
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_host_stop,
 };
 
 static struct ata_probe_ent mpc52xx_ata_probe_ent = {
@@ -353,7 +350,7 @@ mpc52xx_ata_remove_one(struct device *dev)
        struct ata_host *host = dev_get_drvdata(dev);
        struct mpc52xx_ata_priv *priv = host->private_data;
 
-       ata_host_remove(host);
+       ata_host_detach(host);
 
        return priv;
 }
@@ -369,8 +366,8 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match)
        unsigned int ipb_freq;
        struct resource res_mem;
        int ata_irq = NO_IRQ;
-       struct mpc52xx_ata __iomem *ata_regs = NULL;
-       struct mpc52xx_ata_priv *priv = NULL;
+       struct mpc52xx_ata __iomem *ata_regs;
+       struct mpc52xx_ata_priv *priv;
        int rv;
 
        /* Get ipb frequency */
@@ -397,16 +394,17 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match)
        }
 
        /* Request mem region */
-       if (!request_mem_region(res_mem.start,
-                               sizeof(struct mpc52xx_ata), DRV_NAME)) {
+       if (!devm_request_mem_region(&op->dev, res_mem.start,
+                                    sizeof(struct mpc52xx_ata), DRV_NAME)) {
                printk(KERN_ERR DRV_NAME ": "
                        "Error while requesting mem region\n");
-               irq_dispose_mapping(ata_irq);
-               return -EBUSY;
+               rv = -EBUSY;
+               goto err;
        }
 
        /* Remap registers */
-       ata_regs = ioremap(res_mem.start, sizeof(struct mpc52xx_ata));
+       ata_regs = devm_ioremap(&op->dev, res_mem.start,
+                               sizeof(struct mpc52xx_ata));
        if (!ata_regs) {
                printk(KERN_ERR DRV_NAME ": "
                        "Error while mapping register set\n");
@@ -415,7 +413,8 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match)
        }
 
        /* Prepare our private structure */
-       priv = kmalloc(sizeof(struct mpc52xx_ata_priv), GFP_ATOMIC);
+       priv = devm_kzalloc(&op->dev, sizeof(struct mpc52xx_ata_priv),
+                           GFP_ATOMIC);
        if (!priv) {
                printk(KERN_ERR DRV_NAME ": "
                        "Error while allocating private structure\n");
@@ -448,15 +447,7 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match)
 
        /* Error path */
 err:
-       kfree(priv);
-
-       if (ata_regs)
-               iounmap(ata_regs);
-
-       release_mem_region(res_mem.start, sizeof(struct mpc52xx_ata));
-
        irq_dispose_mapping(ata_irq);
-
        return rv;
 }
 
@@ -464,28 +455,10 @@ static int
 mpc52xx_ata_remove(struct of_device *op)
 {
        struct mpc52xx_ata_priv *priv;
-       struct resource res_mem;
-       int rv;
 
-       /* Unregister */
        priv = mpc52xx_ata_remove_one(&op->dev);
-
-       /* Free everything */
-       iounmap(priv->ata_regs);
-
-       rv = of_address_to_resource(op->node, 0, &res_mem);
-       if (rv) {
-               printk(KERN_ERR DRV_NAME ": "
-                       "Error while parsing device node resource\n");
-               printk(KERN_ERR DRV_NAME ": "
-                       "Zone may not be properly released\n");
-       } else
-               release_mem_region(res_mem.start, sizeof(struct mpc52xx_ata));
-
        irq_dispose_mapping(priv->ata_irq);
 
-       kfree(priv);
-
        return 0;
 }
 
index 4ccca93..c4a1b10 100644 (file)
@@ -194,8 +194,6 @@ static struct ata_port_operations mpiix_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
@@ -258,24 +256,6 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
        return -ENODEV;
 }
 
-/**
- *     mpiix_remove_one        -       device unload
- *     @pdev: PCI device being removed
- *
- *     Handle an unplug/unload event for a PCI device. Unload the
- *     PCI driver but do not use the default handler as we *MUST NOT*
- *     disable the device as it has other functions.
- */
-
-static void __devexit mpiix_remove_one(struct pci_dev *pdev)
-{
-       struct device *dev = pci_dev_to_dev(pdev);
-       struct ata_host *host = dev_get_drvdata(dev);
-
-       ata_host_remove(host);
-       dev_set_drvdata(dev, NULL);
-}
-
 static const struct pci_device_id mpiix[] = {
        { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82371MX), },
 
@@ -286,7 +266,7 @@ static struct pci_driver mpiix_pci_driver = {
        .name           = DRV_NAME,
        .id_table       = mpiix,
        .probe          = mpiix_init_one,
-       .remove         = mpiix_remove_one,
+       .remove         = ata_pci_remove_one,
        .suspend        = ata_pci_device_suspend,
        .resume         = ata_pci_device_resume,
 };
index cf7fe03..2a2f8df 100644 (file)
@@ -97,8 +97,6 @@ static const struct ata_port_operations netcell_ops = {
 
        /* Generic PATA PCI ATA helpers */
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_host_stop,
 };
 
 
index c3032eb..fdafd92 100644 (file)
@@ -185,8 +185,6 @@ static struct ata_port_operations ns87410_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id)
index 10ac3cc..df9f7fd 100644 (file)
@@ -265,8 +265,6 @@ static const struct ata_port_operations oldpiix_pata_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_host_stop,
 };
 
 
index c2988b0..58951cc 100644 (file)
@@ -211,8 +211,6 @@ static struct ata_port_operations opti_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id)
index 80d111c..74d2e7a 100644 (file)
@@ -395,8 +395,6 @@ static struct ata_port_operations optidma_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations optiplus_port_ops = {
@@ -430,8 +428,6 @@ static struct ata_port_operations optiplus_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 /**
index 9ed7f58..5a9b249 100644 (file)
@@ -94,8 +94,6 @@ static struct ata_port_operations pcmcia_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 #define CS_CHECK(fn, ret) \
@@ -298,7 +296,7 @@ static void pcmcia_remove_one(struct pcmcia_device *pdev)
                /* If we have attached the device to the ATA layer, detach it */
                if (info->ndev) {
                        struct ata_host *host = dev_get_drvdata(dev);
-                       ata_host_remove(host);
+                       ata_host_detach(host);
                        dev_set_drvdata(dev, NULL);
                }
                info->ndev = 0;
index 76dd1c9..1c106b8 100644 (file)
@@ -33,7 +33,6 @@
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_cmnd.h>
 #include <linux/libata.h>
-#include <asm/io.h>
 
 #define DRV_NAME       "pata_pdc2027x"
 #define DRV_VERSION    "0.74-ac5"
@@ -62,7 +61,6 @@ enum {
 };
 
 static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
-static void pdc2027x_remove_one(struct pci_dev *pdev);
 static void pdc2027x_error_handler(struct ata_port *ap);
 static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev);
 static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev);
@@ -123,7 +121,7 @@ static struct pci_driver pdc2027x_pci_driver = {
        .name                   = DRV_NAME,
        .id_table               = pdc2027x_pci_tbl,
        .probe                  = pdc2027x_init_one,
-       .remove                 = __devexit_p(pdc2027x_remove_one),
+       .remove                 = ata_pci_remove_one,
 };
 
 static struct scsi_host_template pdc2027x_sht = {
@@ -171,8 +169,6 @@ static struct ata_port_operations pdc2027x_pata100_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_pci_host_stop,
 };
 
 static struct ata_port_operations pdc2027x_pata133_ops = {
@@ -205,8 +201,6 @@ static struct ata_port_operations pdc2027x_pata133_ops = {
        .irq_clear              = ata_bmdma_irq_clear,
 
        .port_start             = ata_port_start,
-       .port_stop              = ata_port_stop,
-       .host_stop              = ata_pci_host_stop,
 };
 
 static struct ata_port_info pdc2027x_port_info[] = {
@@ -755,7 +749,7 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de
        static int printed_version;
        unsigned int board_idx = (unsigned int) ent->driver_data;
 
-       struct ata_probe_ent *probe_ent = NULL;
+       struct ata_probe_ent *probe_ent;
        unsigned long base;
        void __iomem *mmio_base;
        int rc;
@@ -763,37 +757,33 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de
        if (!printed_version++)
                dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
 
-       rc = pci_enable_device(pdev);
+       rc = pcim_enable_device(pdev);
        if (rc)
                return rc;
 
        rc = pci_request_regions(pdev, DRV_NAME);
        if (rc)
-               goto err_out;
+               return rc;
 
        rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
        if (rc)
-               goto err_out_regions;
+               return rc;
 
        rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK);
        if (rc)
-               goto err_out_regions;
+               return rc;
 
        /* Prepare the probe entry */
-       probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL);
-       if (probe_ent == NULL) {
-               rc = -ENOMEM;
-               goto err_out_regions;
-       }
+       probe_ent = devm_kzalloc(&pdev->dev, sizeof(*probe_ent), GFP_KERNEL);
+       if (probe_ent == NULL)
+               return -ENOMEM;
 
        probe_ent->dev = pci_dev_to_dev(pdev);
        INIT_LIST_HEAD(&probe_ent->node);
 
-       mmio_base = pci_iomap(pdev, 5, 0);
-       if (!mmio_base) {
-               rc = -ENOMEM;
-               goto err_out_free_ent;
-       }
+       mmio_base = pcim_iomap(pdev, 5, 0);
+       if (!mmio_base)
+               return -ENOMEM;
 
        base = (unsigned long) mmio_base;
 
@@ -820,32 +810,13 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de
 
        /* initialize adapter */
        if (pdc_hardware_init(pdev, probe_ent, board_idx) != 0)
-               goto err_out_free_ent;
+               return -EIO;
 
-       ata_device_add(probe_ent);
-       kfree(probe_ent);
+       if (!ata_device_add(probe_ent))
+               return -ENODEV;
 
+       devm_kfree(&pdev->dev, probe_ent);
        return 0;
-
-err_out_free_ent:
-       kfree(probe_ent);
-err_out_regions:
-       pci_release_regions(pdev);
-err_out:
-       pci_disable_device(pdev);
-       return rc;
-}
-
-/**
- * pdc2027x_remove_one - Called to remove a single instance of the
- * adapter.
- *
- * @dev: The PCI device to remove.
- * FIXME: module load/unload not working yet
- */
-static void __devexit pdc2027x_remove_one(struct pci_dev *pdev)
-{
-       ata_pci_remove_one(pdev);
 }
 
 /**
index ba982ba..c52e1e8 100644 (file)
@@ -300,8 +300,6 @@ static struct ata_port_operations pdc2024x_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static struct ata_port_operations pdc2026x_port_ops = {
@@ -334,8 +332,6 @@ static struct ata_port_operations pdc2026x_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
 
        .port_start     = ata_port_start,
-       .port_stop      = ata_port_stop,
-       .host_stop      = ata_host_stop
 };
 
 static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge