ide: push ide_lock to __ide_end_request()

__ide_end_request() needs ide_lock only for __blk_end_request()
call so push ide_lock taking inside __ide_end_requests().
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 1d0bf587
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
static int __ide_end_request(ide_drive_t *drive, struct request *rq, static int __ide_end_request(ide_drive_t *drive, struct request *rq,
int uptodate, unsigned int nr_bytes, int dequeue) int uptodate, unsigned int nr_bytes, int dequeue)
{ {
unsigned long flags;
int ret = 1; int ret = 1;
int error = 0; int error = 0;
...@@ -84,11 +85,13 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, ...@@ -84,11 +85,13 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq,
ide_dma_on(drive); ide_dma_on(drive);
} }
if (!__blk_end_request(rq, error, nr_bytes)) { spin_lock_irqsave(&ide_lock, flags);
if (dequeue) if (!__blk_end_request(rq, error, nr_bytes))
HWGROUP(drive)->rq = NULL;
ret = 0; ret = 0;
} spin_unlock_irqrestore(&ide_lock, flags);
if (ret == 0 && dequeue)
drive->hwif->hwgroup->rq = NULL;
return ret; return ret;
} }
...@@ -108,8 +111,6 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) ...@@ -108,8 +111,6 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
{ {
unsigned int nr_bytes = nr_sectors << 9; unsigned int nr_bytes = nr_sectors << 9;
struct request *rq = drive->hwif->hwgroup->rq; struct request *rq = drive->hwif->hwgroup->rq;
unsigned long flags;
int ret = 1;
if (!nr_bytes) { if (!nr_bytes) {
if (blk_pc_request(rq)) if (blk_pc_request(rq))
...@@ -118,11 +119,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) ...@@ -118,11 +119,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
nr_bytes = rq->hard_cur_sectors << 9; nr_bytes = rq->hard_cur_sectors << 9;
} }
spin_lock_irqsave(&ide_lock, flags); return __ide_end_request(drive, rq, uptodate, nr_bytes, 1);
ret = __ide_end_request(drive, rq, uptodate, nr_bytes, 1);
spin_unlock_irqrestore(&ide_lock, flags);
return ret;
} }
EXPORT_SYMBOL(ide_end_request); EXPORT_SYMBOL(ide_end_request);
...@@ -236,16 +233,9 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * ...@@ -236,16 +233,9 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
int uptodate, int nr_sectors) int uptodate, int nr_sectors)
{ {
unsigned long flags;
int ret;
BUG_ON(!blk_rq_started(rq)); BUG_ON(!blk_rq_started(rq));
spin_lock_irqsave(&ide_lock, flags); return __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0);
ret = __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0);
spin_unlock_irqrestore(&ide_lock, flags);
return ret;
} }
EXPORT_SYMBOL_GPL(ide_end_dequeued_request); EXPORT_SYMBOL_GPL(ide_end_dequeued_request);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment