Merge git://git.kernel.org/pub/scm/linux/kernel/git/amit/virtio-console

* git://git.kernel.org/pub/scm/linux/kernel/git/amit/virtio-console:
virtio: console: Use better variable names for fill_queue operation
virtio: console: Fix type of 'len' as unsigned int

+16 -13
+16 -13
drivers/char/virtio_console.c
··· 379 struct scatterlist sg[1]; 380 struct virtio_console_control cpkt; 381 struct virtqueue *vq; 382 - int len; 383 384 if (!use_multiport(port->portdev)) 385 return 0; ··· 1071 static unsigned int fill_queue(struct virtqueue *vq, spinlock_t *lock) 1072 { 1073 struct port_buffer *buf; 1074 - unsigned int ret; 1075 - int err; 1076 1077 - ret = 0; 1078 do { 1079 buf = alloc_buf(PAGE_SIZE); 1080 if (!buf) 1081 break; 1082 1083 spin_lock_irq(lock); 1084 - err = add_inbuf(vq, buf); 1085 - if (err < 0) { 1086 spin_unlock_irq(lock); 1087 free_buf(buf); 1088 break; 1089 } 1090 - ret++; 1091 spin_unlock_irq(lock); 1092 - } while (err > 0); 1093 1094 - return ret; 1095 } 1096 1097 static int add_port(struct ports_device *portdev, u32 id) ··· 1100 struct port *port; 1101 struct port_buffer *buf; 1102 dev_t devt; 1103 int err; 1104 1105 port = kmalloc(sizeof(*port), GFP_KERNEL); ··· 1145 init_waitqueue_head(&port->waitqueue); 1146 1147 /* Fill the in_vq with buffers so the host can send us data. */ 1148 - err = fill_queue(port->in_vq, &port->inbuf_lock); 1149 - if (!err) { 1150 dev_err(port->dev, "Error allocating inbufs\n"); 1151 err = -ENOMEM; 1152 goto free_device; ··· 1443 INIT_LIST_HEAD(&portdev->ports); 1444 1445 if (multiport) { 1446 spin_lock_init(&portdev->cvq_lock); 1447 INIT_WORK(&portdev->control_work, &control_work_handler); 1448 INIT_WORK(&portdev->config_work, &config_work_handler); 1449 1450 - err = fill_queue(portdev->c_ivq, &portdev->cvq_lock); 1451 - if (!err) { 1452 dev_err(&vdev->dev, 1453 "Error allocating buffers for control queue\n"); 1454 err = -ENOMEM;
··· 379 struct scatterlist sg[1]; 380 struct virtio_console_control cpkt; 381 struct virtqueue *vq; 382 + unsigned int len; 383 384 if (!use_multiport(port->portdev)) 385 return 0; ··· 1071 static unsigned int fill_queue(struct virtqueue *vq, spinlock_t *lock) 1072 { 1073 struct port_buffer *buf; 1074 + unsigned int nr_added_bufs; 1075 + int ret; 1076 1077 + nr_added_bufs = 0; 1078 do { 1079 buf = alloc_buf(PAGE_SIZE); 1080 if (!buf) 1081 break; 1082 1083 spin_lock_irq(lock); 1084 + ret = add_inbuf(vq, buf); 1085 + if (ret < 0) { 1086 spin_unlock_irq(lock); 1087 free_buf(buf); 1088 break; 1089 } 1090 + nr_added_bufs++; 1091 spin_unlock_irq(lock); 1092 + } while (ret > 0); 1093 1094 + return nr_added_bufs; 1095 } 1096 1097 static int add_port(struct ports_device *portdev, u32 id) ··· 1100 struct port *port; 1101 struct port_buffer *buf; 1102 dev_t devt; 1103 + unsigned int nr_added_bufs; 1104 int err; 1105 1106 port = kmalloc(sizeof(*port), GFP_KERNEL); ··· 1144 init_waitqueue_head(&port->waitqueue); 1145 1146 /* Fill the in_vq with buffers so the host can send us data. */ 1147 + nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); 1148 + if (!nr_added_bufs) { 1149 dev_err(port->dev, "Error allocating inbufs\n"); 1150 err = -ENOMEM; 1151 goto free_device; ··· 1442 INIT_LIST_HEAD(&portdev->ports); 1443 1444 if (multiport) { 1445 + unsigned int nr_added_bufs; 1446 + 1447 spin_lock_init(&portdev->cvq_lock); 1448 INIT_WORK(&portdev->control_work, &control_work_handler); 1449 INIT_WORK(&portdev->config_work, &config_work_handler); 1450 1451 + nr_added_bufs = fill_queue(portdev->c_ivq, &portdev->cvq_lock); 1452 + if (!nr_added_bufs) { 1453 dev_err(&vdev->dev, 1454 "Error allocating buffers for control queue\n"); 1455 err = -ENOMEM;