diff options
author | Christoph Hellwig <hch@lst.de> | 2017-01-31 16:57:30 +0100 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-01-31 22:00:39 +0100 |
commit | 2f5a8e80f79dc82e00f4cca557dc9ceaf064b450 (patch) | |
tree | bc64c6e6f7e24d792742a3547018066568948fba /drivers/ide/ide-atapi.c | |
parent | block: introduce blk_rq_is_passthrough (diff) | |
download | linux-2f5a8e80f79dc82e00f4cca557dc9ceaf064b450.tar.xz linux-2f5a8e80f79dc82e00f4cca557dc9ceaf064b450.zip |
ide: don't abuse cmd_type
Currently the legacy ide driver defines several request types of it's own,
which is in the way of removing that field entirely.
Instead add a type field to struct ide_request and use that to distinguish
the different types of IDE-internal requests.
It's a bit of a mess, but so is the surrounding code..
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r-- | drivers/ide/ide-atapi.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 7c826ecbd276..a8c650e8c92e 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -95,6 +95,7 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk, rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM); scsi_req_init(rq); rq->cmd_type = REQ_TYPE_DRV_PRIV; + ide_req(rq)->type = ATA_PRIV_MISC; rq->special = (char *)pc; if (buf && bufflen) { @@ -193,7 +194,7 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq) BUG_ON(sense_len > sizeof(*sense)); - if (rq->cmd_type == REQ_TYPE_ATA_SENSE || drive->sense_rq_armed) + if (ata_sense_request(rq) || drive->sense_rq_armed) return; memset(sense, 0, sizeof(*sense)); @@ -211,7 +212,8 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq) } sense_rq->rq_disk = rq->rq_disk; - sense_rq->cmd_type = REQ_TYPE_ATA_SENSE; + sense_rq->cmd_type = REQ_TYPE_DRV_PRIV; + ide_req(sense_rq)->type = ATA_PRIV_SENSE; sense_rq->rq_flags |= RQF_PREEMPT; req->cmd[0] = GPCMD_REQUEST_SENSE; @@ -313,10 +315,14 @@ int ide_cd_get_xferlen(struct request *rq) switch (rq->cmd_type) { case REQ_TYPE_FS: return 32768; - case REQ_TYPE_ATA_SENSE: case REQ_TYPE_BLOCK_PC: - case REQ_TYPE_ATA_PC: return blk_rq_bytes(rq); + case REQ_TYPE_DRV_PRIV: + switch (ide_req(rq)->type) { + case ATA_PRIV_PC: + case ATA_PRIV_SENSE: + return blk_rq_bytes(rq); + } default: return 0; } @@ -377,7 +383,7 @@ int ide_check_ireason(ide_drive_t *drive, struct request *rq, int len, drive->name, __func__, ireason); } - if (dev_is_idecd(drive) && rq->cmd_type == REQ_TYPE_ATA_PC) + if (dev_is_idecd(drive) && ata_pc_request(rq)) rq->rq_flags |= RQF_FAILED; return 1; @@ -480,7 +486,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) if (uptodate == 0) drive->failed_pc = NULL; - if (rq->cmd_type == REQ_TYPE_DRV_PRIV) { + if (ata_misc_request(rq)) { rq->errors = 0; error = 0; } else { |