aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-12-29 14:27:30 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-12-29 14:27:30 -0500
commita72b2147ec9e77be68308ba06190603550d1cb61 (patch)
tree2c6ba7f26693a9de21f8cc037356b2b8fd334786 /drivers/ide/ide-io.c
parent1d0bf587df5b17bb93b32d760171417883ca907f (diff)
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: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 8afe7b15decf..709163536015 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -58,6 +58,7 @@
58static int __ide_end_request(ide_drive_t *drive, struct request *rq, 58static int __ide_end_request(ide_drive_t *drive, struct request *rq,
59 int uptodate, unsigned int nr_bytes, int dequeue) 59 int uptodate, unsigned int nr_bytes, int dequeue)
60{ 60{
61 unsigned long flags;
61 int ret = 1; 62 int ret = 1;
62 int error = 0; 63 int error = 0;
63 64
@@ -84,11 +85,13 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq,
84 ide_dma_on(drive); 85 ide_dma_on(drive);
85 } 86 }
86 87
87 if (!__blk_end_request(rq, error, nr_bytes)) { 88 spin_lock_irqsave(&ide_lock, flags);
88 if (dequeue) 89 if (!__blk_end_request(rq, error, nr_bytes))
89 HWGROUP(drive)->rq = NULL;
90 ret = 0; 90 ret = 0;
91 } 91 spin_unlock_irqrestore(&ide_lock, flags);
92
93 if (ret == 0 && dequeue)
94 drive->hwif->hwgroup->rq = NULL;
92 95
93 return ret; 96 return ret;
94} 97}
@@ -108,8 +111,6 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
108{ 111{
109 unsigned int nr_bytes = nr_sectors << 9; 112 unsigned int nr_bytes = nr_sectors << 9;
110 struct request *rq = drive->hwif->hwgroup->rq; 113 struct request *rq = drive->hwif->hwgroup->rq;
111 unsigned long flags;
112 int ret = 1;
113 114
114 if (!nr_bytes) { 115 if (!nr_bytes) {
115 if (blk_pc_request(rq)) 116 if (blk_pc_request(rq))
@@ -118,11 +119,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
118 nr_bytes = rq->hard_cur_sectors << 9; 119 nr_bytes = rq->hard_cur_sectors << 9;
119 } 120 }
120 121
121 spin_lock_irqsave(&ide_lock, flags); 122 return __ide_end_request(drive, rq, uptodate, nr_bytes, 1);
122 ret = __ide_end_request(drive, rq, uptodate, nr_bytes, 1);
123 spin_unlock_irqrestore(&ide_lock, flags);
124
125 return ret;
126} 123}
127EXPORT_SYMBOL(ide_end_request); 124EXPORT_SYMBOL(ide_end_request);
128 125
@@ -236,16 +233,9 @@ out_do_tf:
236int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 233int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
237 int uptodate, int nr_sectors) 234 int uptodate, int nr_sectors)
238{ 235{
239 unsigned long flags;
240 int ret;
241
242 BUG_ON(!blk_rq_started(rq)); 236 BUG_ON(!blk_rq_started(rq));
243 237
244 spin_lock_irqsave(&ide_lock, flags); 238 return __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0);
245 ret = __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0);
246 spin_unlock_irqrestore(&ide_lock, flags);
247
248 return ret;
249} 239}
250EXPORT_SYMBOL_GPL(ide_end_dequeued_request); 240EXPORT_SYMBOL_GPL(ide_end_dequeued_request);
251 241