]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
ide: don't abuse cmd_type
authorChristoph Hellwig <hch@lst.de>
Tue, 31 Jan 2017 15:57:30 +0000 (16:57 +0100)
committerJens Axboe <axboe@fb.com>
Tue, 31 Jan 2017 21:00:39 +0000 (14:00 -0700)
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>
14 files changed:
drivers/ide/ide-atapi.c
drivers/ide/ide-cd.c
drivers/ide/ide-cd_ioctl.c
drivers/ide/ide-devsets.c
drivers/ide/ide-disk.c
drivers/ide/ide-eh.c
drivers/ide/ide-floppy.c
drivers/ide/ide-io.c
drivers/ide/ide-ioctls.c
drivers/ide/ide-park.c
drivers/ide/ide-pm.c
drivers/ide/ide-tape.c
drivers/ide/ide-taskfile.c
include/linux/ide.h

index 7c826ecbd276ce2323d0e9bf676ea01a7b5dcb65..a8c650e8c92ef65760c2c06d5e89149cc2df0dc0 100644 (file)
@@ -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 {
index 6eb98725e194aafb1427f17aeb8b4faf53e2dbf3..207af7816544ee765b777917f38882ac1a8c11f9 100644 (file)
@@ -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;
                rq->rq_flags |= rq_flags;
                rq->timeout = timeout;
                if (buffer) {
@@ -520,7 +521,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
        ide_expiry_t *expiry = NULL;
        int dma_error = 0, dma, thislen, uptodate = 0;
        int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0;
-       int sense = (rq->cmd_type == REQ_TYPE_ATA_SENSE);
+       int sense = ata_sense_request(rq);
        unsigned int timeout;
        u16 len;
        u8 ireason, stat;
@@ -785,18 +786,22 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
                if (cdrom_start_rw(drive, rq) == ide_stopped)
                        goto out_end;
                break;
-       case REQ_TYPE_ATA_SENSE:
        case REQ_TYPE_BLOCK_PC:
-       case REQ_TYPE_ATA_PC:
+       handle_pc:
                if (!rq->timeout)
                        rq->timeout = ATAPI_WAIT_PC;
-
                cdrom_do_block_pc(drive, rq);
                break;
        case REQ_TYPE_DRV_PRIV:
-               /* right now this can only be a reset... */
-               uptodate = 1;
-               goto out_end;
+               switch (ide_req(rq)->type) {
+               case ATA_PRIV_MISC:
+                       /* right now this can only be a reset... */
+                       uptodate = 1;
+                       goto out_end;
+               case ATA_PRIV_SENSE:
+               case ATA_PRIV_PC:
+                       goto handle_pc;
+               }
        default:
                BUG();
        }
index da0aa0153fb1bd2bfe8857e86e26a195fb540cb2..3f03eed0ff788f44115ece617642c80497b87f57 100644 (file)
@@ -306,6 +306,7 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi)
        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->rq_flags = RQF_QUIET;
        ret = blk_execute_rq(drive->queue, cd->disk, rq, 0);
        blk_put_request(rq);
index fd56c9dd9bc752a4000122be649f9adc870d3288..c040b9de2b4e46f1007fb50311b7e59713bde4a4 100644 (file)
@@ -168,6 +168,7 @@ int ide_devset_execute(ide_drive_t *drive, const struct ide_devset *setting,
        rq = blk_get_request(q, READ, __GFP_RECLAIM);
        scsi_req_init(rq);
        rq->cmd_type = REQ_TYPE_DRV_PRIV;
+       ide_req(rq)->type = ATA_PRIV_MISC;
        scsi_req(rq)->cmd_len = 5;
        scsi_req(rq)->cmd[0] = REQ_DEVSET_EXEC;
        *(int *)&scsi_req(rq)->cmd[1] = arg;
index 3437c5b285995797553119a61a3ed90b6e69810e..69cf71729841abdec28f37de91beffbc2836ae62 100644 (file)
@@ -453,7 +453,8 @@ static int idedisk_prep_fn(struct request_queue *q, struct request *rq)
        cmd->tf_flags = IDE_TFLAG_DYN;
        cmd->protocol = ATA_PROT_NODATA;
 
-       rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
+       rq->cmd_type = REQ_TYPE_DRV_PRIV;
+       ide_req(rq)->type = ATA_PRIV_TASKFILE;
        rq->special = cmd;
        cmd->rq = rq;
 
@@ -479,7 +480,8 @@ static int set_multcount(ide_drive_t *drive, int arg)
 
        rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM);
        scsi_req_init(rq);
