Skip to content

Commit 6ea5222

Browse files
committed
ide: use queue lock instead of ide_lock when possible
This is just a preparation for future changes and there should be no functional changes caused by this patch since ide_lock is currently also used as queue lock. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
1 parent 3c8a2cc commit 6ea5222

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

‎drivers/ide/ide-cd.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,16 +424,17 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
424424
if (time_after(jiffies, info->write_timeout))
425425
do_end_request = 1;
426426
else {
427+
struct request_queue *q = drive->queue;
427428
unsigned long flags;
428429

429430
/*
430431
* take a breather relying on the unplug
431432
* timer to kick us again
432433
*/
433-
spin_lock_irqsave(&ide_lock, flags);
434-
blk_plug_device(drive->queue);
435-
spin_unlock_irqrestore(&ide_lock,
436-
flags);
434+
spin_lock_irqsave(q->queue_lock, flags);
435+
blk_plug_device(q);
436+
spin_unlock_irqrestore(q->queue_lock, flags);
437+
437438
return 1;
438439
}
439440
}
@@ -502,11 +503,12 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
502503

503504
end_request:
504505
if (stat & ATA_ERR) {
506+
struct request_queue *q = drive->queue;
505507
unsigned long flags;
506508

507-
spin_lock_irqsave(&ide_lock, flags);
509+
spin_lock_irqsave(q->queue_lock, flags);
508510
blkdev_dequeue_request(rq);
509-
spin_unlock_irqrestore(&ide_lock, flags);
511+
spin_unlock_irqrestore(q->queue_lock, flags);
510512

511513
hwgroup->rq = NULL;
512514

‎drivers/ide/ide-io.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,20 +247,21 @@ EXPORT_SYMBOL_GPL(ide_end_dequeued_request);
247247
*/
248248
static void ide_complete_pm_request (ide_drive_t *drive, struct request *rq)
249249
{
250+
struct request_queue *q = drive->queue;
250251
unsigned long flags;
251252

252253
#ifdef DEBUG_PM
253254
printk("%s: completing PM request, %s\n", drive->name,
254255
blk_pm_suspend_request(rq) ? "suspend" : "resume");
255256
#endif
256-
spin_lock_irqsave(&ide_lock, flags);
257+
spin_lock_irqsave(q->queue_lock, flags);
257258
if (blk_pm_suspend_request(rq)) {
258-
blk_stop_queue(drive->queue);
259+
blk_stop_queue(q);
259260
} else {
260261
drive->dev_flags &= ~IDE_DFLAG_BLOCKED;
261-
blk_start_queue(drive->queue);
262+
blk_start_queue(q);
262263
}
263-
spin_unlock_irqrestore(&ide_lock, flags);
264+
spin_unlock_irqrestore(q->queue_lock, flags);
264265

265266
drive->hwif->hwgroup->rq = NULL;
266267

@@ -1469,16 +1470,16 @@ irqreturn_t ide_intr (int irq, void *dev_id)
14691470
void ide_do_drive_cmd(ide_drive_t *drive, struct request *rq)
14701471
{
14711472
ide_hwgroup_t *hwgroup = drive->hwif->hwgroup;
1473+
struct request_queue *q = drive->queue;
14721474
unsigned long flags;
14731475

14741476
hwgroup->rq = NULL;
14751477

1476-
spin_lock_irqsave(&ide_lock, flags);
1477-
__elv_add_request(drive->queue, rq, ELEVATOR_INSERT_FRONT, 0);
1478-
blk_start_queueing(drive->queue);
1479-
spin_unlock_irqrestore(&ide_lock, flags);
1478+
spin_lock_irqsave(q->queue_lock, flags);
1479+
__elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0);
1480+
blk_start_queueing(q);
1481+
spin_unlock_irqrestore(q->queue_lock, flags);
14801482
}
1481-
14821483
EXPORT_SYMBOL(ide_do_drive_cmd);
14831484

14841485
void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma)

0 commit comments

Comments
 (0)