Commit e83f2e82 authored by Amit Shah's avatar Amit Shah Committed by Greg Kroah-Hartman

virtio: console: rename cvq_lock to c_ivq_lock

commit 165b1b8b upstream.

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: default avatarAmit Shah <amit.shah@redhat.com>
Reviewed-by: default avatarAsias He <asias@redhat.com>
Reviewed-by: default avatarWanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
[bwh: Backported to 3.2:
 - Adjust context
 - Drop change to virtcons_restore()]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
[wyj: Backported to 3.4:
 - pick change to virtcons_restore() from upsteam patch]
Signed-off-by: default avatarYijing Wang <wangyijing@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6c9f8a49
...@@ -131,7 +131,7 @@ struct ports_device { ...@@ -131,7 +131,7 @@ struct ports_device {
spinlock_t ports_lock; spinlock_t ports_lock;
/* To protect the vq operations for the control channel */ /* 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 */ /* The current config space is stored here */
struct virtio_console_config config; struct virtio_console_config config;
...@@ -1474,23 +1474,23 @@ static void control_work_handler(struct work_struct *work) ...@@ -1474,23 +1474,23 @@ static void control_work_handler(struct work_struct *work)
portdev = container_of(work, struct ports_device, control_work); portdev = container_of(work, struct ports_device, control_work);
vq = portdev->c_ivq; vq = portdev->c_ivq;
spin_lock(&portdev->cvq_lock); spin_lock(&portdev->c_ivq_lock);
while ((buf = virtqueue_get_buf(vq, &len))) { while ((buf = virtqueue_get_buf(vq, &len))) {
spin_unlock(&portdev->cvq_lock); spin_unlock(&portdev->c_ivq_lock);
buf->len = len; buf->len = len;
buf->offset = 0; buf->offset = 0;
handle_control_message(portdev, buf); handle_control_message(portdev, buf);
spin_lock(&portdev->cvq_lock); spin_lock(&portdev->c_ivq_lock);
if (add_inbuf(portdev->c_ivq, buf) < 0) { if (add_inbuf(portdev->c_ivq, buf) < 0) {
dev_warn(&portdev->vdev->dev, dev_warn(&portdev->vdev->dev,
"Error adding buffer to queue\n"); "Error adding buffer to queue\n");
free_buf(buf); free_buf(buf);
} }
} }
spin_unlock(&portdev->cvq_lock); spin_unlock(&portdev->c_ivq_lock);
} }
static void out_intr(struct virtqueue *vq) static void out_intr(struct virtqueue *vq)
...@@ -1751,10 +1751,11 @@ static int __devinit virtcons_probe(struct virtio_device *vdev) ...@@ -1751,10 +1751,11 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
if (multiport) { if (multiport) {
unsigned int nr_added_bufs; 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); 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) { if (!nr_added_bufs) {
dev_err(&vdev->dev, dev_err(&vdev->dev,
"Error allocating buffers for control queue\n"); "Error allocating buffers for control queue\n");
...@@ -1895,7 +1896,7 @@ static int virtcons_restore(struct virtio_device *vdev) ...@@ -1895,7 +1896,7 @@ static int virtcons_restore(struct virtio_device *vdev)
return ret; return ret;
if (use_multiport(portdev)) 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) { list_for_each_entry(port, &portdev->ports, list) {
port->in_vq = portdev->in_vqs[port->id]; port->in_vq = portdev->in_vqs[port->id];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment