Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux-2.6-block.git] / net / 9p / trans_virtio.c
index 32aa9834229cf6a9748fba543c47f5ebb81f5d31..3d432068f627ea9407187a00d37113f5baf39b3c 100644 (file)
@@ -26,6 +26,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/in.h>
 #include <linux/module.h>
 #include <linux/net.h>
@@ -145,7 +147,7 @@ static void req_done(struct virtqueue *vq)
        struct p9_req_t *req;
        unsigned long flags;
 
-       P9_DPRINTK(P9_DEBUG_TRANS, ": request done\n");
+       p9_debug(P9_DEBUG_TRANS, ": request done\n");
 
        while (1) {
                spin_lock_irqsave(&chan->lock, flags);
@@ -158,8 +160,8 @@ static void req_done(struct virtqueue *vq)
                spin_unlock_irqrestore(&chan->lock, flags);
                /* Wakeup if anyone waiting for VirtIO ring space. */
                wake_up(chan->vc_wq);
-               P9_DPRINTK(P9_DEBUG_TRANS, ": rc %p\n", rc);
-               P9_DPRINTK(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag);
+               p9_debug(P9_DEBUG_TRANS, ": rc %p\n", rc);
+               p9_debug(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag);
                req = p9_tag_lookup(chan->client, rc->tag);
                req->status = REQ_STATUS_RCVD;
                p9_client_cb(chan->client, req);
@@ -257,7 +259,7 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
        unsigned long flags;
        struct virtio_chan *chan = client->trans;
 
-       P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request\n");
+       p9_debug(P9_DEBUG_TRANS, "9p debug: virtio request\n");
 
        req->status = REQ_STATUS_SENT;
 req_retry:
@@ -270,7 +272,8 @@ req_retry:
        in = pack_sg_list(chan->sg, out,
                          VIRTQUEUE_NUM, req->rc->sdata, req->rc->capacity);
 
-       err = virtqueue_add_buf(chan->vq, chan->sg, out, in, req->tc);
+       err = virtqueue_add_buf(chan->vq, chan->sg, out, in, req->tc,
+                               GFP_ATOMIC);
        if (err < 0) {
                if (err == -ENOSPC) {
                        chan->ring_bufs_avail = 0;
@@ -280,20 +283,19 @@ req_retry:
                        if (err  == -ERESTARTSYS)
                                return err;
 
-                       P9_DPRINTK(P9_DEBUG_TRANS, "9p:Retry virtio request\n");
+                       p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n");
                        goto req_retry;
                } else {
                        spin_unlock_irqrestore(&chan->lock, flags);
-                       P9_DPRINTK(P9_DEBUG_TRANS,
-                                       "9p debug: "
-                                       "virtio rpc add_buf returned failure");
+                       p9_debug(P9_DEBUG_TRANS,
+                                "virtio rpc add_buf returned failure\n");
                        return -EIO;
                }
        }
        virtqueue_kick(chan->vq);
        spin_unlock_irqrestore(&chan->lock, flags);
 
-       P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request kicked\n");
+       p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n");
        return 0;
 }
 
@@ -354,7 +356,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
        struct page **in_pages = NULL, **out_pages = NULL;
        struct virtio_chan *chan = client->trans;
 
-       P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request\n");
+       p9_debug(P9_DEBUG_TRANS, "virtio request\n");
 
        if (uodata) {
                out_nr_pages = p9_nr_pages(uodata, outlen);
@@ -413,7 +415,8 @@ req_retry_pinned:
                in += pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM,
                                     in_pages, in_nr_pages, uidata, inlen);
 
-       err = virtqueue_add_buf(chan->vq, chan->sg, out, in, req->tc);
+       err = virtqueue_add_buf(chan->vq, chan->sg, out, in, req->tc,
+                               GFP_ATOMIC);
        if (err < 0) {
                if (err == -ENOSPC) {
                        chan->ring_bufs_avail = 0;
@@ -423,20 +426,19 @@ req_retry_pinned:
                        if (err  == -ERESTARTSYS)
                                goto err_out;
 
-                       P9_DPRINTK(P9_DEBUG_TRANS, "9p:Retry virtio request\n");
+                       p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n");
                        goto req_retry_pinned;
                } else {
                        spin_unlock_irqrestore(&chan->lock, flags);
-                       P9_DPRINTK(P9_DEBUG_TRANS,
-                                  "9p debug: "
-                                  "virtio rpc add_buf returned failure");
+                       p9_debug(P9_DEBUG_TRANS,
+                                "virtio rpc add_buf returned failure\n");
                        err = -EIO;
                        goto err_out;
                }
        }
        virtqueue_kick(chan->vq);
        spin_unlock_irqrestore(&chan->lock, flags);
-       P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request kicked\n");
+       p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n");
        err = wait_event_interruptible(*req->wq,
                                       req->status >= REQ_STATUS_RCVD);
        /*
@@ -491,7 +493,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
 
        chan = kmalloc(sizeof(struct virtio_chan), GFP_KERNEL);
        if (!chan) {
-               printk(KERN_ERR "9p: Failed to allocate virtio 9P channel\n");
+               pr_err("Failed to allocate virtio 9P channel\n");
                err = -ENOMEM;
                goto fail;
        }
@@ -592,7 +594,7 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args)
        mutex_unlock(&virtio_9p_lock);
 
        if (!found) {
-               printk(KERN_ERR "9p: no channels available\n");
+               pr_err("no channels available\n");
                return ret;
        }