libata-sff: clean up BMDMA initialization
[safe/jmp/linux-2.6] / drivers / ata / pata_cmd640.c
index 34a3942..e5f289f 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/init.h>
 #include <linux/blkdev.h>
 #include <linux/delay.h>
+#include <linux/gfp.h>
 #include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
@@ -152,24 +153,20 @@ static int cmd640_port_start(struct ata_port *ap)
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        struct cmd640_reg *timing;
 
-       int ret = ata_sff_port_start(ap);
-       if (ret < 0)
-               return ret;
-
        timing = devm_kzalloc(&pdev->dev, sizeof(struct cmd640_reg), GFP_KERNEL);
        if (timing == NULL)
                return -ENOMEM;
        timing->last = -1;      /* Force a load */
        ap->private_data = timing;
-       return ret;
+       return 0;
 }
 
 static struct scsi_host_template cmd640_sht = {
-       ATA_BMDMA_SHT(DRV_NAME),
+       ATA_PIO_SHT(DRV_NAME),
 };
 
 static struct ata_port_operations cmd640_port_ops = {
-       .inherits       = &ata_bmdma_port_ops,
+       .inherits       = &ata_sff_port_ops,
        /* In theory xfer_noirq is not needed once we kill the prefetcher */
        .sff_data_xfer  = ata_sff_data_xfer_noirq,
        .qc_issue       = cmd640_qc_issue,
@@ -180,13 +177,10 @@ static struct ata_port_operations cmd640_port_ops = {
 
 static void cmd640_hardware_init(struct pci_dev *pdev)
 {
-       u8 r;
        u8 ctrl;
 
        /* CMD640 detected, commiserations */
        pci_write_config_byte(pdev, 0x5B, 0x00);
-       /* Get version info */
-       pci_read_config_byte(pdev, CFR, &r);
        /* PIO0 command cycles */
        pci_write_config_byte(pdev, CMDTIM, 0);
        /* 512 byte bursts (sector) */
@@ -211,7 +205,7 @@ static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
        static const struct ata_port_info info = {
                .flags = ATA_FLAG_SLAVE_POSS,
-               .pio_mask = 0x1f,
+               .pio_mask = ATA_PIO4,
                .port_ops = &cmd640_port_ops
        };
        const struct ata_port_info *ppi[] = { &info, NULL };
@@ -223,7 +217,7 @@ static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
        cmd640_hardware_init(pdev);
 
-       return ata_pci_sff_init_one(pdev, ppi, &cmd640_sht, NULL);
+       return ata_pci_sff_init_one(pdev, ppi, &cmd640_sht, NULL, 0);
 }
 
 #ifdef CONFIG_PM