aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r--drivers/ide/ide-probe.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 06575a12b635..237b9871f80a 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -847,7 +847,6 @@ static void ide_port_tune_devices(ide_hwif_t *hwif)
847 } 847 }
848} 848}
849 849
850#if MAX_HWIFS > 1
851/* 850/*
852 * save_match() is used to simplify logic in init_irq() below. 851 * save_match() is used to simplify logic in init_irq() below.
853 * 852 *
@@ -872,7 +871,6 @@ static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
872 if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */ 871 if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */
873 *match = new; 872 *match = new;
874} 873}
875#endif /* MAX_HWIFS > 1 */
876 874
877/* 875/*
878 * init request queue 876 * init request queue
@@ -1029,7 +1027,7 @@ static int init_irq (ide_hwif_t *hwif)
1029 1027
1030 mutex_lock(&ide_cfg_mtx); 1028 mutex_lock(&ide_cfg_mtx);
1031 hwif->hwgroup = NULL; 1029 hwif->hwgroup = NULL;
1032#if MAX_HWIFS > 1 1030
1033 /* 1031 /*
1034 * Group up with any other hwifs that share our irq(s). 1032 * Group up with any other hwifs that share our irq(s).
1035 */ 1033 */
@@ -1054,7 +1052,7 @@ static int init_irq (ide_hwif_t *hwif)
1054 } 1052 }
1055 } 1053 }
1056 } 1054 }
1057#endif /* MAX_HWIFS > 1 */ 1055
1058 /* 1056 /*
1059 * If we are still without a hwgroup, then form a new one 1057 * If we are still without a hwgroup, then form a new one
1060 */ 1058 */
@@ -1513,19 +1511,14 @@ static int ide_find_port_slot(const struct ide_port_info *d)
1513 * ports 0x1f0/0x170 (the ide0/ide1 defaults). 1511 * ports 0x1f0/0x170 (the ide0/ide1 defaults).
1514 */ 1512 */
1515 mutex_lock(&ide_cfg_mtx); 1513 mutex_lock(&ide_cfg_mtx);
1516 if (MAX_HWIFS == 1) { 1514 if (bootable) {
1517 if (ide_indexes == 0 && i == 0) 1515 if ((ide_indexes | i) != (1 << MAX_HWIFS) - 1)
1518 idx = 1; 1516 idx = ffz(ide_indexes | i);
1519 } else { 1517 } else {
1520 if (bootable) { 1518 if ((ide_indexes | 3) != (1 << MAX_HWIFS) - 1)
1521 if ((ide_indexes | i) != (1 << MAX_HWIFS) - 1) 1519 idx = ffz(ide_indexes | 3);
1522 idx = ffz(ide_indexes | i); 1520 else if ((ide_indexes & 3) != 3)
1523 } else { 1521 idx = ffz(ide_indexes);
1524 if ((ide_indexes | 3) != (1 << MAX_HWIFS) - 1)
1525 idx = ffz(ide_indexes | 3);
1526 else if ((ide_indexes & 3) != 3)
1527 idx = ffz(ide_indexes);
1528 }
1529 } 1522 }
1530 if (idx >= 0) 1523 if (idx >= 0)
1531 ide_indexes |= (1 << idx); 1524 ide_indexes |= (1 << idx);