ide: add struct ide_port_ops (take 2)
[safe/jmp/linux-2.6] / drivers / ide / pci / it8213.c
index c781ea6..9053c87 100644 (file)
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/pci.h>
-#include <linux/delay.h>
 #include <linux/hdreg.h>
 #include <linux/ide.h>
 #include <linux/init.h>
 
-#include <asm/io.h>
-
 /**
  *     it8213_set_pio_mode     -       set host controller for PIO mode
  *     @drive: drive
@@ -38,7 +35,7 @@ static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio)
        static DEFINE_SPINLOCK(tune_lock);
        int control = 0;
 
-       static const u8 timings[][2]= {
+       static const u8 timings[][2] = {
                                        { 0, 0 },
                                        { 0, 0 },
                                        { 1, 0 },
@@ -108,11 +105,10 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed)
 
                if (!(reg48 & u_flag))
                        pci_write_config_byte(dev, 0x48, reg48 | u_flag);
-               if (speed >= XFER_UDMA_5) {
+               if (speed >= XFER_UDMA_5)
                        pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag);
-               } else {
+               else
                        pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
-               }
 
                if ((reg4a & a_speed) != u_speed)
                        pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
@@ -153,29 +149,18 @@ static u8 __devinit it8213_cable_detect(ide_hwif_t *hwif)
        return (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
 }
 
-/**
- *     init_hwif_it8213        -       set up hwif structs
- *     @hwif: interface to set up
- *
- *     We do the basic set up of the interface structure.
- */
-
-static void __devinit init_hwif_it8213(ide_hwif_t *hwif)
-{
-       hwif->set_dma_mode = &it8213_set_dma_mode;
-       hwif->set_pio_mode = &it8213_set_pio_mode;
-
-       hwif->cable_detect = it8213_cable_detect;
-}
-
+static const struct ide_port_ops it8213_port_ops = {
+       .set_pio_mode           = it8213_set_pio_mode,
+       .set_dma_mode           = it8213_set_dma_mode,
+       .cable_detect           = it8213_cable_detect,
+};
 
 #define DECLARE_ITE_DEV(name_str)                      \
        {                                               \
                .name           = name_str,             \
-               .init_hwif      = init_hwif_it8213,     \
-               .enablebits     = {{0x41,0x80,0x80}}, \
-               .host_flags     = IDE_HFLAG_SINGLE |    \
-                                 IDE_HFLAG_BOOTABLE,   \
+               .enablebits     = { {0x41, 0x80, 0x80} }, \
+               .port_ops       = &it8213_port_ops,     \
+               .host_flags     = IDE_HFLAG_SINGLE,     \
                .pio_mask       = ATA_PIO4,             \
                .swdma_mask     = ATA_SWDMA2_ONLY,      \
                .mwdma_mask     = ATA_MWDMA12_ONLY,     \