summaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-01-31 10:57:30 -0500
committerJens Axboe <axboe@fb.com>2017-01-31 16:00:39 -0500
commit2f5a8e80f79dc82e00f4cca557dc9ceaf064b450 (patch)
treebc64c6e6f7e24d792742a3547018066568948fba /drivers/ide/ide-cd.c
parent57292b58ddb58689e8c3b4c6eadbef10d9ca44dd (diff)
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-cd.c')
-rw-r--r--drivers/ide/ide-cd.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 6eb98725e194..207af7816544 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -210,7 +210,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
210static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq) 210static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
211{ 211{
212 /* 212 /*
213 * For REQ_TYPE_ATA_SENSE, "rq->special" points to the original 213 * For ATA_PRIV_SENSE, "rq->special" points to the original
214 * failed request. Also, the sense data should be read 214 * failed request. Also, the sense data should be read
215 * directly from rq which might be different from the original 215 * directly from rq which might be different from the original
216 * sense buffer if it got copied during mapping. 216 * sense buffer if it got copied during mapping.
@@ -282,7 +282,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
282 "stat 0x%x", 282 "stat 0x%x",
283 rq->cmd[0], rq->cmd_type, err, stat); 283 rq->cmd[0], rq->cmd_type, err, stat);
284 284
285 if (rq->cmd_type == REQ_TYPE_ATA_SENSE) { 285 if (ata_sense_request(rq)) {
286 /* 286 /*
287 * We got an error trying to get sense info from the drive 287 * We got an error trying to get sense info from the drive
288 * (probably while trying to recover from a former error). 288 * (probably while trying to recover from a former error).
@@ -438,7 +438,8 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
438 rq = blk_get_request(drive->queue, write, __GFP_RECLAIM); 438 rq = blk_get_request(drive->queue, write, __GFP_RECLAIM);
439 scsi_req_init(rq); 439 scsi_req_init(rq);
440 memcpy(scsi_req(rq)->cmd, cmd, BLK_MAX_CDB); 440 memcpy(scsi_req(rq)->cmd, cmd, BLK_MAX_CDB);
441 rq->cmd_type = REQ_TYPE_ATA_PC; 441 rq->cmd_type = REQ_TYPE_DRV_PRIV;
442 ide_req(rq)->type = ATA_PRIV_PC;
442 rq->rq_flags |= rq_flags; 443 rq->rq_flags |= rq_flags;
443 rq->timeout = timeout; 444 rq->timeout = timeout;
444 if (buffer) { 445 if (buffer) {
@@ -520,7 +521,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
520 ide_expiry_t *expiry = NULL; 521 ide_expiry_t *expiry = NULL;
521 int dma_error = 0, dma, thislen, uptodate = 0; 522 int dma_error = 0, dma, thislen, uptodate = 0;
522 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0; 523 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0;
523 int sense = (rq->cmd_type == REQ_TYPE_ATA_SENSE); 524 int sense = ata_sense_request(rq);
524 unsigned int timeout; 525 unsigned int timeout;
525 u16 len; 526 u16 len;
526 u8 ireason, stat; 527 u8 ireason, stat;
@@ -785,18 +786,22 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
785 if (cdrom_start_rw(drive, rq) == ide_stopped) 786 if (cdrom_start_rw(drive, rq) == ide_stopped)
786 goto out_end; 787 goto out_end;
787 break; 788 break;
788 case REQ_TYPE_ATA_SENSE:
789 case REQ_TYPE_BLOCK_PC: 789 case REQ_TYPE_BLOCK_PC:
790 case REQ_TYPE_ATA_PC: 790 handle_pc:
791 if (!rq->timeout) 791 if (!rq->timeout)
792 rq->timeout = ATAPI_WAIT_PC; 792 rq->timeout = ATAPI_WAIT_PC;
793
794 cdrom_do_block_pc(drive, rq); 793 cdrom_do_block_pc(drive, rq);
795 break; 794 break;
796 case REQ_TYPE_DRV_PRIV: 795 case REQ_TYPE_DRV_PRIV:
797 /* right now this can only be a reset... */ 796 switch (ide_req(rq)->type) {
798 uptodate = 1; 797 case ATA_PRIV_MISC:
799 goto out_end; 798 /* right now this can only be a reset... */
799 uptodate = 1;
800 goto out_end;
801 case ATA_PRIV_SENSE:
802 case ATA_PRIV_PC:
803 goto handle_pc;
804 }
800 default: 805 default:
801 BUG(); 806 BUG();
802 } 807 }