aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r--drivers/ide/ide-probe.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 548864510ba9..d8c1c3e735bb 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -260,7 +260,7 @@ int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id)
260 * during the identify phase that the IRQ handler isn't expecting. 260 * during the identify phase that the IRQ handler isn't expecting.
261 */ 261 */
262 if (io_ports->ctl_addr) 262 if (io_ports->ctl_addr)
263 tp_ops->set_irq(hwif, 0); 263 tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
264 264
265 /* take a deep breath */ 265 /* take a deep breath */
266 msleep(50); 266 msleep(50);
@@ -390,13 +390,13 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
390 * (e.g. crw9624 as drive0 with disk as slave) 390 * (e.g. crw9624 as drive0 with disk as slave)
391 */ 391 */
392 msleep(50); 392 msleep(50);
393 SELECT_DRIVE(drive); 393 tp_ops->dev_select(drive);
394 msleep(50); 394 msleep(50);
395 395
396 if (ide_read_device(drive) != drive->select && present == 0) { 396 if (ide_read_device(drive) != drive->select && present == 0) {
397 if (drive->dn & 1) { 397 if (drive->dn & 1) {
398 /* exit with drive0 selected */ 398 /* exit with drive0 selected */
399 SELECT_DRIVE(hwif->devices[0]); 399 tp_ops->dev_select(hwif->devices[0]);
400 /* allow ATA_BUSY to assert & clear */ 400 /* allow ATA_BUSY to assert & clear */
401 msleep(50); 401 msleep(50);
402 } 402 }
@@ -422,7 +422,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
422 printk(KERN_ERR "%s: no response (status = 0x%02x), " 422 printk(KERN_ERR "%s: no response (status = 0x%02x), "
423 "resetting drive\n", drive->name, stat); 423 "resetting drive\n", drive->name, stat);
424 msleep(50); 424 msleep(50);
425 SELECT_DRIVE(drive); 425 tp_ops->dev_select(drive);
426 msleep(50); 426 msleep(50);
427 tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET); 427 tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET);
428 (void)ide_busy_sleep(hwif, WAIT_WORSTCASE, 0); 428 (void)ide_busy_sleep(hwif, WAIT_WORSTCASE, 0);
@@ -441,7 +441,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
441 } 441 }
442 if (drive->dn & 1) { 442 if (drive->dn & 1) {
443 /* exit with drive0 selected */ 443 /* exit with drive0 selected */
444 SELECT_DRIVE(hwif->devices[0]); 444 tp_ops->dev_select(hwif->devices[0]);
445 msleep(50); 445 msleep(50);
446 /* ensure drive irq is clear */ 446 /* ensure drive irq is clear */
447 (void)tp_ops->read_status(hwif); 447 (void)tp_ops->read_status(hwif);
@@ -605,6 +605,7 @@ out:
605 605
606static int ide_port_wait_ready(ide_hwif_t *hwif) 606static int ide_port_wait_ready(ide_hwif_t *hwif)
607{ 607{
608 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
608 ide_drive_t *drive; 609 ide_drive_t *drive;
609 int i, rc; 610 int i, rc;
610 611
@@ -627,8 +628,8 @@ static int ide_port_wait_ready(ide_hwif_t *hwif)
627 /* Ignore disks that we will not probe for later. */ 628 /* Ignore disks that we will not probe for later. */
628 if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0 || 629 if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0 ||
629 (drive->dev_flags & IDE_DFLAG_PRESENT)) { 630 (drive->dev_flags & IDE_DFLAG_PRESENT)) {
630 SELECT_DRIVE(drive); 631 tp_ops->dev_select(drive);
631 hwif->tp_ops->set_irq(hwif, 1); 632 tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
632 mdelay(2); 633 mdelay(2);
633 rc = ide_wait_not_busy(hwif, 35000); 634 rc = ide_wait_not_busy(hwif, 35000);
634 if (rc) 635 if (rc)
@@ -640,7 +641,7 @@ static int ide_port_wait_ready(ide_hwif_t *hwif)
640out: 641out:
641 /* Exit function with master reselected (let's be sane) */ 642 /* Exit function with master reselected (let's be sane) */
642 if (i) 643 if (i)
643 SELECT_DRIVE(hwif->devices[0]); 644 tp_ops->dev_select(hwif->devices[0]);
644 645
645 return rc; 646 return rc;
646} 647}
@@ -845,7 +846,7 @@ static int init_irq (ide_hwif_t *hwif)
845 irq_handler = ide_intr; 846 irq_handler = ide_intr;
846 847
847 if (io_ports->ctl_addr) 848 if (io_ports->ctl_addr)
848 hwif->tp_ops->set_irq(hwif, 1); 849 hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
849 850
850 if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif)) 851 if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif))
851 goto out_up; 852 goto out_up;
@@ -942,20 +943,16 @@ EXPORT_SYMBOL_GPL(ide_init_disk);
942static void drive_release_dev (struct device *dev) 943static void drive_release_dev (struct device *dev)
943{ 944{
944 ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); 945 ide_drive_t *drive = container_of(dev, ide_drive_t, gendev);
945 ide_hwif_t *hwif = drive->hwif;
946 946
947 ide_proc_unregister_device(drive); 947 ide_proc_unregister_device(drive);
948 948
949 spin_lock_irq(&hwif->lock); 949 blk_cleanup_queue(drive->queue);
950 drive->queue = NULL;
951
950 kfree(drive->id); 952 kfree(drive->id);
951 drive->id = NULL; 953 drive->id = NULL;
954
952 drive->dev_flags &= ~IDE_DFLAG_PRESENT; 955 drive->dev_flags &= ~IDE_DFLAG_PRESENT;
953 /* Messed up locking ... */
954 spin_unlock_irq(&hwif->lock);
955 blk_cleanup_queue(drive->queue);
956 spin_lock_irq(&hwif->lock);
957 drive->queue = NULL;
958 spin_unlock_irq(&hwif->lock);
959 956
960 complete(&drive->gendev_rel_comp); 957 complete(&drive->gendev_rel_comp);
961} 958}