Merge branch 'for-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
[platform/kernel/linux-starfive.git] / drivers / ide / ide-pm.c
index a015acd..ec951be 100644 (file)
@@ -18,8 +18,9 @@ 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);
-       rq->cmd_type = REQ_TYPE_ATA_PM_SUSPEND;
+       rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM);
+       scsi_req_init(rq);
+       ide_req(rq)->type = ATA_PRIV_PM_SUSPEND;
        rq->special = &rqpm;
        rqpm.pm_step = IDE_PM_START_SUSPEND;
        if (mesg.event == PM_EVENT_PRETHAW)
@@ -88,8 +89,9 @@ int generic_ide_resume(struct device *dev)
        }
 
        memset(&rqpm, 0, sizeof(rqpm));
-       rq = blk_get_request(drive->queue, READ, __GFP_RECLAIM);
-       rq->cmd_type = REQ_TYPE_ATA_PM_RESUME;
+       rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM);
+       scsi_req_init(rq);
+       ide_req(rq)->type = ATA_PRIV_PM_RESUME;
        rq->rq_flags |= RQF_PREEMPT;
        rq->special = &rqpm;
        rqpm.pm_step = IDE_PM_START_RESUME;
@@ -221,10 +223,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;
@@ -240,11 +242,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 (blk_rq_is_private(rq) &&
+           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 (blk_rq_is_private(rq) &&
+                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