.. | .. |
---|
21 | 21 | memset(&rqpm, 0, sizeof(rqpm)); |
---|
22 | 22 | rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0); |
---|
23 | 23 | ide_req(rq)->type = ATA_PRIV_PM_SUSPEND; |
---|
24 | | - rq->special = &rqpm; |
---|
| 24 | + ide_req(rq)->special = &rqpm; |
---|
25 | 25 | rqpm.pm_step = IDE_PM_START_SUSPEND; |
---|
26 | 26 | if (mesg.event == PM_EVENT_PRETHAW) |
---|
27 | 27 | mesg.event = PM_EVENT_FREEZE; |
---|
.. | .. |
---|
40 | 40 | return ret; |
---|
41 | 41 | } |
---|
42 | 42 | |
---|
43 | | -static void ide_end_sync_rq(struct request *rq, blk_status_t error) |
---|
44 | | -{ |
---|
45 | | - complete(rq->end_io_data); |
---|
46 | | -} |
---|
47 | | - |
---|
48 | 43 | static int ide_pm_execute_rq(struct request *rq) |
---|
49 | 44 | { |
---|
50 | 45 | struct request_queue *q = rq->q; |
---|
51 | | - DECLARE_COMPLETION_ONSTACK(wait); |
---|
52 | 46 | |
---|
53 | | - rq->end_io_data = &wait; |
---|
54 | | - rq->end_io = ide_end_sync_rq; |
---|
55 | | - |
---|
56 | | - spin_lock_irq(q->queue_lock); |
---|
57 | 47 | if (unlikely(blk_queue_dying(q))) { |
---|
58 | 48 | rq->rq_flags |= RQF_QUIET; |
---|
59 | 49 | scsi_req(rq)->result = -ENXIO; |
---|
60 | | - __blk_end_request_all(rq, BLK_STS_OK); |
---|
61 | | - spin_unlock_irq(q->queue_lock); |
---|
| 50 | + blk_mq_end_request(rq, BLK_STS_OK); |
---|
62 | 51 | return -ENXIO; |
---|
63 | 52 | } |
---|
64 | | - __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT); |
---|
65 | | - __blk_run_queue_uncond(q); |
---|
66 | | - spin_unlock_irq(q->queue_lock); |
---|
67 | | - |
---|
68 | | - wait_for_completion_io(&wait); |
---|
| 53 | + blk_execute_rq(q, NULL, rq, true); |
---|
69 | 54 | |
---|
70 | 55 | return scsi_req(rq)->result ? -EIO : 0; |
---|
71 | 56 | } |
---|
.. | .. |
---|
79 | 64 | struct ide_pm_state rqpm; |
---|
80 | 65 | int err; |
---|
81 | 66 | |
---|
| 67 | + blk_mq_start_stopped_hw_queues(drive->queue, true); |
---|
| 68 | + |
---|
82 | 69 | if (ide_port_acpi(hwif)) { |
---|
83 | 70 | /* call ACPI _PS0 / _STM only once */ |
---|
84 | 71 | if ((drive->dn & 1) == 0 || pair == NULL) { |
---|
.. | .. |
---|
90 | 77 | } |
---|
91 | 78 | |
---|
92 | 79 | memset(&rqpm, 0, sizeof(rqpm)); |
---|
93 | | - rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PREEMPT); |
---|
| 80 | + rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PM); |
---|
94 | 81 | ide_req(rq)->type = ATA_PRIV_PM_RESUME; |
---|
95 | | - rq->special = &rqpm; |
---|
| 82 | + ide_req(rq)->special = &rqpm; |
---|
96 | 83 | rqpm.pm_step = IDE_PM_START_RESUME; |
---|
97 | 84 | rqpm.pm_state = PM_EVENT_ON; |
---|
98 | 85 | |
---|
.. | .. |
---|
111 | 98 | |
---|
112 | 99 | void ide_complete_power_step(ide_drive_t *drive, struct request *rq) |
---|
113 | 100 | { |
---|
114 | | - struct ide_pm_state *pm = rq->special; |
---|
| 101 | + struct ide_pm_state *pm = ide_req(rq)->special; |
---|
115 | 102 | |
---|
116 | 103 | #ifdef DEBUG_PM |
---|
117 | 104 | printk(KERN_INFO "%s: complete_power_step(step: %d)\n", |
---|
.. | .. |
---|
141 | 128 | |
---|
142 | 129 | ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) |
---|
143 | 130 | { |
---|
144 | | - struct ide_pm_state *pm = rq->special; |
---|
| 131 | + struct ide_pm_state *pm = ide_req(rq)->special; |
---|
145 | 132 | struct ide_cmd cmd = { }; |
---|
146 | 133 | |
---|
147 | 134 | switch (pm->pm_step) { |
---|
.. | .. |
---|
213 | 200 | void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq) |
---|
214 | 201 | { |
---|
215 | 202 | struct request_queue *q = drive->queue; |
---|
216 | | - struct ide_pm_state *pm = rq->special; |
---|
217 | | - unsigned long flags; |
---|
| 203 | + struct ide_pm_state *pm = ide_req(rq)->special; |
---|
218 | 204 | |
---|
219 | 205 | ide_complete_power_step(drive, rq); |
---|
220 | 206 | if (pm->pm_step != IDE_PM_COMPLETED) |
---|
.. | .. |
---|
224 | 210 | printk("%s: completing PM request, %s\n", drive->name, |
---|
225 | 211 | (ide_req(rq)->type == ATA_PRIV_PM_SUSPEND) ? "suspend" : "resume"); |
---|
226 | 212 | #endif |
---|
227 | | - spin_lock_irqsave(q->queue_lock, flags); |
---|
228 | 213 | if (ide_req(rq)->type == ATA_PRIV_PM_SUSPEND) |
---|
229 | | - blk_stop_queue(q); |
---|
| 214 | + blk_mq_stop_hw_queues(q); |
---|
230 | 215 | else |
---|
231 | 216 | drive->dev_flags &= ~IDE_DFLAG_BLOCKED; |
---|
232 | | - spin_unlock_irqrestore(q->queue_lock, flags); |
---|
233 | 217 | |
---|
234 | 218 | drive->hwif->rq = NULL; |
---|
235 | 219 | |
---|
236 | | - if (blk_end_request(rq, BLK_STS_OK, 0)) |
---|
237 | | - BUG(); |
---|
| 220 | + blk_mq_end_request(rq, BLK_STS_OK); |
---|
238 | 221 | } |
---|
239 | 222 | |
---|
240 | 223 | void ide_check_pm_state(ide_drive_t *drive, struct request *rq) |
---|
241 | 224 | { |
---|
242 | | - struct ide_pm_state *pm = rq->special; |
---|
| 225 | + struct ide_pm_state *pm = ide_req(rq)->special; |
---|
243 | 226 | |
---|
244 | 227 | if (blk_rq_is_private(rq) && |
---|
245 | 228 | ide_req(rq)->type == ATA_PRIV_PM_SUSPEND && |
---|
.. | .. |
---|
260 | 243 | ide_hwif_t *hwif = drive->hwif; |
---|
261 | 244 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
---|
262 | 245 | struct request_queue *q = drive->queue; |
---|
263 | | - unsigned long flags; |
---|
264 | 246 | int rc; |
---|
265 | 247 | #ifdef DEBUG_PM |
---|
266 | 248 | printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); |
---|
.. | .. |
---|
274 | 256 | if (rc) |
---|
275 | 257 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); |
---|
276 | 258 | |
---|
277 | | - spin_lock_irqsave(q->queue_lock, flags); |
---|
278 | | - blk_start_queue(q); |
---|
279 | | - spin_unlock_irqrestore(q->queue_lock, flags); |
---|
| 259 | + blk_mq_start_hw_queues(q); |
---|
280 | 260 | } |
---|
281 | 261 | } |
---|