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
---
drivers/ide/ide-atapi.c| 18 ++-
drivers/ide/ide-cd.c | 25 -
drivers/ide/ide-cd_ioctl.c | 1 +
drivers/ide/ide-devsets.c | 1 +
drivers/ide/ide-disk.c | 6 +++--
drivers/ide/ide-eh.c | 4 ++--
drivers/ide/ide-floppy.c | 18 ++-
drivers/ide/ide-io.c | 8 +++
drivers/ide/ide-ioctls.c | 4 +++-
drivers/ide/ide-park.c | 2 ++
drivers/ide/ide-pm.c | 16 -
drivers/ide/ide-tape.c | 6 +++--
drivers/ide/ide-taskfile.c | 3 ++-
include/linux/ide.h| 56 +-
14 files changed, 117 insertions(+), 51 deletions(-)
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 7c826ec..a8c650e 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 {
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 6eb9872..207af78 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,
static void ide_cd_complete_failed_rq(ide_drive_t *drive, struct request *rq)
{
/*
-* For REQ_TYPE_ATA_SENSE, "rq->special" points to the original
+* For ATA_PRIV_SENSE, "rq->special" points to the original
* failed request. Also, the sense data should be read
* directly from rq which might be different from the original
* sense buffer if it got copied during mapping.
@@ -282,7 +282,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
"stat 0x%x",
rq->cmd[0], rq->cmd_type, err, stat);
- if (rq->cmd_type == REQ_TYPE_ATA_SENSE) {
+ if (ata_sense_request(rq)) {
/*
* We got an error trying to get sense info from the drive
* (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,
rq = blk_get_request(drive->queue, write, __GFP_RECLAIM);
scsi_req_init(rq);
memcpy(scsi_req(rq)->cmd, cmd, BLK_MAX_CDB);
- rq->cmd_type = REQ_TYPE_ATA_PC;
+ rq->cmd_type = REQ_TYPE_DRV_PRIV;
+ ide_req(rq)->type = ATA_PRIV_PC;