blk_end_request: changing arm (take 4)
authorKiyoshi Ueda <k-ueda@ct.jp.nec.com>
Tue, 11 Dec 2007 22:42:27 +0000 (17:42 -0500)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 28 Jan 2008 09:35:59 +0000 (10:35 +0100)
This patch converts arm's OMAP mailbox driver to use
blk_end_request interfaces.

If the original code was converted literally, blk_end_request would
be called with '-EIO' because end_that_request_last() were called
with '0' (i.e. failure).
But I think these '0's are bugs in the original code because it's
unlikely that all requests are treated as failure.
(The bugs should have no effect unless these requests have an end_io
 callback.)

So I changed them to pass '0' (i.e. success) to blk_end_request.

Cc: Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com>
Cc: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
arch/arm/plat-omap/mailbox.c

index 0360b1f14d11f0c0dc3d3333c8a29b1fc53cf594..65e9c26f2054069a66295fee50214024a006c9cf 100644 (file)
@@ -116,8 +116,8 @@ static void mbox_tx_work(struct work_struct *work)
                }
 
                spin_lock(q->queue_lock);
-               blkdev_dequeue_request(rq);
-               end_that_request_last(rq, 0);
+               if (__blk_end_request(rq, 0, 0))
+                       BUG();
                spin_unlock(q->queue_lock);
        }
 }
@@ -149,10 +149,8 @@ static void mbox_rx_work(struct work_struct *work)
 
                msg = (mbox_msg_t) rq->data;
 
-               spin_lock_irqsave(q->queue_lock, flags);
-               blkdev_dequeue_request(rq);
-               end_that_request_last(rq, 0);
-               spin_unlock_irqrestore(q->queue_lock, flags);
+               if (blk_end_request(rq, 0, 0))
+                       BUG();
 
                mbox->rxq->callback((void *)msg);
        }
@@ -263,10 +261,8 @@ omap_mbox_read(struct device *dev, struct device_attribute *attr, char *buf)
 
                *p = (mbox_msg_t) rq->data;
 
-               spin_lock_irqsave(q->queue_lock, flags);
-               blkdev_dequeue_request(rq);
-               end_that_request_last(rq, 0);
-               spin_unlock_irqrestore(q->queue_lock, flags);
+               if (blk_end_request(rq, 0, 0))
+                       BUG();
 
                if (unlikely(mbox_seq_test(mbox, *p))) {
                        pr_info("mbox: Illegal seq bit!(%08x) ignored\n", *p);