bluetooth: static lock key fix
[safe/jmp/linux-2.6] / net / 9p / trans_virtio.c
index 2d7781e..b2e07f0 100644 (file)
@@ -43,6 +43,7 @@
 #include <net/9p/transport.h>
 #include <linux/scatterlist.h>
 #include <linux/virtio.h>
+#include <linux/virtio_ids.h>
 #include <linux/virtio_9p.h>
 
 #define VIRTQUEUE_NUM  128
@@ -57,11 +58,9 @@ static int chan_index;
  * @initialized: whether the channel is initialized
  * @inuse: whether the channel is in use
  * @lock: protects multiple elements within this structure
+ * @client: client instance
  * @vdev: virtio dev associated with this channel
  * @vq: virtio queue associated with this channel
- * @tagpool: accounting for tag ids (and request slots)
- * @reqs: array of request slots
- * @max_tag: current number of request_slots allocated
  * @sg: scatter gather list which is used to pack a request (protected?)
  *
  * We keep all per-channel information in a structure.
@@ -92,7 +91,7 @@ static unsigned int rest_of_page(void *data)
 
 /**
  * p9_virtio_close - reclaim resources of a channel
- * @trans: transport state
+ * @client: client instance
  *
  * This reclaims a channel by freeing its resources and
  * reseting its inuse flag.
@@ -134,6 +133,7 @@ static void req_done(struct virtqueue *vq)
                P9_DPRINTK(P9_DEBUG_TRANS, ": rc %p\n", rc);
                P9_DPRINTK(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);
        }
 }
@@ -180,9 +180,8 @@ static int p9_virtio_cancel(struct p9_client *client, struct p9_req_t *req)
 
 /**
  * p9_virtio_request - issue a request
- * @t: transport state
- * @tc: &p9_fcall request to transmit
- * @rc: &p9_fcall to put reponse into
+ * @client: client instance issuing the request
+ * @req: request to be issued
  *
  */
 
@@ -202,7 +201,7 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
 
        req->status = REQ_STATUS_SENT;
 
-       if (chan->vq->vq_ops->add_buf(chan->vq, chan->sg, out, in, req->tc)) {
+       if (chan->vq->vq_ops->add_buf(chan->vq, chan->sg, out, in, req->tc) < 0) {
                P9_DPRINTK(P9_DEBUG_TRANS,
                        "9p debug: virtio rpc add_buf returned failure");
                return -EIO;
@@ -245,7 +244,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
        chan->vdev = vdev;
 
        /* We expect one virtqueue, for requests. */
-       chan->vq = vdev->config->find_vq(vdev, 0, req_done);
+       chan->vq = virtio_find_single_vq(vdev, req_done, "requests");
        if (IS_ERR(chan->vq)) {
                err = PTR_ERR(chan->vq);
                goto out_free_vq;
@@ -260,7 +259,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
        return 0;
 
 out_free_vq:
-       vdev->config->del_vq(chan->vq);
+       vdev->config->del_vqs(vdev);
 fail:
        mutex_lock(&virtio_9p_lock);
        chan_index--;
@@ -331,13 +330,11 @@ static void p9_virtio_remove(struct virtio_device *vdev)
        BUG_ON(chan->inuse);
 
        if (chan->initialized) {
-               vdev->config->del_vq(chan->vq);
+               vdev->config->del_vqs(vdev);
                chan->initialized = false;
        }
 }
 
-#define VIRTIO_ID_9P 9
-
 static struct virtio_device_id id_table[] = {
        { VIRTIO_ID_9P, VIRTIO_DEV_ANY_ID },
        { 0 },