aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-probe.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:36 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:36 -0500
commit139ddfcab50e5eabcc88341c8743a990ac1be6a2 (patch)
treecbe352f976ccd77976b717f49a42cbc839cfb3a5 /drivers/ide/ide-probe.c
parent9d501529b688dada3fd90d91b1517e48d5ac3e05 (diff)
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>
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r--drivers/ide/ide-probe.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 2395498fbc7b..7203d0e48161 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -747,13 +747,6 @@ static int ide_probe_port(ide_hwif_t *hwif)
747 if (hwif->noprobe) 747 if (hwif->noprobe)
748 return -EACCES; 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 * We must always disable IRQ, as probe_for_drive will assert IRQ, but 751 * We must always disable IRQ, as probe_for_drive will assert IRQ, but
759 * we'll install our IRQ driver much later... 752 * we'll install our IRQ driver much later...
@@ -798,10 +791,8 @@ static int ide_probe_port(ide_hwif_t *hwif)
798 if (irqd) 791 if (irqd)
799 enable_irq(irqd); 792 enable_irq(irqd);
800 793
801 if (!hwif->present) { 794 if (!hwif->present)
802 ide_hwif_release_regions(hwif);
803 return -ENODEV; 795 return -ENODEV;
804 }
805 796
806 for (unit = 0; unit < MAX_DRIVES; unit++) { 797 for (unit = 0; unit < MAX_DRIVES; unit++) {
807 ide_drive_t *drive = &hwif->drives[unit]; 798 ide_drive_t *drive = &hwif->drives[unit];
@@ -1309,7 +1300,17 @@ int ide_device_add_all(u8 *idx)
1309 if (idx[i] == 0xff) 1300 if (idx[i] == 0xff)
1310 continue; 1301 continue;
1311 1302
1312 (void)ide_probe_port(&ide_hwifs[idx[i]]); 1303 hwif = &ide_hwifs[idx[i]];
1304
1305 if ((hwif->chipset != ide_4drives || !hwif->mate ||
1306 !hwif->mate->present) && ide_hwif_request_regions(hwif)) {
1307 printk(KERN_ERR "%s: ports already in use, "
1308 "skipping probe\n", hwif->name);
1309 continue;
1310 }
1311
1312 if (ide_probe_port(hwif) < 0)
1313 ide_hwif_release_regions(hwif);
1313 } 1314 }
1314 1315
1315 for (i = 0; i < MAX_HWIFS; i++) { 1316 for (i = 0; i < MAX_HWIFS; i++) {