aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-iops.c
diff options
context:
space:
mode:
authorElias Oltmanns <eo@nebensachen.de>2008-07-16 14:33:48 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-16 14:33:48 -0400
commit64a8f00ff19508b3962c8a932375dbae88bee4d6 (patch)
tree6ec1de97fa6524987f133eee38e30af5e545aeb9 /drivers/ide/ide-iops.c
parentbb7ee9b1ec15358af870a81b0c6a03af29417f99 (diff)
IDE: Report errors during drive reset back to user space
Make sure that each error condition during the execution of an HDIO_DRIVE_RESET ioctl is actually reported to the calling process. Also, unify the exit path of reset_pollfunc() when returning ide_stopped since the need of ->port_ops->reset_poll() to be treated specially has vanished (way back, it seems). Signed-off-by: Elias Oltmanns <eo@nebensachen.de> Cc: "Alan Cox" <alan@lxorguk.ukuu.org.uk> Cc: "Randy Dunlap" <randy.dunlap@oracle.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r--drivers/ide/ide-iops.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 96f63eb12092..44aaec256a30 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -905,12 +905,12 @@ void ide_execute_pkt_cmd(ide_drive_t *drive)
905} 905}
906EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd); 906EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd);
907 907
908static inline void ide_complete_drive_reset(ide_drive_t *drive) 908static inline void ide_complete_drive_reset(ide_drive_t *drive, int err)
909{ 909{
910 struct request *rq = drive->hwif->hwgroup->rq; 910 struct request *rq = drive->hwif->hwgroup->rq;
911 911
912 if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) 912 if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET)
913 ide_end_request(drive, 1, 0); 913 ide_end_request(drive, err ? err : 1, 0);
914} 914}
915 915
916/* needed below */ 916/* needed below */
@@ -948,7 +948,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
948 } 948 }
949 /* done polling */ 949 /* done polling */
950 hwgroup->polling = 0; 950 hwgroup->polling = 0;
951 ide_complete_drive_reset(drive); 951 ide_complete_drive_reset(drive, 0);
952 return ide_stopped; 952 return ide_stopped;
953} 953}
954 954
@@ -964,9 +964,11 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
964 ide_hwif_t *hwif = HWIF(drive); 964 ide_hwif_t *hwif = HWIF(drive);
965 const struct ide_port_ops *port_ops = hwif->port_ops; 965 const struct ide_port_ops *port_ops = hwif->port_ops;
966 u8 tmp; 966 u8 tmp;
967 int err = 0;
967 968
968 if (port_ops && port_ops->reset_poll) { 969 if (port_ops && port_ops->reset_poll) {
969 if (port_ops->reset_poll(drive)) { 970 err = port_ops->reset_poll(drive);
971 if (err) {
970 printk(KERN_ERR "%s: host reset_poll failure for %s.\n", 972 printk(KERN_ERR "%s: host reset_poll failure for %s.\n",
971 hwif->name, drive->name); 973 hwif->name, drive->name);
972 goto out; 974 goto out;
@@ -983,6 +985,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
983 } 985 }
984 printk("%s: reset timed-out, status=0x%02x\n", hwif->name, tmp); 986 printk("%s: reset timed-out, status=0x%02x\n", hwif->name, tmp);
985 drive->failures++; 987 drive->failures++;
988 err = -EIO;
986 } else { 989 } else {
987 printk("%s: reset: ", hwif->name); 990 printk("%s: reset: ", hwif->name);
988 tmp = ide_read_error(drive); 991 tmp = ide_read_error(drive);
@@ -1009,11 +1012,12 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
1009 if (tmp & 0x80) 1012 if (tmp & 0x80)
1010 printk("; slave: failed"); 1013 printk("; slave: failed");
1011 printk("\n"); 1014 printk("\n");
1015 err = -EIO;
1012 } 1016 }
1013 } 1017 }
1014 hwgroup->polling = 0; /* done polling */
1015out: 1018out:
1016 ide_complete_drive_reset(drive); 1019 hwgroup->polling = 0; /* done polling */
1020 ide_complete_drive_reset(drive, err);
1017 return ide_stopped; 1021 return ide_stopped;
1018} 1022}
1019 1023
@@ -1120,7 +1124,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
1120 1124
1121 if (io_ports->ctl_addr == 0) { 1125 if (io_ports->ctl_addr == 0) {
1122 spin_unlock_irqrestore(&ide_lock, flags); 1126 spin_unlock_irqrestore(&ide_lock, flags);
1123 ide_complete_drive_reset(drive); 1127 ide_complete_drive_reset(drive, -ENXIO);
1124 return ide_stopped; 1128 return ide_stopped;
1125 } 1129 }
1126 1130