-       rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
+       rq->cmd_type = REQ_TYPE_DRV_PRIV;
+       ide_req(rq)->type = ATA_PRIV_TASKFILE;
 
        drive->mult_req = arg;
        drive->special_flags |= IDE_SFLAG_SET_MULTMODE;
index 35e5b892f9d777a21b2be70097e8a6945f7eb96b..1e4b1476e55926b9033201a9064826577758934f 100644 (file)
@@ -124,7 +124,7 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat)
 
        /* retry only "normal" I/O: */
        if (rq->cmd_type != REQ_TYPE_FS) {
-               if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
+               if (ata_taskfile_request(rq)) {
                        struct ide_cmd *cmd = rq->special;
 
                        if (cmd)
@@ -147,7 +147,7 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err)
 {
        struct request *rq = drive->hwif->rq;
 
-       if (rq && rq->cmd_type == REQ_TYPE_DRV_PRIV &&
+       if (rq && ata_misc_request(rq) &&
            scsi_req(rq)->cmd[0] == REQ_DRIVE_RESET) {
                if (err <= 0 && rq->errors == 0)
                        rq->errors = -EIO;
index 3bd678ad351951fef4b621ddb0129aede9179d4b..24c6d363b3a4cadc204a3c1f96f3a0e4d5b9e702 100644 (file)
@@ -97,7 +97,7 @@ static int ide_floppy_callback(ide_drive_t *drive, int dsc)
                               "Aborting request!\n");
        }
 
-       if (rq->cmd_type == REQ_TYPE_DRV_PRIV)
+       if (ata_misc_request(rq))
                rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
 
        return uptodate;
@@ -246,7 +246,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
                } else
                        printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
 
-               if (rq->cmd_type == REQ_TYPE_DRV_PRIV) {
+               if (ata_misc_request(rq)) {
                        rq->errors = 0;
                        ide_complete_rq(drive, 0, blk_rq_bytes(rq));
                        return ide_stopped;
@@ -265,14 +265,20 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
                pc = &floppy->queued_pc;
                idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block);
                break;
-       case REQ_TYPE_DRV_PRIV:
-       case REQ_TYPE_ATA_SENSE:
-               pc = (struct ide_atapi_pc *)rq->special;
-               break;
        case REQ_TYPE_BLOCK_PC:
                pc = &floppy->queued_pc;
                idefloppy_blockpc_cmd(floppy, pc, rq);
                break;
+       case REQ_TYPE_DRV_PRIV:
+               switch (ide_req(rq)->type) {
+               case ATA_PRIV_MISC:
+               case ATA_PRIV_SENSE:
+                       pc = (struct ide_atapi_pc *)rq->special;
+                       break;
+               default:
+                       BUG();
+               }
+               break;
        default:
                BUG();
        }
index 3378503afed4f838bc4339c26e170c08a32fd4d7..6735c92b8da7d6d7c7d603445fb70f33a39c312e 100644 (file)
@@ -102,7 +102,7 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
                        drive->dev_flags |= IDE_DFLAG_PARKED;
        }
 
