aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-probe.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:40 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:40 -0400
commit123995b97136cb41fa282f0ed2385f2c8066df96 (patch)
tree39b994f29bac4dc931be9abdde1e7f5412692856 /drivers/ide/ide-probe.c
parent8595259ccb6a13b9aab31832ce874d157064d256 (diff)
ide: use 'drive->dn & 1' instead of drive->select.b.unit
* 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>
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r--drivers/ide/ide-probe.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 57c741876536..58a2caf17903 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -447,7 +447,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
447 msleep(50); 447 msleep(50);
448 448
449 if (ide_read_device(drive) != drive->select.all && present == 0) { 449 if (ide_read_device(drive) != drive->select.all && present == 0) {
450 if (drive->select.b.unit != 0) { 450 if (drive->dn & 1) {
451 /* exit with drive0 selected */ 451 /* exit with drive0 selected */
452 SELECT_DRIVE(&hwif->drives[0]); 452 SELECT_DRIVE(&hwif->drives[0]);
453 /* allow ATA_BUSY to assert & clear */ 453 /* allow ATA_BUSY to assert & clear */
@@ -493,7 +493,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
493 /* not present or maybe ATAPI */ 493 /* not present or maybe ATAPI */
494 rc = 3; 494 rc = 3;
495 } 495 }
496 if (drive->select.b.unit != 0) { 496 if (drive->dn & 1) {
497 /* exit with drive0 selected */ 497 /* exit with drive0 selected */
498 SELECT_DRIVE(&hwif->drives[0]); 498 SELECT_DRIVE(&hwif->drives[0]);
499 msleep(50); 499 msleep(50);
@@ -798,7 +798,7 @@ static int ide_probe_port(ide_hwif_t *hwif)
798 */ 798 */
799 for (unit = 0; unit < MAX_DRIVES; ++unit) { 799 for (unit = 0; unit < MAX_DRIVES; ++unit) {
800 ide_drive_t *drive = &hwif->drives[unit]; 800 ide_drive_t *drive = &hwif->drives[unit];
801 drive->dn = (hwif->channel ? 2 : 0) + unit; 801
802 (void) probe_for_drive(drive); 802 (void) probe_for_drive(drive);
803 if (drive->dev_flags & IDE_DFLAG_PRESENT) 803 if (drive->dev_flags & IDE_DFLAG_PRESENT)
804 rc = 0; 804 rc = 0;
@@ -1357,6 +1357,8 @@ static void ide_port_init_devices(ide_hwif_t *hwif)
1357 for (i = 0; i < MAX_DRIVES; i++) { 1357 for (i = 0; i < MAX_DRIVES; i++) {
1358 ide_drive_t *drive = &hwif->drives[i]; 1358 ide_drive_t *drive = &hwif->drives[i];
1359 1359
1360 drive->dn = i + hwif->channel * 2;
1361
1360 if (hwif->host_flags & IDE_HFLAG_IO_32BIT) 1362 if (hwif->host_flags & IDE_HFLAG_IO_32BIT)
1361 drive->io_32bit = 1; 1363 drive->io_32bit = 1;
1362 if (hwif->host_flags & IDE_HFLAG_UNMASK_IRQS) 1364 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,
1627 1629
1628 if (d == NULL) { 1630 if (d == NULL) {
1629 mate = NULL; 1631 mate = NULL;
1630 continue; 1632 } else {
1631 } 1633 if ((i & 1) && mate) {
1634 hwif->mate = mate;
1635 mate->mate = hwif;
1636 }
1632 1637
1633 if ((i & 1) && mate) { 1638 mate = (i & 1) ? NULL : hwif;
1634 hwif->mate = mate;
1635 mate->mate = hwif;
1636 }
1637 1639
1638 mate = (i & 1) ? NULL : hwif; 1640 ide_init_port(hwif, i & 1, d);
1641 ide_port_cable_detect(hwif);
1642 }
1639 1643
1640 ide_init_port(hwif, i & 1, d);
1641 ide_port_cable_detect(hwif);
1642 ide_port_init_devices(hwif); 1644 ide_port_init_devices(hwif);
1643 } 1645 }
1644 1646