diff options
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> | 2008-03-07 12:39:13 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@opteron.9grid.us> | 2008-05-14 20:23:26 -0400 |
commit | c1549497e903a1ffa1c5808337a987180e480e7a (patch) | |
tree | 29447ac296b52f69459022d2f44e7bfe5371af01 | |
parent | bb8ffdfc3e3b32ad9fcdb8da289088d3b22794e5 (diff) |
9p: use struct mutex instead of struct semaphore
Replace semaphores protecting use flags with a mutex.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Acked-by: Eric Van Hensbergen <ericvh@gmail.com>
-rw-r--r-- | net/9p/trans_virtio.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 0bab1f23590e..d23ed60483c3 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #define VIRTQUEUE_NUM 128 | 49 | #define VIRTQUEUE_NUM 128 |
50 | 50 | ||
51 | /* a single mutex to manage channel initialization and attachment */ | 51 | /* a single mutex to manage channel initialization and attachment */ |
52 | static DECLARE_MUTEX(virtio_9p_lock); | 52 | static DEFINE_MUTEX(virtio_9p_lock); |
53 | /* global which tracks highest initialized channel */ | 53 | /* global which tracks highest initialized channel */ |
54 | static int chan_index; | 54 | static int chan_index; |
55 | 55 | ||
@@ -211,9 +211,9 @@ static void p9_virtio_close(struct p9_trans *trans) | |||
211 | chan->max_tag = 0; | 211 | chan->max_tag = 0; |
212 | spin_unlock_irqrestore(&chan->lock, flags); | 212 | spin_unlock_irqrestore(&chan->lock, flags); |
213 | 213 | ||
214 | down(&virtio_9p_lock); | 214 | mutex_lock(&virtio_9p_lock); |
215 | chan->inuse = false; | 215 | chan->inuse = false; |
216 | up(&virtio_9p_lock); | 216 | mutex_unlock(&virtio_9p_lock); |
217 | 217 | ||
218 | kfree(trans); | 218 | kfree(trans); |
219 | } | 219 | } |
@@ -381,10 +381,10 @@ static int p9_virtio_probe(struct virtio_device *vdev) | |||
381 | struct virtio_chan *chan; | 381 | struct virtio_chan *chan; |
382 | int index; | 382 | int index; |
383 | 383 | ||
384 | down(&virtio_9p_lock); | 384 | mutex_lock(&virtio_9p_lock); |
385 | index = chan_index++; | 385 | index = chan_index++; |
386 | chan = &channels[index]; | 386 | chan = &channels[index]; |
387 | up(&virtio_9p_lock); | 387 | mutex_unlock(&virtio_9p_lock); |
388 | 388 | ||
389 | if (chan_index > MAX_9P_CHAN) { | 389 | if (chan_index > MAX_9P_CHAN) { |
390 | printk(KERN_ERR "9p: virtio: Maximum channels exceeded\n"); | 390 | printk(KERN_ERR "9p: virtio: Maximum channels exceeded\n"); |
@@ -413,9 +413,9 @@ static int p9_virtio_probe(struct virtio_device *vdev) | |||
413 | out_free_vq: | 413 | out_free_vq: |
414 | vdev->config->del_vq(chan->vq); | 414 | vdev->config->del_vq(chan->vq); |
415 | fail: | 415 | fail: |
416 | down(&virtio_9p_lock); | 416 | mutex_lock(&virtio_9p_lock); |
417 | chan_index--; | 417 | chan_index--; |
418 | up(&virtio_9p_lock); | 418 | mutex_unlock(&virtio_9p_lock); |
419 | return err; | 419 | return err; |
420 | } | 420 | } |
421 | 421 | ||
@@ -449,7 +449,7 @@ p9_virtio_create(const char *devname, char *args, int msize, | |||
449 | struct virtio_chan *chan = channels; | 449 | struct virtio_chan *chan = channels; |
450 | int index = 0; | 450 | int index = 0; |
451 | 451 | ||
452 | down(&virtio_9p_lock); | 452 | mutex_lock(&virtio_9p_lock); |
453 | while (index < MAX_9P_CHAN) { | 453 | while (index < MAX_9P_CHAN) { |
454 | if (chan->initialized && !chan->inuse) { | 454 | if (chan->initialized && !chan->inuse) { |
455 | chan->inuse = true; | 455 | chan->inuse = true; |
@@ -459,7 +459,7 @@ p9_virtio_create(const char *devname, char *args, int msize, | |||
459 | chan = &channels[index]; | 459 | chan = &channels[index]; |
460 | } | 460 | } |
461 | } | 461 | } |
462 | up(&virtio_9p_lock); | 462 | mutex_unlock(&virtio_9p_lock); |
463 | 463 | ||
464 | if (index >= MAX_9P_CHAN) { | 464 | if (index >= MAX_9P_CHAN) { |
465 | printk(KERN_ERR "9p: no channels available\n"); | 465 | printk(KERN_ERR "9p: no channels available\n"); |