-       if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
+       if (rq && ata_taskfile_request(rq)) {
                struct ide_cmd *orig_cmd = rq->special;
 
                if (cmd->tf_flags & IDE_TFLAG_DYN)
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(ide_complete_rq);
 
 void ide_kill_rq(ide_drive_t *drive, struct request *rq)
 {
-       u8 drv_req = (rq->cmd_type == REQ_TYPE_DRV_PRIV) && rq->rq_disk;
+       u8 drv_req = ata_misc_request(rq) && rq->rq_disk;
        u8 media = drive->media;
 
        drive->failed_pc = NULL;
@@ -340,7 +340,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
                if (drive->current_speed == 0xff)
                        ide_config_drive_speed(drive, drive->desired_speed);
 
-               if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
+               if (ata_taskfile_request(rq))
                        return execute_drive_cmd(drive, rq);
                else if (ata_pm_request(rq)) {
                        struct ide_pm_state *pm = rq->special;
@@ -353,7 +353,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
                            pm->pm_step == IDE_PM_COMPLETED)
                                ide_complete_pm_rq(drive, rq);
                        return startstop;
-               } else if (!rq->rq_disk && rq->cmd_type == REQ_TYPE_DRV_PRIV)
+               } else if (!rq->rq_disk && ata_misc_request(rq))
                        /*
                         * TODO: Once all ULDs have been modified to
                         * check for specific op codes rather than
index a5d22c6e956a1aac6c1efc240fdf3e2e1f32af42..fc19e842deefb2e55429a793977bd8db6bfea6fa 100644 (file)
@@ -127,7 +127,8 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
 
                rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM);
                scsi_req_init(rq);
-               rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
+               rq->cmd_type = REQ_TYPE_DRV_PRIV;
+               ide_req(rq)->type = ATA_PRIV_TASKFILE;
                err = blk_execute_rq(drive->queue, NULL, rq, 0);
                blk_put_request(rq);
 
@@ -225,6 +226,7 @@ static int generic_drive_reset(ide_drive_t *drive)
        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;
        scsi_req(rq)->cmd_len = 1;
        scsi_req(rq)->cmd[0] = REQ_DRIVE_RESET;
        if (blk_execute_rq(drive->queue, NULL, rq, 1))
index c37604a75097840ff72785ca560e96aeacd8447f..fc3c944ca4be2a8ff9e4b1bcaa9bbf34c7805a49 100644 (file)
@@ -36,6 +36,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
        scsi_req(rq)->cmd[0] = REQ_PARK_HEADS;
        scsi_req(rq)->cmd_len = 1;
        rq->cmd_type = REQ_TYPE_DRV_PRIV;
+       ide_req(rq)->type = ATA_PRIV_MISC;
        rq->special = &timeout;
        rc = blk_execute_rq(q, NULL, rq, 1);
        blk_put_request(rq);
@@ -54,6 +55,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
        scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS;
        scsi_req(rq)->cmd_len = 1;
        rq->cmd_type = REQ_TYPE_DRV_PRIV;
+       ide_req(rq)->type = ATA_PRIV_MISC;
        elv_add_request(q, rq, ELEVATOR_INSERT_FRONT);
 
 out:
index f6767aba7cfbb7bd4c97981022f583bf60951dc0..0c1296815dfad25be614f377933fc4f580b7325e 100644 (file)
@@ -20,7 +20,8 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
        memset(&rqpm, 0, sizeof(rqpm));
        rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM);
        scsi_req_init(rq);
-       rq->cmd_type = REQ_TYPE_ATA_PM_SUSPEND;
+       rq->cmd_type = REQ_TYPE_DRV_PRIV;
+       ide_req(rq)->type = ATA_PRIV_PM_SUSPEND;
        rq->special = &rqpm;
        rqpm.pm_step = IDE_PM_START_SUSPEND;
        if (mesg.event == PM_EVENT_PRETHAW)
@@ -91,7 +92,8 @@ int generic_ide_resume(struct device *dev)
        memset(&rqpm, 0, sizeof(rqpm));
        rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM);
        scsi_req_init(rq);
-       rq->cmd_type = REQ_TYPE_ATA_PM_RESUME;
+       rq->cmd_type = REQ_TYPE_DRV_PRIV;
+       ide_req(rq)->type = ATA_PRIV_PM_RESUME;
        rq->rq_flags |= RQF_PREEMPT;
        rq->special = &rqpm;
        rqpm.pm_step = IDE_PM_START_RESUME;
@@ -223,10 +225,10 @@ void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
 
 #ifdef DEBUG_PM
        printk("%s: completing PM request, %s\n", drive->name,
-              (rq->cmd_type == REQ_TYPE_ATA_PM_SUSPEND) ? "suspend" : "resume");
+              (ide_req(rq)->type == ATA_PRIV_PM_SUSPEND) ? "suspend" : "resume");
 #endif
        spin_lock_irqsave(q->queue_lock, flags);
-       if (rq->cmd_type == REQ_TYPE_ATA_PM_SUSPEND)
+       if (ide_req(rq)->type == ATA_PRIV_PM_SUSPEND)
                blk_stop_queue(q);
        else
                drive->dev_flags &= ~IDE_DFLAG_BLOCKED;
@@ -242,11 +244,13 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
 {
        struct ide_pm_state *pm = rq->special;
 
-       if (rq->cmd_type == REQ_TYPE_ATA_PM_SUSPEND &&
+       if (rq->cmd_type == REQ_TYPE_DRV_PRIV &&
+           ide_req(rq)->type == ATA_PRIV_PM_SUSPEND &&
            pm->pm_step == IDE_PM_START_SUSPEND)
                /* Mark drive blocked when starting the suspend sequence. */
                drive->dev_flags |= IDE_DFLAG_BLOCKED;
