diff options
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r-- | drivers/ide/ide-probe.c | 54 |
1 files changed, 16 insertions, 38 deletions
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 | ||
1343 | int ideprobe_init (void) | 1343 | int 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 | |||
1374 | EXPORT_SYMBOL_GPL(ideprobe_init); | ||
1375 | |||
1376 | int 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 | } |
1390 | EXPORT_SYMBOL_GPL(ide_device_add_all); | ||
1391 | |||
1392 | int 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 | } | ||
1424 | EXPORT_SYMBOL_GPL(ide_device_add); | 1402 | EXPORT_SYMBOL_GPL(ide_device_add); |