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