-       else if (rq->cmd_type == REQ_TYPE_ATA_PM_RESUME &&
+       else if (rq->cmd_type == REQ_TYPE_DRV_PRIV &&
+                ide_req(rq)->type == ATA_PRIV_PM_RESUME &&
                 pm->pm_step == IDE_PM_START_RESUME) {
                /*
                 * The first thing we do on wakeup is to wait for BSY bit to
index f6bc1e2bb03593fe0c6195a9a839f6e7e4310a0d..37c7beabaacc55ba02ed66b68c7e0e8109508b08 100644 (file)
@@ -577,8 +577,9 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
                      req->cmd[0], (unsigned long long)blk_rq_pos(rq),
                      blk_rq_sectors(rq));
 
-       BUG_ON(!(rq->cmd_type == REQ_TYPE_DRV_PRIV ||
-                rq->cmd_type == REQ_TYPE_ATA_SENSE));
+       BUG_ON(rq->cmd_type != REQ_TYPE_DRV_PRIV);
+       BUG_ON(ide_req(rq)->type != ATA_PRIV_MISC &&
+              ide_req(rq)->type != ATA_PRIV_SENSE);
 
        /* Retry a failed packet command */
        if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {
@@ -856,6 +857,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int size)
        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;
        scsi_req(rq)->cmd[13] = cmd;
        rq->rq_disk = tape->disk;
        rq->__sector = tape->first_frame;
index a393e13b8007561666eacb61d8d22c72f672a820..9ccc1d57339310b3cac3b6cf2eff87f51776b361 100644 (file)
@@ -432,7 +432,8 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
 
        rq = blk_get_request(drive->queue, rw, __GFP_RECLAIM);
        scsi_req_init(rq);
-       rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
+       rq->cmd_type = REQ_TYPE_DRV_PRIV;
+       ide_req(rq)->type = ATA_PRIV_TASKFILE;
 
        /*
         * (ks) We transfer currently only whole sectors.
index 086fbe1728171ccf8c8251de4c7e9f41f7b2defd..5cc6caa94cac0230236de84af27f46ecd750b2e2 100644 (file)
 
 struct device;
 
-/* IDE-specific values for req->cmd_type */
-enum ata_cmd_type_bits {
-       REQ_TYPE_ATA_TASKFILE = REQ_TYPE_DRV_PRIV + 1,
-       REQ_TYPE_ATA_PC,
-       REQ_TYPE_ATA_SENSE,     /* sense request */
-       REQ_TYPE_ATA_PM_SUSPEND,/* suspend request */
-       REQ_TYPE_ATA_PM_RESUME, /* resume request */
+/* values for ide_request.type */
+enum ata_priv_type {
+       ATA_PRIV_MISC,
+       ATA_PRIV_TASKFILE,
+       ATA_PRIV_PC,
+       ATA_PRIV_SENSE,         /* sense request */
+       ATA_PRIV_PM_SUSPEND,    /* suspend request */
+       ATA_PRIV_PM_RESUME,     /* resume request */
 };
 
-#define ata_pm_request(rq)     \
-       ((rq)->cmd_type == REQ_TYPE_ATA_PM_SUSPEND || \
-        (rq)->cmd_type == REQ_TYPE_ATA_PM_RESUME)
-
 struct ide_request {
        struct scsi_request sreq;
        u8 sense[SCSI_SENSE_BUFFERSIZE];
+       u8 type;
 };
 
+static inline struct ide_request *ide_req(struct request *rq)
+{
+       return blk_mq_rq_to_pdu(rq);
+}
+
+static inline bool ata_misc_request(struct request *rq)
+{
+       return rq->cmd_type == REQ_TYPE_DRV_PRIV &&
+               ide_req(rq)->type == ATA_PRIV_MISC;
+}
+
+static inline bool ata_taskfile_request(struct request *rq)
+{
+       return rq->cmd_type == REQ_TYPE_DRV_PRIV &&
+               ide_req(rq)->type == ATA_PRIV_TASKFILE;
+}
+
+static inline bool ata_pc_request(struct request *rq)
+{
+       return rq->cmd_type == REQ_TYPE_DRV_PRIV &&
+               ide_req(rq)->type == ATA_PRIV_PC;
+}
+
+static inline bool ata_sense_request(struct request *rq)
+{
+       return rq->cmd_type == REQ_TYPE_DRV_PRIV &&
+               ide_req(rq)->type == ATA_PRIV_SENSE;
+}
+
+static inline bool ata_pm_request(struct request *rq)
+{
+       return rq->cmd_type == REQ_TYPE_DRV_PRIV &&
+               (ide_req(rq)->type == ATA_PRIV_PM_SUSPEND ||
+                ide_req(rq)->type == ATA_PRIV_PM_RESUME);
+}
+
 /* Error codes returned in rq->errors to the higher part of the driver. */
 enum {
        IDE_DRV_ERROR_GENERAL   = 101,