/* ide_error() takes action based on the error returned by the drive. For normal I/O that may well include retries. We deal with both new-style (taskfile) and old style command handling here. In the case of taskfile command handling there is work left to do  */
ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat)
/* ide_error() takes action based on the error returned by the drive. For normal I/O that may well include retries. We deal with both new-style (taskfile) and old style command handling here. In the case of taskfile command handling there is work left to do  */
ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat)
{
	struct request *rq;
	u8 err;
	err = ide_dump_status(drive, msg, stat);
	rq = drive->hwif->rq;
	if (rq == NULL)
		return ide_stopped;
	if (!blk_fs_request(rq)) {
		if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
			struct ide_cmd *cmd = rq->special;
			if (cmd)
				ide_complete_cmd(drive, cmd, stat, err);
		} else if (blk_pm_request(rq)) {
			rq->errors = 1;
			ide_complete_pm_rq(drive, rq);
			return ide_stopped;
		}
		rq->errors = err;
		ide_complete_rq(drive, err ? -EIO : 0, blk_rq_bytes(rq));
		return ide_stopped;
	}
	return __ide_error(drive, rq, stat, err);
}