ATA: piix, fix pointer deref on suspend
[safe/jmp/linux-2.6] / drivers / ata / pata_efar.c
index 8700d9d..ac6392e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *    pata_efar.c - EFAR PIIX clone controller driver
  *
- *     (C) 2005 Red Hat <alan@redhat.com>
+ *     (C) 2005 Red Hat
  *
  *    Some parts based on ata_piix.c by Jeff Garzik and others.
  *
@@ -45,20 +45,7 @@ static int efar_pre_reset(struct ata_link *link, unsigned long deadline)
        if (!pci_test_config_bits(pdev, &efar_enable_bits[ap->port_no]))
                return -ENOENT;
 
-       return ata_std_prereset(link, deadline);
-}
-
-/**
- *     efar_probe_reset - Probe specified port on PATA host controller
- *     @ap: Port to probe
- *
- *     LOCKING:
- *     None (inherited from caller).
- */
-
-static void efar_error_handler(struct ata_port *ap)
-{
-       ata_bmdma_drive_eh(ap, efar_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
+       return ata_sff_prereset(link, deadline);
 }
 
 /**
@@ -236,36 +223,12 @@ static struct scsi_host_template efar_sht = {
        ATA_BMDMA_SHT(DRV_NAME),
 };
 
-static const struct ata_port_operations efar_ops = {
+static struct ata_port_operations efar_ops = {
+       .inherits               = &ata_bmdma_port_ops,
+       .cable_detect           = efar_cable_detect,
        .set_piomode            = efar_set_piomode,
        .set_dmamode            = efar_set_dmamode,
-       .mode_filter            = ata_pci_default_filter,
-
-       .tf_load                = ata_tf_load,
-       .tf_read                = ata_tf_read,
-       .check_status           = ata_check_status,
-       .exec_command           = ata_exec_command,
-       .dev_select             = ata_std_dev_select,
-
-       .freeze                 = ata_bmdma_freeze,
-       .thaw                   = ata_bmdma_thaw,
-       .error_handler          = efar_error_handler,
-       .post_internal_cmd      = ata_bmdma_post_internal_cmd,
-       .cable_detect           = efar_cable_detect,
-
-       .bmdma_setup            = ata_bmdma_setup,
-       .bmdma_start            = ata_bmdma_start,
-       .bmdma_stop             = ata_bmdma_stop,
-       .bmdma_status           = ata_bmdma_status,
-       .qc_prep                = ata_qc_prep,
-       .qc_issue               = ata_qc_issue_prot,
-       .data_xfer              = ata_data_xfer,
-
-       .irq_handler            = ata_interrupt,
-       .irq_clear              = ata_bmdma_irq_clear,
-       .irq_on                 = ata_irq_on,
-
-       .port_start             = ata_sff_port_start,
+       .prereset               = efar_pre_reset,
 };
 
 
@@ -287,7 +250,6 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        static int printed_version;
        static const struct ata_port_info info = {
-               .sht            = &efar_sht,
                .flags          = ATA_FLAG_SLAVE_POSS,
                .pio_mask       = 0x1f, /* pio0-4 */
                .mwdma_mask     = 0x07, /* mwdma1-2 */
@@ -300,7 +262,7 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
                dev_printk(KERN_DEBUG, &pdev->dev,
                           "version " DRV_VERSION "\n");
 
-       return ata_pci_init_one(pdev, ppi);
+       return ata_pci_sff_init_one(pdev, ppi, &efar_sht, NULL);
 }
 
 static const struct pci_device_id efar_pci_tbl[] = {