aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-generic.c8
-rw-r--r--drivers/ide/ide-probe.c54
-rw-r--r--include/linux/ide.h3
3 files changed, 24 insertions, 41 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);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index dd50a5c5ec10..d7c0f9a8bd9e 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1011,8 +1011,6 @@ extern void do_ide_request(struct request_queue *);
1011 1011
1012void ide_init_disk(struct gendisk *, ide_drive_t *); 1012void ide_init_disk(struct gendisk *, ide_drive_t *);
1013 1013
1014extern int ideprobe_init(void);
1015
1016#ifdef CONFIG_IDEPCI_PCIBUS_ORDER 1014#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
1017extern void ide_scan_pcibus(int scan_direction) __init; 1015extern void ide_scan_pcibus(int scan_direction) __init;
1018extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); 1016extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
@@ -1203,6 +1201,7 @@ void ide_unregister_region(struct gendisk *);
1203 1201
1204void ide_undecoded_slave(ide_drive_t *); 1202void ide_undecoded_slave(ide_drive_t *);
1205 1203
1204int ide_device_add_all(u8 idx[MAX_HWIFS]);
1206int ide_device_add(u8 idx[4]); 1205int ide_device_add(u8 idx[4]);
1207 1206
1208static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1207static inline void *ide_get_hwifdata (ide_hwif_t * hwif)