#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;
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);
}
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");
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;
}
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;
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");