Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 96761
b: refs/heads/master
c: c154949
h: refs/heads/master
i:
  96759: 075d565
v: v3
  • Loading branch information
Josef 'Jeff' Sipek authored and Eric Van Hensbergen committed May 15, 2008
1 parent 222136b commit a46062e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bb8ffdfc3e3b32ad9fcdb8da289088d3b22794e5
refs/heads/master: c1549497e903a1ffa1c5808337a987180e480e7a
18 changes: 9 additions & 9 deletions trunk/net/9p/trans_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#define VIRTQUEUE_NUM 128

/* a single mutex to manage channel initialization and attachment */
static DECLARE_MUTEX(virtio_9p_lock);
static DEFINE_MUTEX(virtio_9p_lock);
/* global which tracks highest initialized channel */
static int chan_index;

Expand Down Expand Up @@ -211,9 +211,9 @@ static void p9_virtio_close(struct p9_trans *trans)
chan->max_tag = 0;
spin_unlock_irqrestore(&chan->lock, flags);

down(&virtio_9p_lock);
mutex_lock(&virtio_9p_lock);
chan->inuse = false;
up(&virtio_9p_lock);
mutex_unlock(&virtio_9p_lock);

kfree(trans);
}
Expand Down Expand Up @@ -381,10 +381,10 @@ static int p9_virtio_probe(struct virtio_device *vdev)
struct virtio_chan *chan;
int index;

down(&virtio_9p_lock);
mutex_lock(&virtio_9p_lock);
index = chan_index++;
chan = &channels[index];
up(&virtio_9p_lock);
mutex_unlock(&virtio_9p_lock);

if (chan_index > MAX_9P_CHAN) {
printk(KERN_ERR "9p: virtio: Maximum channels exceeded\n");
Expand Down Expand Up @@ -413,9 +413,9 @@ static int p9_virtio_probe(struct virtio_device *vdev)
out_free_vq:
vdev->config->del_vq(chan->vq);
fail:
down(&virtio_9p_lock);
mutex_lock(&virtio_9p_lock);
chan_index--;
up(&virtio_9p_lock);
mutex_unlock(&virtio_9p_lock);
return err;
}

Expand Down Expand Up @@ -449,7 +449,7 @@ p9_virtio_create(const char *devname, char *args, int msize,
struct virtio_chan *chan = channels;
int index = 0;

down(&virtio_9p_lock);
mutex_lock(&virtio_9p_lock);
while (index < MAX_9P_CHAN) {
if (chan->initialized && !chan->inuse) {
chan->inuse = true;
Expand All @@ -459,7 +459,7 @@ p9_virtio_create(const char *devname, char *args, int msize,
chan = &channels[index];
}
}
up(&virtio_9p_lock);
mutex_unlock(&virtio_9p_lock);

if (index >= MAX_9P_CHAN) {
printk(KERN_ERR "9p: no channels available\n");
Expand Down

0 comments on commit a46062e

Please sign in to comment.