aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_pdc2027x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_pdc2027x.c')
-rw-r--r--drivers/ata/pata_pdc2027x.c61
1 files changed, 16 insertions, 45 deletions
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index 76dd1c935dbd..1c106b866c79 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -33,7 +33,6 @@
33#include <scsi/scsi_host.h> 33#include <scsi/scsi_host.h>
34#include <scsi/scsi_cmnd.h> 34#include <scsi/scsi_cmnd.h>
35#include <linux/libata.h> 35#include <linux/libata.h>
36#include <asm/io.h>
37 36
38#define DRV_NAME "pata_pdc2027x" 37#define DRV_NAME "pata_pdc2027x"
39#define DRV_VERSION "0.74-ac5" 38#define DRV_VERSION "0.74-ac5"
@@ -62,7 +61,6 @@ enum {
62}; 61};
63 62
64static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 63static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
65static void pdc2027x_remove_one(struct pci_dev *pdev);
66static void pdc2027x_error_handler(struct ata_port *ap); 64static void pdc2027x_error_handler(struct ata_port *ap);
67static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev); 65static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev);
68static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev); 66static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev);
@@ -123,7 +121,7 @@ static struct pci_driver pdc2027x_pci_driver = {
123 .name = DRV_NAME, 121 .name = DRV_NAME,
124 .id_table = pdc2027x_pci_tbl, 122 .id_table = pdc2027x_pci_tbl,
125 .probe = pdc2027x_init_one, 123 .probe = pdc2027x_init_one,
126 .remove = __devexit_p(pdc2027x_remove_one), 124 .remove = ata_pci_remove_one,
127}; 125};
128 126
129static struct scsi_host_template pdc2027x_sht = { 127static struct scsi_host_template pdc2027x_sht = {
@@ -171,8 +169,6 @@ static struct ata_port_operations pdc2027x_pata100_ops = {
171 .irq_clear = ata_bmdma_irq_clear, 169 .irq_clear = ata_bmdma_irq_clear,
172 170
173 .port_start = ata_port_start, 171 .port_start = ata_port_start,
174 .port_stop = ata_port_stop,
175 .host_stop = ata_pci_host_stop,
176}; 172};
177 173
178static struct ata_port_operations pdc2027x_pata133_ops = { 174static struct ata_port_operations pdc2027x_pata133_ops = {
@@ -205,8 +201,6 @@ static struct ata_port_operations pdc2027x_pata133_ops = {
205 .irq_clear = ata_bmdma_irq_clear, 201 .irq_clear = ata_bmdma_irq_clear,
206 202
207 .port_start = ata_port_start, 203 .port_start = ata_port_start,
208 .port_stop = ata_port_stop,
209 .host_stop = ata_pci_host_stop,
210}; 204};
211 205
212static struct ata_port_info pdc2027x_port_info[] = { 206static 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
755 static int printed_version; 749 static int printed_version;
756 unsigned int board_idx = (unsigned int) ent->driver_data; 750 unsigned int board_idx = (unsigned int) ent->driver_data;
757 751
758 struct ata_probe_ent *probe_ent = NULL; 752 struct ata_probe_ent *probe_ent;
759 unsigned long base; 753 unsigned long base;
760 void __iomem *mmio_base; 754 void __iomem *mmio_base;
761 int rc; 755 int rc;
@@ -763,37 +757,33 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de
763 if (!printed_version++) 757 if (!printed_version++)
764 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 758 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
765 759
766 rc = pci_enable_device(pdev); 760 rc = pcim_enable_device(pdev);
767 if (rc) 761 if (rc)
768 return rc; 762 return rc;
769 763
770 rc = pci_request_regions(pdev, DRV_NAME); 764 rc = pci_request_regions(pdev, DRV_NAME);
771 if (rc) 765 if (rc)
772 goto err_out; 766 return rc;
773 767
774 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); 768 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
775 if (rc) 769 if (rc)
776 goto err_out_regions; 770 return rc;
777 771
778 rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK); 772 rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK);
779 if (rc) 773 if (rc)
780 goto err_out_regions; 774 return rc;
781 775
782 /* Prepare the probe entry */ 776 /* Prepare the probe entry */
783 probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL); 777 probe_ent = devm_kzalloc(&pdev->dev, sizeof(*probe_ent), GFP_KERNEL);
784 if (probe_ent == NULL) { 778 if (probe_ent == NULL)
785 rc = -ENOMEM; 779 return -ENOMEM;
786 goto err_out_regions;
787 }
788 780
789 probe_ent->dev = pci_dev_to_dev(pdev); 781 probe_ent->dev = pci_dev_to_dev(pdev);
790 INIT_LIST_HEAD(&probe_ent->node); 782 INIT_LIST_HEAD(&probe_ent->node);
791 783
792 mmio_base = pci_iomap(pdev, 5, 0); 784 mmio_base = pcim_iomap(pdev, 5, 0);
793 if (!mmio_base) { 785 if (!mmio_base)
794 rc = -ENOMEM; 786 return -ENOMEM;
795 goto err_out_free_ent;
796 }
797 787
798 base = (unsigned long) mmio_base; 788 base = (unsigned long) mmio_base;
799 789
@@ -820,32 +810,13 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de
820 810
821 /* initialize adapter */ 811 /* initialize adapter */
822 if (pdc_hardware_init(pdev, probe_ent, board_idx) != 0) 812 if (pdc_hardware_init(pdev, probe_ent, board_idx) != 0)
823 goto err_out_free_ent; 813 return -EIO;
824 814
825 ata_device_add(probe_ent); 815 if (!ata_device_add(probe_ent))
826 kfree(probe_ent); 816 return -ENODEV;
827 817
818 devm_kfree(&pdev->dev, probe_ent);
828 return 0; 819 return 0;
829
830err_out_free_ent:
831 kfree(probe_ent);
832err_out_regions:
833 pci_release_regions(pdev);
834err_out:
835 pci_disable_device(pdev);
836 return rc;
837}
838
839/**
840 * pdc2027x_remove_one - Called to remove a single instance of the
841 * adapter.
842 *
843 * @dev: The PCI device to remove.
844 * FIXME: module load/unload not working yet
845 */
846static void __devexit pdc2027x_remove_one(struct pci_dev *pdev)
847{
848 ata_pci_remove_one(pdev);
849} 820}
850 821
851/** 822/**