diff options
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r-- | drivers/ide/ide-probe.c | 50 |
1 files changed, 7 insertions, 43 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index ebc328c2e7ee..c63c07807583 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -255,9 +255,7 @@ err_misc: | |||
255 | * @cmd: command to use | 255 | * @cmd: command to use |
256 | * | 256 | * |
257 | * try_to_identify() sends an ATA(PI) IDENTIFY request to a drive | 257 | * try_to_identify() sends an ATA(PI) IDENTIFY request to a drive |
258 | * and waits for a response. It also monitors irqs while this is | 258 | * and waits for a response. |
259 | * happening, in hope of automatically determining which one is | ||
260 | * being used by the interface. | ||
261 | * | 259 | * |
262 | * Returns: 0 device was identified | 260 | * Returns: 0 device was identified |
263 | * 1 device timed-out (no response to identify request) | 261 | * 1 device timed-out (no response to identify request) |
@@ -334,56 +332,22 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd) | |||
334 | * @drive: drive to probe | 332 | * @drive: drive to probe |
335 | * @cmd: command to use | 333 | * @cmd: command to use |
336 | * | 334 | * |
337 | * Issue the identify command and then do IRQ probing to | 335 | * Issue the identify command. |
338 | * complete the identification when needed by finding the | ||
339 | * IRQ the drive is attached to | ||
340 | */ | 336 | */ |
341 | 337 | ||
342 | static int try_to_identify (ide_drive_t *drive, u8 cmd) | 338 | static int try_to_identify (ide_drive_t *drive, u8 cmd) |
343 | { | 339 | { |
344 | ide_hwif_t *hwif = drive->hwif; | 340 | ide_hwif_t *hwif = drive->hwif; |
345 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 341 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
346 | int retval; | ||
347 | int autoprobe = 0; | ||
348 | unsigned long cookie = 0; | ||
349 | 342 | ||
350 | /* | 343 | /* |
351 | * Disable device irq unless we need to | 344 | * Disable device IRQ. Otherwise we'll get spurious interrupts |
352 | * probe for it. Otherwise we'll get spurious | 345 | * during the identify phase that the IRQ handler isn't expecting. |
353 | * interrupts during the identify-phase that | ||
354 | * the irq handler isn't expecting. | ||
355 | */ | 346 | */ |
356 | if (hwif->io_ports.ctl_addr) { | 347 | if (hwif->io_ports.ctl_addr) |
357 | if (!hwif->irq) { | ||
358 | autoprobe = 1; | ||
359 | cookie = probe_irq_on(); | ||
360 | } | ||
361 | tp_ops->set_irq(hwif, autoprobe); | ||
362 | } | ||
363 | |||
364 | retval = actual_try_to_identify(drive, cmd); | ||
365 | |||
366 | if (autoprobe) { | ||
367 | int irq; | ||
368 | |||
369 | tp_ops->set_irq(hwif, 0); | 348 | tp_ops->set_irq(hwif, 0); |
370 | /* clear drive IRQ */ | 349 | |
371 | (void)tp_ops->read_status(hwif); | 350 | return actual_try_to_identify(drive, cmd); |
372 | udelay(5); | ||
373 | irq = probe_irq_off(cookie); | ||
374 | if (!hwif->irq) { | ||
375 | if (irq > 0) { | ||
376 | hwif->irq = irq; | ||
377 | } else { | ||
378 | /* Mmmm.. multiple IRQs.. | ||
379 | * don't know which was ours | ||
380 | */ | ||
381 | printk(KERN_ERR "%s: IRQ probe failed (0x%lx)\n", | ||
382 | drive->name, cookie); | ||
383 | } | ||
384 | } | ||
385 | } | ||
386 | return retval; | ||
387 | } | 351 | } |
388 | 352 | ||
389 | int ide_busy_sleep(ide_hwif_t *hwif, unsigned long timeout, int altstatus) | 353 | int ide_busy_sleep(ide_hwif_t *hwif, unsigned long timeout, int altstatus) |