aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-generic.c8
-rw-r--r--drivers/ide/ide-probe.c54
2 files changed, 23 insertions, 39 deletions
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c
index 0f72b98d727f..bb30c29f6ec0 100644
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -14,10 +14,16 @@
14 14
15static int __init ide_generic_init(void) 15static int __init ide_generic_init(void)
16{ 16{
17 u8 idx[MAX_HWIFS];
18 int i;
19
17 if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) 20 if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
18 ide_get_lock(NULL, NULL); /* for atari only */ 21 ide_get_lock(NULL, NULL); /* for atari only */
19 22
20 (void)ideprobe_init(); 23 for (i = 0; i < MAX_HWIFS; i++)
24 idx[i] = ide_hwifs[i].present ? 0xff : i;
25
26 ide_device_add_all(idx);
21 27
22 if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) 28 if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
23 ide_release_lock(); /* for atari only */ 29 ide_release_lock(); /* for atari only */
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index a7a1cd85f15d..1af94ac4892a 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1340,52 +1340,19 @@ static void hwif_register_devices(ide_hwif_t *hwif)
1340 } 1340 }
1341} 1341}
1342 1342
1343int ideprobe_init (void) 1343int ide_device_add_all(u8 idx[MAX_HWIFS])
1344{
1345 unsigned int index;
1346 int probe[MAX_HWIFS];
1347
1348 memset(probe, 0, MAX_HWIFS * sizeof(int));
1349 for (index = 0; index < MAX_HWIFS; ++index)
1350 probe[index] = !ide_hwifs[index].present;
1351
1352 for (index = 0; index < MAX_HWIFS; ++index)
1353 if (probe[index])
1354 probe_hwif(&ide_hwifs[index]);
1355 for (index = 0; index < MAX_HWIFS; ++index)
1356 if (probe[index])
1357 hwif_init(&ide_hwifs[index]);
1358 for (index = 0; index < MAX_HWIFS; ++index) {
1359 if (probe[index]) {
1360 ide_hwif_t *hwif = &ide_hwifs[index];
1361 if (!hwif->present)
1362 continue;
1363 if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced)
1364 hwif->chipset = ide_generic;
1365 hwif_register_devices(hwif);
1366 }
1367 }
1368 for (index = 0; index < MAX_HWIFS; ++index)
1369 if (probe[index])
1370 ide_proc_register_port(&ide_hwifs[index]);
1371 return 0;
1372}
1373
1374EXPORT_SYMBOL_GPL(ideprobe_init);
1375
1376int ide_device_add(u8 idx[4])
1377{ 1344{
1378 ide_hwif_t *hwif; 1345 ide_hwif_t *hwif;
1379 int i, rc = 0; 1346 int i, rc = 0;
1380 1347
1381 for (i = 0; i < 4; i++) { 1348 for (i = 0; i < MAX_HWIFS; i++) {
1382 if (idx[i] == 0xff) 1349 if (idx[i] == 0xff)
1383 continue; 1350 continue;
1384 1351
1385 probe_hwif(&ide_hwifs[idx[i]]); 1352 probe_hwif(&ide_hwifs[idx[i]]);
1386 } 1353 }
1387 1354
1388 for (i = 0; i < 4; i++) { 1355 for (i = 0; i < MAX_HWIFS; i++) {
1389 if (idx[i] == 0xff) 1356 if (idx[i] == 0xff)
1390 continue; 1357 continue;
1391 1358
@@ -1399,7 +1366,7 @@ int ide_device_add(u8 idx[4])
1399 } 1366 }
1400 } 1367 }
1401 1368
1402 for (i = 0; i < 4; i++) { 1369 for (i = 0; i < MAX_HWIFS; i++) {
1403 if (idx[i] == 0xff) 1370 if (idx[i] == 0xff)
1404 continue; 1371 continue;
1405 1372
@@ -1413,12 +1380,23 @@ int ide_device_add(u8 idx[4])
1413 } 1380 }
1414 } 1381 }
1415 1382
1416 for (i = 0; i < 4; i++) { 1383 for (i = 0; i < MAX_HWIFS; i++) {
1417 if (idx[i] != 0xff) 1384 if (idx[i] != 0xff)
1418 ide_proc_register_port(&ide_hwifs[idx[i]]); 1385 ide_proc_register_port(&ide_hwifs[idx[i]]);
1419 } 1386 }
1420 1387
1421 return rc; 1388 return rc;
1422} 1389}
1390EXPORT_SYMBOL_GPL(ide_device_add_all);
1391
1392int ide_device_add(u8 idx[4])
1393{
1394 u8 idx_all[MAX_HWIFS];
1395 int i;
1423 1396
1397 for (i = 0; i < MAX_HWIFS; i++)
1398 idx_all[i] = (i < 4) ? idx[i] : 0xff;
1399
1400 return ide_device_add_all(idx_all);
1401}
1424EXPORT_SYMBOL_GPL(ide_device_add); 1402EXPORT_SYMBOL_GPL(ide_device_add);