summaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-iops.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-16 14:53:54 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-16 14:53:54 -0700
commit42fdd144a40f3afaccaa7ea538268bad3596439e (patch)
tree9986c7f04682408fe1ad983297b0576f68387a68 /drivers/ide/ide-iops.c
parent4314652bb41df08ad65bd25176ba1dfd24b14a51 (diff)
parent64a8f00ff19508b3962c8a932375dbae88bee4d6 (diff)
downloadop-kernel-dev-42fdd144a40f3afaccaa7ea538268bad3596439e.zip
op-kernel-dev-42fdd144a40f3afaccaa7ea538268bad3596439e.tar.gz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (76 commits) IDE: Report errors during drive reset back to user space Update documentation of HDIO_DRIVE_RESET ioctl IDE: Remove unused code IDE: Fix HDIO_DRIVE_RESET handling hd.c: remove the #include <linux/mc146818rtc.h> update the BLK_DEV_HD help text move ide/legacy/hd.c to drivers/block/ ide/legacy/hd.c: use late_initcall() remove BLK_DEV_HD_ONLY ide: endian annotations in ide-floppy.c ide-floppy: zero out the whole struct ide_atapi_pc on init ide-floppy: fold idefloppy_create_test_unit_ready_cmd into idefloppy_open ide-cd: move request prep chunk from cdrom_do_newpc_cont to rq issue path ide-cd: move request prep from cdrom_start_rw_cont to rq issue path ide-cd: move request prep from cdrom_start_seek_continuation to rq issue path ide-cd: fold cdrom_start_seek into ide_cd_do_request ide-cd: simplify request issuing path ide-cd: mv ide_do_rw_cdrom ide_cd_do_request ide-cd: cdrom_start_seek: remove unused argument block ide-cd: ide_do_rw_cdrom: add the catch-all bad request case to the if-else block ...
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r--drivers/ide/ide-iops.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 80ad4f2..44aaec2 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -905,6 +905,14 @@ void ide_execute_pkt_cmd(ide_drive_t *drive)
}
EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd);
+static inline void ide_complete_drive_reset(ide_drive_t *drive, int err)
+{
+ struct request *rq = drive->hwif->hwgroup->rq;
+
+ if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET)
+ ide_end_request(drive, err ? err : 1, 0);
+}
+
/* needed below */
static ide_startstop_t do_reset1 (ide_drive_t *, int);
@@ -940,7 +948,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
}
/* done polling */
hwgroup->polling = 0;
- hwgroup->resetting = 0;
+ ide_complete_drive_reset(drive, 0);
return ide_stopped;
}
@@ -956,12 +964,14 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
ide_hwif_t *hwif = HWIF(drive);
const struct ide_port_ops *port_ops = hwif->port_ops;
u8 tmp;
+ int err = 0;
if (port_ops && port_ops->reset_poll) {
- if (port_ops->reset_poll(drive)) {
+ err = port_ops->reset_poll(drive);
+ if (err) {
printk(KERN_ERR "%s: host reset_poll failure for %s.\n",
hwif->name, drive->name);
- return ide_stopped;
+ goto out;
}
}
@@ -975,6 +985,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
}
printk("%s: reset timed-out, status=0x%02x\n", hwif->name, tmp);
drive->failures++;
+ err = -EIO;
} else {
printk("%s: reset: ", hwif->name);
tmp = ide_read_error(drive);
@@ -1001,10 +1012,12 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
if (tmp & 0x80)
printk("; slave: failed");
printk("\n");
+ err = -EIO;
}
}
+out:
hwgroup->polling = 0; /* done polling */
- hwgroup->resetting = 0; /* done reset attempt */
+ ide_complete_drive_reset(drive, err);
return ide_stopped;
}
@@ -1090,7 +1103,6 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
/* For an ATAPI device, first try an ATAPI SRST. */
if (drive->media != ide_disk && !do_not_try_atapi) {
- hwgroup->resetting = 1;
pre_reset(drive);
SELECT_DRIVE(drive);
udelay (20);
@@ -1112,10 +1124,10 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
if (io_ports->ctl_addr == 0) {
spin_unlock_irqrestore(&ide_lock, flags);
+ ide_complete_drive_reset(drive, -ENXIO);
return ide_stopped;
}
- hwgroup->resetting = 1;
/*
* Note that we also set nIEN while resetting the device,
* to mask unwanted interrupts from the interface during the reset.
OpenPOWER on IntegriCloud