ide: add struct ide_port_ops (take 2)
[linux-block.git] / drivers / ide / pci / siimage.c
index c9ecab8aeb61d6be5c67ba3b192cdf65abcea2d7..3e4b993807097a302b0521460770f91ae51dda6e 100644 (file)
@@ -735,14 +735,14 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif)
 }
 
 /**
- *     ata66_siimage   -       check for 80 pin cable
+ *     sil_cable_detect        -       cable detection
  *     @hwif: interface to check
  *
  *     Check for the presence of an ATA66 capable cable on the
  *     interface.
  */
 
-static u8 __devinit ata66_siimage(ide_hwif_t *hwif)
+static u8 __devinit sil_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        unsigned long addr = siimage_selreg(hwif, 0);
@@ -769,25 +769,14 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
 {
        u8 sata = is_sata(hwif);
 
-       hwif->set_pio_mode = &sil_set_pio_mode;
-       hwif->set_dma_mode = &sil_set_dma_mode;
-       hwif->quirkproc = &sil_quirkproc;
-
        if (sata) {
                static int first = 1;
 
-               hwif->reset_poll = &sil_sata_reset_poll;
-               hwif->pre_reset = &sil_sata_pre_reset;
-               hwif->udma_filter = &sil_sata_udma_filter;
-
                if (first) {
                        printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n");
                        first = 0;
                }
-       } else
-               hwif->udma_filter = &sil_pata_udma_filter;
-
-       hwif->cable_detect = ata66_siimage;
+       }
 
        if (hwif->dma_base == 0)
                return;
@@ -802,21 +791,40 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
        }
 }
 
-#define DECLARE_SII_DEV(name_str)                      \
+static const struct ide_port_ops sil_pata_port_ops = {
+       .set_pio_mode           = sil_set_pio_mode,
+       .set_dma_mode           = sil_set_dma_mode,
+       .quirkproc              = sil_quirkproc,
+       .udma_filter            = sil_pata_udma_filter,
+       .cable_detect           = sil_cable_detect,
+};
+
+static const struct ide_port_ops sil_sata_port_ops = {
+       .set_pio_mode           = sil_set_pio_mode,
+       .set_dma_mode           = sil_set_dma_mode,
+       .reset_poll             = sil_sata_reset_poll,
+       .pre_reset              = sil_sata_pre_reset,
+       .quirkproc              = sil_quirkproc,
+       .udma_filter            = sil_sata_udma_filter,
+       .cable_detect           = sil_cable_detect,
+};
+
+#define DECLARE_SII_DEV(name_str, p_ops)               \
        {                                               \
                .name           = name_str,             \
                .init_chipset   = init_chipset_siimage, \
                .init_iops      = init_iops_siimage,    \
                .init_hwif      = init_hwif_siimage,    \
+               .port_ops       = p_ops,                \
                .pio_mask       = ATA_PIO4,             \
                .mwdma_mask     = ATA_MWDMA2,           \
                .udma_mask      = ATA_UDMA6,            \
        }
 
 static const struct ide_port_info siimage_chipsets[] __devinitdata = {
-       /* 0 */ DECLARE_SII_DEV("SiI680"),
-       /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"),
-       /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA")
+       /* 0 */ DECLARE_SII_DEV("SiI680",               &sil_pata_port_ops),
+       /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA",   &sil_sata_port_ops),
+       /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA",   &sil_sata_port_ops)
 };
 
 /**