Skip to content

Commit

Permalink
virtio: console: rename cvq_lock to c_ivq_lock
Browse files Browse the repository at this point in the history
The cvq_lock was taken for the c_ivq.  Rename the lock to make that
obvious.

We'll also add a lock around the c_ovq in the next commit, so there's no
ambiguity.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Asias He <asias@redhat.com>
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
  • Loading branch information
Amit Shah authored and Rusty Russell committed Mar 30, 2013
1 parent b7d44d9 commit 165b1b8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ struct ports_device {
spinlock_t ports_lock;

/* To protect the vq operations for the control channel */
spinlock_t cvq_lock;
spinlock_t c_ivq_lock;

/* The current config space is stored here */
struct virtio_console_config config;
Expand Down Expand Up @@ -1709,23 +1709,23 @@ static void control_work_handler(struct work_struct *work)
portdev = container_of(work, struct ports_device, control_work);
vq = portdev->c_ivq;

spin_lock(&portdev->cvq_lock);
spin_lock(&portdev->c_ivq_lock);
while ((buf = virtqueue_get_buf(vq, &len))) {
spin_unlock(&portdev->cvq_lock);
spin_unlock(&portdev->c_ivq_lock);

buf->len = len;
buf->offset = 0;

handle_control_message(portdev, buf);

spin_lock(&portdev->cvq_lock);
spin_lock(&portdev->c_ivq_lock);
if (add_inbuf(portdev->c_ivq, buf) < 0) {
dev_warn(&portdev->vdev->dev,
"Error adding buffer to queue\n");
free_buf(buf, false);
}
}
spin_unlock(&portdev->cvq_lock);
spin_unlock(&portdev->c_ivq_lock);
}

static void out_intr(struct virtqueue *vq)
Expand Down Expand Up @@ -1996,10 +1996,11 @@ static int virtcons_probe(struct virtio_device *vdev)
if (multiport) {
unsigned int nr_added_bufs;

spin_lock_init(&portdev->cvq_lock);
spin_lock_init(&portdev->c_ivq_lock);
INIT_WORK(&portdev->control_work, &control_work_handler);

nr_added_bufs = fill_queue(portdev->c_ivq, &portdev->cvq_lock);
nr_added_bufs = fill_queue(portdev->c_ivq,
&portdev->c_ivq_lock);
if (!nr_added_bufs) {
dev_err(&vdev->dev,
"Error allocating buffers for control queue\n");
Expand Down Expand Up @@ -2150,7 +2151,7 @@ static int virtcons_restore(struct virtio_device *vdev)
return ret;

if (use_multiport(portdev))
fill_queue(portdev->c_ivq, &portdev->cvq_lock);
fill_queue(portdev->c_ivq, &portdev->c_ivq_lock);

list_for_each_entry(port, &portdev->ports, list) {
port->in_vq = portdev->in_vqs[port->id];
Expand Down

0 comments on commit 165b1b8

Please sign in to comment.