]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ide: use 'drive->dn & 1' instead of drive->select.b.unit
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Mon, 13 Oct 2008 19:39:40 +0000 (21:39 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Mon, 13 Oct 2008 19:39:40 +0000 (21:39 +0200)
* Call ide_port_init_devices() in ide_host_register()
  also if 'struct ide_port_info *d' is not available.

* Init drive->dn in ide_port_init_devices() instead of
  ide_probe_port() so it is valid also in ->init_dev.

* Pass device number to ide_dev_apply_params().

* Use 'drive->dn & 1' instead of drive->select.b.unit.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
19 files changed:
drivers/ide/ide-dma.c
drivers/ide/ide-probe.c
drivers/ide/ide.c
drivers/ide/legacy/ali14xx.c
drivers/ide/legacy/qd65xx.c
drivers/ide/pci/aec62xx.c
drivers/ide/pci/alim15x3.c
drivers/ide/pci/cmd640.c
drivers/ide/pci/cs5535.c
drivers/ide/pci/cy82c693.c
drivers/ide/pci/it821x.c
drivers/ide/pci/ns87415.c
drivers/ide/pci/opti621.c
drivers/ide/pci/sc1200.c
drivers/ide/pci/scc_pata.c
drivers/ide/pci/serverworks.c
drivers/ide/pci/siimage.c
drivers/ide/pci/triflex.c
drivers/ide/ppc/pmac.c

index 82fa6107434b700f476c2bc5353ab71415b44b76..d5934fc8f85fc76d2b2bbd785991669f07494801 100644 (file)
@@ -370,7 +370,7 @@ static int dma_timer_expiry (ide_drive_t *drive)
 void ide_dma_host_set(ide_drive_t *drive, int on)
 {
        ide_hwif_t *hwif        = HWIF(drive);
-       u8 unit                 = (drive->select.b.unit & 0x01);
+       u8 unit                 = drive->dn & 1;
        u8 dma_stat             = hwif->tp_ops->read_sff_dma_status(hwif);
 
        if (on)
index 57c74187653689bd7a625920299a66123a7979e6..58a2caf17903e6aab6ca5fe300a1aaaac8662dae 100644 (file)
@@ -447,7 +447,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
        msleep(50);
 
        if (ide_read_device(drive) != drive->select.all && present == 0) {
-               if (drive->select.b.unit != 0) {
+               if (drive->dn & 1) {
                        /* exit with drive0 selected */
                        SELECT_DRIVE(&hwif->drives[0]);
                        /* allow ATA_BUSY to assert & clear */
@@ -493,7 +493,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
                /* not present or maybe ATAPI */
                rc = 3;
        }
-       if (drive->select.b.unit != 0) {
+       if (drive->dn & 1) {
                /* exit with drive0 selected */
                SELECT_DRIVE(&hwif->drives[0]);
                msleep(50);
@@ -798,7 +798,7 @@ static int ide_probe_port(ide_hwif_t *hwif)
         */
        for (unit = 0; unit < MAX_DRIVES; ++unit) {
                ide_drive_t *drive = &hwif->drives[unit];
-               drive->dn = (hwif->channel ? 2 : 0) + unit;
+
                (void) probe_for_drive(drive);
                if (drive->dev_flags & IDE_DFLAG_PRESENT)
                        rc = 0;
@@ -1357,6 +1357,8 @@ static void ide_port_init_devices(ide_hwif_t *hwif)
        for (i = 0; i < MAX_DRIVES; i++) {
                ide_drive_t *drive = &hwif->drives[i];
 
+               drive->dn = i + hwif->channel * 2;
+
                if (hwif->host_flags & IDE_HFLAG_IO_32BIT)
                        drive->io_32bit = 1;
                if (hwif->host_flags & IDE_HFLAG_UNMASK_IRQS)
@@ -1627,18 +1629,18 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
 
                if (d == NULL) {
                        mate = NULL;
-                       continue;
-               }
+               } else {
+                       if ((i & 1) && mate) {
+                               hwif->mate = mate;
+                               mate->mate = hwif;
+                       }
 
-               if ((i & 1) && mate) {
-                       hwif->mate = mate;
-                       mate->mate = hwif;
-               }
+                       mate = (i & 1) ? NULL : hwif;
 
-               mate = (i & 1) ? NULL : hwif;
+                       ide_init_port(hwif, i & 1, d);
+                       ide_port_cable_detect(hwif);
+               }
 
-               ide_init_port(hwif, i & 1, d);
-               ide_port_cable_detect(hwif);
                ide_port_init_devices(hwif);
        }
 
index 40b5a4614340c82b11ed9ea876a46a4435fd0c04..7624b937398a7c67f0474962ff5d048134b85dd1 100644 (file)
@@ -713,9 +713,9 @@ static int ide_set_disk_chs(const char *str, struct kernel_param *kp)
 module_param_call(chs, ide_set_disk_chs, NULL, NULL, 0);
 MODULE_PARM_DESC(chs, "force device as a disk (using CHS)");
 
-static void ide_dev_apply_params(ide_drive_t *drive)
+static void ide_dev_apply_params(ide_drive_t *drive, u8 unit)
 {
-       int i = drive->hwif->index * MAX_DRIVES + drive->select.b.unit;
+       int i = drive->hwif->index * MAX_DRIVES + unit;
 
        if (ide_nodma & (1 << i)) {
                printk(KERN_INFO "ide: disallowing DMA for %s\n", drive->name);
@@ -791,7 +791,7 @@ void ide_port_apply_params(ide_hwif_t *hwif)
        }
 
        for (i = 0; i < MAX_DRIVES; i++)
-               ide_dev_apply_params(&hwif->drives[i]);
+               ide_dev_apply_params(&hwif->drives[i], i);
 }
 
 /*
index 7276c96aaa2a88aa8bfd2279da17b21963cd7b9c..90da1f953ed080d0b0fb3ce38ff527398c42d00c 100644 (file)
@@ -131,7 +131,7 @@ static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
                drive->name, pio, time1, time2, param1, param2, param3, param4);
 
        /* stuff timing parameters into controller registers */
-       driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit;
+       driveNum = (drive->hwif->index << 1) + (drive->dn & 1);
        spin_lock_irqsave(&ali14xx_lock, flags);
        outb_p(regOn, basePort);
        outReg(param1, regTab[driveNum].reg1);
index ec408b3a7100ae9eb4492ca1dfcb74ddc888c790..bc27c7aba93612628eff92defc91baaef5657109 100644 (file)
@@ -305,7 +305,7 @@ static void __init qd6580_init_dev(ide_drive_t *drive)
        } else
                t2 = t1 = hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA;
 
-       drive->drive_data = drive->select.b.unit ? t2 : t1;
+       drive->drive_data = (drive->dn & 1) ? t2 : t1;
 }
 
 static const struct ide_port_ops qd6500_port_ops = {
index e7475ba559c74063543650816335a751864687ac..c294b19f5552d1435ff6b3bba95c1d2d68a8cfcf 100644 (file)
@@ -115,7 +115,7 @@ static void aec6260_set_mode(ide_drive_t *drive, const u8 speed)
        struct pci_dev *dev     = to_pci_dev(hwif->dev);
        struct ide_host *host   = pci_get_drvdata(dev);
        struct chipset_bus_clock_list_entry *bus_clock = host->host_priv;
-       u8 unit         = (drive->select.b.unit & 0x01);
+       u8 unit                 = drive->dn & 1;
        u8 tmp1 = 0, tmp2 = 0;
        u8 ultra = 0, drive_conf = 0, ultra_conf = 0;
        unsigned long flags;
index 053c75263918d592c60a70024ee7ef47c564953d..f1c57f72bbdbd1050045626b98a6392c3a8fb430 100644 (file)
@@ -77,8 +77,7 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
        int bus_speed = ide_pci_clk ? ide_pci_clk : 33;
        int port = hwif->channel ? 0x5c : 0x58;
        int portFIFO = hwif->channel ? 0x55 : 0x54;
-       u8 cd_dma_fifo = 0;
-       int unit = drive->select.b.unit & 1;
+       u8 cd_dma_fifo = 0, unit = drive->dn & 1;
 
        if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8)
                s_clc = 0;
@@ -112,7 +111,7 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
        }
        
        pci_write_config_byte(dev, port, s_clc);
-       pci_write_config_byte(dev, port+drive->select.b.unit+2, (a_clc << 4) | r_clc);
+       pci_write_config_byte(dev, port + unit + 2, (a_clc << 4) | r_clc);
        local_irq_restore(flags);
 }
 
@@ -154,7 +153,7 @@ static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed)
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = to_pci_dev(hwif->dev);
        u8 speed1               = speed;
-       u8 unit                 = (drive->select.b.unit & 0x01);
+       u8 unit                 = drive->dn & 1;
        u8 tmpbyte              = 0x00;
        int m5229_udma          = (hwif->channel) ? 0x57 : 0x56;
 
index d3afdffcb07a9fb177084b5ba0bfa16c0ccaaac9..e4306647d00d6782e8db72d40d82827bb085044f 100644 (file)
@@ -468,7 +468,7 @@ static void program_drive_counts(ide_drive_t *drive, unsigned int index)
         */
        if (index > 1) {
                ide_hwif_t *hwif = drive->hwif;
-               ide_drive_t *peer = &hwif->drives[!drive->select.b.unit];
+               ide_drive_t *peer = &hwif->drives[!(drive->dn & 1)];
                unsigned int mate = index ^ 1;
 
                if (peer->dev_flags & IDE_DFLAG_PRESENT) {
@@ -607,7 +607,7 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
 
 static void cmd640_init_dev(ide_drive_t *drive)
 {
-       unsigned int i = drive->hwif->channel * 2 + drive->select.b.unit;
+       unsigned int i = drive->hwif->channel * 2 + (drive->dn & 1);
 
 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
        /*
index 1e5bc59ea2fb03074fa9729501660f0e7b33bfcd..fa6dca9f3287e0c97260519265af4f5797c230ec 100644 (file)
@@ -76,7 +76,7 @@ static unsigned int cs5535_udma_timings[5] =
 static void cs5535_set_speed(ide_drive_t *drive, const u8 speed)
 {
        u32 reg = 0, dummy;
-       int unit = drive->select.b.unit;
+       u8 unit = drive->dn & 1;
 
        /* Set the PIO timings */
        if (speed < XFER_SW_DMA_0) {
index 5241ef74f8d90e947272b13bd8cc657ea263b34c..e5f8fc0ed318930a0cb98f98a8e8f3dc95be5830 100644 (file)
@@ -178,8 +178,7 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode)
 
 #if CY82C693_DEBUG_INFO
        printk(KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n",
-               drive->name, HWIF(drive)->channel, drive->select.b.unit,
-               mode & 3, single);
+               drive->name, hwif->channel, drive->dn & 1, mode & 3, single);
 #endif /* CY82C693_DEBUG_INFO */
 
        /*
@@ -224,7 +223,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
        compute_clocks(pio, &pclk);
 
        /* now let's write  the clocks registers */
-       if (drive->select.b.unit == 0) {
+       if ((drive->dn & 1) == 0) {
                /*
                 * set master drive
                 * address setup control register
@@ -266,7 +265,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
 #if CY82C693_DEBUG_INFO
        printk(KERN_INFO "%s (ch=%d, dev=%d): set PIO timing to "
                "(addr=0x%X, ior=0x%X, iow=0x%X, 8bit=0x%X)\n",
-               drive->name, hwif->channel, drive->select.b.unit,
+               drive->name, hwif->channel, drive->dn & 1,
                addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8);
 #endif /* CY82C693_DEBUG_INFO */
 }
index b761015ee190b8c4b227476d2fc3f3c70f03a506..1aada445a9c827556f339b32af10ab461d11eacc 100644 (file)
@@ -138,8 +138,7 @@ static void it821x_program_udma(ide_drive_t *drive, u16 timing)
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        struct it821x_dev *itdev = ide_get_hwifdata(hwif);
        int channel = hwif->channel;
-       int unit = drive->select.b.unit;
-       u8 conf;
+       u8 unit = drive->dn & 1, conf;
 
        /* Program UDMA timing bits */
        if(itdev->clock_mode == ATA_66)
@@ -168,13 +167,11 @@ static void it821x_clock_strategy(ide_drive_t *drive)
        ide_hwif_t *hwif = drive->hwif;
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        struct it821x_dev *itdev = ide_get_hwifdata(hwif);
+       ide_drive_t *pair;
+       int clock, altclock, sel = 0;
+       u8 unit = drive->dn & 1, v;
 
-       u8 unit = drive->select.b.unit;
-       ide_drive_t *pair = &hwif->drives[1-unit];
-
-       int clock, altclock;
-       u8 v;
-       int sel = 0;
+       pair = &hwif->drives[1 - unit];
 
        if(itdev->want[0][0] > itdev->want[1][0]) {
                clock = itdev->want[0][1];
@@ -240,16 +237,17 @@ static void it821x_clock_strategy(ide_drive_t *drive)
 
 static void it821x_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
-       ide_hwif_t *hwif        = drive->hwif;
+       ide_hwif_t *hwif = drive->hwif;
        struct it821x_dev *itdev = ide_get_hwifdata(hwif);
-       int unit = drive->select.b.unit;
-       ide_drive_t *pair = &hwif->drives[1 - unit];
-       u8 set_pio = pio;
+       ide_drive_t *pair;
+       u8 unit = drive->dn & 1, set_pio = pio;
 
        /* Spec says 89 ref driver uses 88 */
        static u16 pio_timings[]= { 0xAA88, 0xA382, 0xA181, 0x3332, 0x3121 };
        static u8 pio_want[]    = { ATA_66, ATA_66, ATA_66, ATA_66, ATA_ANY };
 
+       pair = &hwif->drives[1 - unit];
+
        /*
         * Compute the best PIO mode we can for a given device. We must
         * pick a speed that does not cause problems with the other device
@@ -286,9 +284,7 @@ static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted)
        ide_hwif_t *hwif = drive->hwif;
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        struct it821x_dev *itdev = (void *)ide_get_hwifdata(hwif);
-       int unit = drive->select.b.unit;
-       int channel = hwif->channel;
-       u8 conf;
+       u8 unit = drive->dn & 1, channel = hwif->channel, conf;
 
        static u16 dma[]        = { 0x8866, 0x3222, 0x3121 };
        static u8 mwdma_want[]  = { ATA_ANY, ATA_66, ATA_ANY };
@@ -325,9 +321,7 @@ static void it821x_tune_udma (ide_drive_t *drive, byte mode_wanted)
        ide_hwif_t *hwif = drive->hwif;
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        struct it821x_dev *itdev = ide_get_hwifdata(hwif);
-       int unit = drive->select.b.unit;
-       int channel = hwif->channel;
-       u8 conf;
+       u8 unit = drive->dn & 1, channel = hwif->channel, conf;
 
        static u16 udma[]       = { 0x4433, 0x4231, 0x3121, 0x2121, 0x1111, 0x2211, 0x1111 };
        static u8 udma_want[]   = { ATA_ANY, ATA_50, ATA_ANY, ATA_66, ATA_66, ATA_50, ATA_66 };
@@ -369,7 +363,8 @@ static void it821x_dma_start(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
        struct it821x_dev *itdev = ide_get_hwifdata(hwif);
-       int unit = drive->select.b.unit;
+       u8 unit = drive->dn & 1;
+
        if(itdev->mwdma[unit] != MWDMA_OFF)
                it821x_program(drive, itdev->mwdma[unit]);
        else if(itdev->udma[unit] != UDMA_OFF && itdev->timing10)
@@ -389,9 +384,10 @@ static void it821x_dma_start(ide_drive_t *drive)
 static int it821x_dma_end(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
-       int unit = drive->select.b.unit;
        struct it821x_dev *itdev = ide_get_hwifdata(hwif);
        int ret = __ide_dma_end(drive);
+       u8 unit = drive->dn & 1;
+
        if(itdev->mwdma[unit] != MWDMA_OFF)
                it821x_program(drive, itdev->pio[unit]);
        return ret;
index 99e98e5e271c7ed93434e8100c4a0a29d2a7f070..61a143661ee015a07c9cbd7db907546fccdeaec0 100644 (file)
@@ -160,8 +160,8 @@ static void ns87415_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
                new |= bit;
 
        /* Select PIO or DMA, DMA may only be selected for one drive/channel. */
-       bit   = 1 << (20 + drive->select.b.unit       + (hwif->channel << 1));
-       other = 1 << (20 + (1 - drive->select.b.unit) + (hwif->channel << 1));
+       bit   = 1 << (20 + (drive->dn & 1) + (hwif->channel << 1));
+       other = 1 << (20 + (1 - (drive->dn & 1)) + (hwif->channel << 1));
        new = use_dma ? ((new & ~other) | bit) : (new & ~bit);
 
        if (new != *old) {
index 3de11ddcf863f1e1295c1f47d45fd3a6bef33e23..f0db38bd70e38336a21367cb6a71f34ff945e28b 100644 (file)
@@ -179,7 +179,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
        misc = addr_timings[clk][addr_pio];
 
        /* select Index-0/1 for Register-A/B */
-       write_reg(drive->select.b.unit, MISC_REG);
+       write_reg(drive->dn & 1, MISC_REG);
        /* set read cycle timings */
        write_reg(tim, READ_REG);
        /* set write cycle timings */
index 50405ed6f0cbc74056f1b9c349077f98ad0cbd75..79eeeadad6559a2d92f37d28949d5ac51530c177 100644 (file)
@@ -126,7 +126,6 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode)
 {
        ide_hwif_t              *hwif = HWIF(drive);
        struct pci_dev          *dev = to_pci_dev(hwif->dev);
-       int                     unit = drive->select.b.unit;
        unsigned int            reg, timings;
        unsigned short          pci_clock;
        unsigned int            basereg = hwif->channel ? 0x50 : 0x40;
@@ -155,7 +154,7 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode)
        else
                timings = mwdma_timing[pci_clock][mode - XFER_MW_DMA_0];
 
-       if (unit == 0) {                        /* are we configuring drive0? */
+       if ((drive->dn & 1) == 0) {
                pci_read_config_dword(dev, basereg + 4, &reg);
                timings |= reg & 0x80000000;    /* preserve PIO format bit */
                pci_write_config_dword(dev, basereg + 4, timings);
index 62fa31409a333431e24bc9798cdb169215561c9e..0eced0ae2e86965b94faed6e512206a5d0b3d447 100644 (file)
@@ -291,7 +291,7 @@ static void scc_set_dma_mode(ide_drive_t *drive, const u8 speed)
 static void scc_dma_host_set(ide_drive_t *drive, int on)
 {
        ide_hwif_t *hwif = drive->hwif;
-       u8 unit = (drive->select.b.unit & 0x01);
+       u8 unit = drive->dn & 1;
        u8 dma_stat = scc_ide_inb(hwif->dma_base + 4);
 
        if (on)
index 3dff2aea317e88ae261d5050b9b0ae3c1023dd7e..7fac80192f3b0ea2e392306537ec360616e76ace 100644 (file)
@@ -153,7 +153,7 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed)
 
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = to_pci_dev(hwif->dev);
-       u8 unit                 = (drive->select.b.unit & 0x01);
+       u8 unit                 = drive->dn & 1;
 
        u8 ultra_enable  = 0, ultra_timing = 0, dma_timing = 0;
 
index 174a873b4c6405229e48eb2714998cf9bef8ce69..134868c71c3457bb0eeba745623b099dd1a5a687 100644 (file)
@@ -116,13 +116,14 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        unsigned long base      = (unsigned long)hwif->hwif_data;
+       u8 unit                 = drive->dn & 1;
 
        base += 0xA0 + r;
        if (hwif->host_flags & IDE_HFLAG_MMIO)
                base += hwif->channel << 6;
        else
                base += hwif->channel << 4;
-       base |= drive->select.b.unit << drive->select.b.unit;
+       base |= unit << unit;
        return base;
 }
 
@@ -255,7 +256,7 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
        u8 addr_mask            = hwif->channel ? (mmio ? 0xF4 : 0x84)
                                                : (mmio ? 0xB4 : 0x80);
        u8 mode                 = 0;
-       u8 unit                 = drive->select.b.unit;
+       u8 unit                 = drive->dn & 1;
 
        /* trim *taskfile* PIO to the slowest of the master/slave */
        if (pair) {
@@ -301,9 +302,9 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
 
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = to_pci_dev(hwif->dev);
-       u16 ultra = 0, multi    = 0;
-       u8 mode = 0, unit       = drive->select.b.unit;
        unsigned long base      = (unsigned long)hwif->hwif_data;
+       u16 ultra = 0, multi    = 0;
+       u8 mode = 0, unit       = drive->dn & 1;
        u8 mmio                 = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
        u8 scsc = 0, addr_mask  = hwif->channel ? (mmio ? 0xF4 : 0x84)
                                                : (mmio ? 0xB4 : 0x80);
index be8715dcee05ec735c35c8b88eb2493f0305736e..42fb98f268d5a988192dfbda85389bd40c8e201f 100644 (file)
@@ -38,13 +38,12 @@ static void triflex_set_mode(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif = HWIF(drive);
        struct pci_dev *dev = to_pci_dev(hwif->dev);
-       u8 channel_offset = hwif->channel ? 0x74 : 0x70;
-       u16 timing = 0;
        u32 triflex_timings = 0;
-       u8 unit = (drive->select.b.unit & 0x01);
-       
+       u16 timing = 0;
+       u8 channel_offset = hwif->channel ? 0x74 : 0x70, unit = drive->dn & 1;
+
        pci_read_config_dword(dev, channel_offset, &triflex_timings);
-       
+
        switch(speed) {
                case XFER_MW_DMA_2:
                        timing = 0x0103; 
index 2de22b6fe3bdbd271e5d4b50a1888f18a0aa1750..5b083700d882d5fa39b008270345ebf4723ba16b 100644 (file)
@@ -433,7 +433,7 @@ pmac_ide_selectproc(ide_drive_t *drive)
        if (pmif == NULL)
                return;
 
-       if (drive->select.b.unit & 0x01)
+       if (drive->dn & 1)
                writel(pmif->timings[1], PMAC_IDE_REG(IDE_TIMING_CONFIG));
        else
                writel(pmif->timings[0], PMAC_IDE_REG(IDE_TIMING_CONFIG));
@@ -455,7 +455,7 @@ pmac_ide_kauai_selectproc(ide_drive_t *drive)
        if (pmif == NULL)
                return;
 
-       if (drive->select.b.unit & 0x01) {
+       if (drive->dn & 1) {
                writel(pmif->timings[1], PMAC_IDE_REG(IDE_KAUAI_PIO_CONFIG));
                writel(pmif->timings[3], PMAC_IDE_REG(IDE_KAUAI_ULTRA_CONFIG));
        } else {
@@ -528,7 +528,7 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
                return;
                
        /* which drive is it ? */
-       timings = &pmif->timings[drive->select.b.unit & 0x01];
+       timings = &pmif->timings[drive->dn & 1];
        t = *timings;
 
        cycle_time = ide_pio_cycle_time(drive, pio);
@@ -805,9 +805,9 @@ static void pmac_ide_set_dma_mode(ide_drive_t *drive, const u8 speed)
        ide_hwif_t *hwif = drive->hwif;
        pmac_ide_hwif_t *pmif =
                (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
-       int unit = (drive->select.b.unit & 0x01);
        int ret = 0;
        u32 *timings, *timings2, tl[2];
+       u8 unit = drive->dn & 1;
 
        timings = &pmif->timings[unit];
        timings2 = &pmif->timings[unit+2];
@@ -1558,8 +1558,7 @@ pmac_ide_dma_setup(ide_drive_t *drive)
        pmac_ide_hwif_t *pmif =
                (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
        struct request *rq = HWGROUP(drive)->rq;
-       u8 unit = (drive->select.b.unit & 0x01);
-       u8 ata4;
+       u8 unit = drive->dn & 1, ata4;
 
        if (pmif == NULL)
                return 1;