hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/ide/ide-pm.c
....@@ -21,7 +21,7 @@
2121 memset(&rqpm, 0, sizeof(rqpm));
2222 rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0);
2323 ide_req(rq)->type = ATA_PRIV_PM_SUSPEND;
24
- rq->special = &rqpm;
24
+ ide_req(rq)->special = &rqpm;
2525 rqpm.pm_step = IDE_PM_START_SUSPEND;
2626 if (mesg.event == PM_EVENT_PRETHAW)
2727 mesg.event = PM_EVENT_FREEZE;
....@@ -40,32 +40,17 @@
4040 return ret;
4141 }
4242
43
-static void ide_end_sync_rq(struct request *rq, blk_status_t error)
44
-{
45
- complete(rq->end_io_data);
46
-}
47
-
4843 static int ide_pm_execute_rq(struct request *rq)
4944 {
5045 struct request_queue *q = rq->q;
51
- DECLARE_COMPLETION_ONSTACK(wait);
5246
53
- rq->end_io_data = &wait;
54
- rq->end_io = ide_end_sync_rq;
55
-
56
- spin_lock_irq(q->queue_lock);
5747 if (unlikely(blk_queue_dying(q))) {
5848 rq->rq_flags |= RQF_QUIET;
5949 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);
6251 return -ENXIO;
6352 }
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);
6954
7055 return scsi_req(rq)->result ? -EIO : 0;
7156 }
....@@ -79,6 +64,8 @@
7964 struct ide_pm_state rqpm;
8065 int err;
8166
67
+ blk_mq_start_stopped_hw_queues(drive->queue, true);
68
+
8269 if (ide_port_acpi(hwif)) {
8370 /* call ACPI _PS0 / _STM only once */
8471 if ((drive->dn & 1) == 0 || pair == NULL) {
....@@ -90,9 +77,9 @@
9077 }
9178
9279 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);
9481 ide_req(rq)->type = ATA_PRIV_PM_RESUME;
95
- rq->special = &rqpm;
82
+ ide_req(rq)->special = &rqpm;
9683 rqpm.pm_step = IDE_PM_START_RESUME;
9784 rqpm.pm_state = PM_EVENT_ON;
9885
....@@ -111,7 +98,7 @@
11198
11299 void ide_complete_power_step(ide_drive_t *drive, struct request *rq)
113100 {
114
- struct ide_pm_state *pm = rq->special;
101
+ struct ide_pm_state *pm = ide_req(rq)->special;
115102
116103 #ifdef DEBUG_PM
117104 printk(KERN_INFO "%s: complete_power_step(step: %d)\n",
....@@ -141,7 +128,7 @@
141128
142129 ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq)
143130 {
144
- struct ide_pm_state *pm = rq->special;
131
+ struct ide_pm_state *pm = ide_req(rq)->special;
145132 struct ide_cmd cmd = { };
146133
147134 switch (pm->pm_step) {
....@@ -213,8 +200,7 @@
213200 void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
214201 {
215202 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;
218204
219205 ide_complete_power_step(drive, rq);
220206 if (pm->pm_step != IDE_PM_COMPLETED)
....@@ -224,22 +210,19 @@
224210 printk("%s: completing PM request, %s\n", drive->name,
225211 (ide_req(rq)->type == ATA_PRIV_PM_SUSPEND) ? "suspend" : "resume");
226212 #endif
227
- spin_lock_irqsave(q->queue_lock, flags);
228213 if (ide_req(rq)->type == ATA_PRIV_PM_SUSPEND)
229
- blk_stop_queue(q);
214
+ blk_mq_stop_hw_queues(q);
230215 else
231216 drive->dev_flags &= ~IDE_DFLAG_BLOCKED;
232
- spin_unlock_irqrestore(q->queue_lock, flags);
233217
234218 drive->hwif->rq = NULL;
235219
236
- if (blk_end_request(rq, BLK_STS_OK, 0))
237
- BUG();
220
+ blk_mq_end_request(rq, BLK_STS_OK);
238221 }
239222
240223 void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
241224 {
242
- struct ide_pm_state *pm = rq->special;
225
+ struct ide_pm_state *pm = ide_req(rq)->special;
243226
244227 if (blk_rq_is_private(rq) &&
245228 ide_req(rq)->type == ATA_PRIV_PM_SUSPEND &&
....@@ -260,7 +243,6 @@
260243 ide_hwif_t *hwif = drive->hwif;
261244 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
262245 struct request_queue *q = drive->queue;
263
- unsigned long flags;
264246 int rc;
265247 #ifdef DEBUG_PM
266248 printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name);
....@@ -274,8 +256,6 @@
274256 if (rc)
275257 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
276258
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);
280260 }
281261 }