ide: move handling of I/O resources out of ide_probe_port()

Reserve/release I/O resources in ide_device_add_all() instead of
ide_probe_port().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

+12 -11
+12 -11
drivers/ide/ide-probe.c
··· 747 747 if (hwif->noprobe) 748 748 return -EACCES; 749 749 750 - if ((hwif->chipset != ide_4drives || !hwif->mate || !hwif->mate->present) && 751 - (ide_hwif_request_regions(hwif))) { 752 - printk(KERN_ERR "%s: ports already in use, skipping probe\n", 753 - hwif->name); 754 - return -EBUSY; 755 - } 756 - 757 750 /* 758 751 * We must always disable IRQ, as probe_for_drive will assert IRQ, but 759 752 * we'll install our IRQ driver much later... ··· 791 798 if (irqd) 792 799 enable_irq(irqd); 793 800 794 - if (!hwif->present) { 795 - ide_hwif_release_regions(hwif); 801 + if (!hwif->present) 796 802 return -ENODEV; 797 - } 798 803 799 804 for (unit = 0; unit < MAX_DRIVES; unit++) { 800 805 ide_drive_t *drive = &hwif->drives[unit]; ··· 1300 1309 if (idx[i] == 0xff) 1301 1310 continue; 1302 1311 1303 - (void)ide_probe_port(&ide_hwifs[idx[i]]); 1312 + hwif = &ide_hwifs[idx[i]]; 1313 + 1314 + if ((hwif->chipset != ide_4drives || !hwif->mate || 1315 + !hwif->mate->present) && ide_hwif_request_regions(hwif)) { 1316 + printk(KERN_ERR "%s: ports already in use, " 1317 + "skipping probe\n", hwif->name); 1318 + continue; 1319 + } 1320 + 1321 + if (ide_probe_port(hwif) < 0) 1322 + ide_hwif_release_regions(hwif); 1304 1323 } 1305 1324 1306 1325 for (i = 0; i < MAX_HWIFS; i++) {