aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide.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.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.c')
-rw-r--r--drivers/ide/ide.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 1ec983b00511..d4a6b102a772 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -529,17 +529,20 @@ static int generic_ide_resume(struct device *dev)
529 return err; 529 return err;
530} 530}
531 531
532static void generic_drive_reset(ide_drive_t *drive) 532static int generic_drive_reset(ide_drive_t *drive)
533{ 533{
534 struct request *rq; 534 struct request *rq;
535 int ret = 0;
535 536
536 rq = blk_get_request(drive->queue, READ, __GFP_WAIT); 537 rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
537 rq->cmd_type = REQ_TYPE_SPECIAL; 538 rq->cmd_type = REQ_TYPE_SPECIAL;
538 rq->cmd_len = 1; 539 rq->cmd_len = 1;
539 rq->cmd[0] = REQ_DRIVE_RESET; 540 rq->cmd[0] = REQ_DRIVE_RESET;
540 rq->cmd_flags |= REQ_SOFTBARRIER; 541 rq->cmd_flags |= REQ_SOFTBARRIER;
541 blk_execute_rq(drive->queue, NULL, rq, 1); 542 if (blk_execute_rq(drive->queue, NULL, rq, 1))
543 ret = rq->errors;
542 blk_put_request(rq); 544 blk_put_request(rq);
545 return ret;
543} 546}
544 547
545int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev, 548int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev,
@@ -616,8 +619,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
616 if (!capable(CAP_SYS_ADMIN)) 619 if (!capable(CAP_SYS_ADMIN))
617 return -EACCES; 620 return -EACCES;
618 621
619 generic_drive_reset(drive); 622 return generic_drive_reset(drive);
620 return 0;
621 623
622 case HDIO_GET_BUSSTATE: 624 case HDIO_GET_BUSSTATE:
623 if (!capable(CAP_SYS_ADMIN)) 625 if (!capable(CAP_SYS_ADMIN))