aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/virtio_console.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/virtio_console.c')
-rw-r--r--drivers/char/virtio_console.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index b79cf3e1b793..feea87cc6b8f 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -577,7 +577,8 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id,
577 spin_lock(&portdev->c_ovq_lock); 577 spin_lock(&portdev->c_ovq_lock);
578 if (virtqueue_add_outbuf(vq, sg, 1, &cpkt, GFP_ATOMIC) == 0) { 578 if (virtqueue_add_outbuf(vq, sg, 1, &cpkt, GFP_ATOMIC) == 0) {
579 virtqueue_kick(vq); 579 virtqueue_kick(vq);
580 while (!virtqueue_get_buf(vq, &len)) 580 while (!virtqueue_get_buf(vq, &len)
581 && !virtqueue_is_broken(vq))
581 cpu_relax(); 582 cpu_relax();
582 } 583 }
583 spin_unlock(&portdev->c_ovq_lock); 584 spin_unlock(&portdev->c_ovq_lock);
@@ -650,7 +651,8 @@ static ssize_t __send_to_port(struct port *port, struct scatterlist *sg,
650 * we need to kmalloc a GFP_ATOMIC buffer each time the 651 * we need to kmalloc a GFP_ATOMIC buffer each time the
651 * console driver writes something out. 652 * console driver writes something out.
652 */ 653 */
653 while (!virtqueue_get_buf(out_vq, &len)) 654 while (!virtqueue_get_buf(out_vq, &len)
655 && !virtqueue_is_broken(out_vq))
654 cpu_relax(); 656 cpu_relax();
655done: 657done:
656 spin_unlock_irqrestore(&port->outvq_lock, flags); 658 spin_unlock_irqrestore(&port->outvq_lock, flags);
@@ -1837,12 +1839,8 @@ static void config_intr(struct virtio_device *vdev)
1837 struct port *port; 1839 struct port *port;
1838 u16 rows, cols; 1840 u16 rows, cols;
1839 1841
1840 vdev->config->get(vdev, 1842 virtio_cread(vdev, struct virtio_console_config, cols, &cols);
1841 offsetof(struct virtio_console_config, cols), 1843 virtio_cread(vdev, struct virtio_console_config, rows, &rows);
1842 &cols, sizeof(u16));
1843 vdev->config->get(vdev,
1844 offsetof(struct virtio_console_config, rows),
1845 &rows, sizeof(u16));
1846 1844
1847 port = find_port_by_id(portdev, 0); 1845 port = find_port_by_id(portdev, 0);
1848 set_console_size(port, rows, cols); 1846 set_console_size(port, rows, cols);
@@ -2014,10 +2012,9 @@ static int virtcons_probe(struct virtio_device *vdev)
2014 2012
2015 /* Don't test MULTIPORT at all if we're rproc: not a valid feature! */ 2013 /* Don't test MULTIPORT at all if we're rproc: not a valid feature! */
2016 if (!is_rproc_serial(vdev) && 2014 if (!is_rproc_serial(vdev) &&
2017 virtio_config_val(vdev, VIRTIO_CONSOLE_F_MULTIPORT, 2015 virtio_cread_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT,
2018 offsetof(struct virtio_console_config, 2016 struct virtio_console_config, max_nr_ports,
2019 max_nr_ports), 2017 &portdev->config.max_nr_ports) == 0) {
2020 &portdev->config.max_nr_ports) == 0) {
2021 multiport = true; 2018 multiport = true;
2022 } 2019 }
2023 2020
@@ -2142,7 +2139,7 @@ static struct virtio_device_id rproc_serial_id_table[] = {
2142static unsigned int rproc_serial_features[] = { 2139static unsigned int rproc_serial_features[] = {
2143}; 2140};
2144 2141
2145#ifdef CONFIG_PM 2142#ifdef CONFIG_PM_SLEEP
2146static int virtcons_freeze(struct virtio_device *vdev) 2143static int virtcons_freeze(struct virtio_device *vdev)
2147{ 2144{
2148 struct ports_device *portdev; 2145 struct ports_device *portdev;
@@ -2220,7 +2217,7 @@ static struct virtio_driver virtio_console = {
2220 .probe = virtcons_probe, 2217 .probe = virtcons_probe,
2221 .remove = virtcons_remove, 2218 .remove = virtcons_remove,
2222 .config_changed = config_intr, 2219 .config_changed = config_intr,
2223#ifdef CONFIG_PM 2220#ifdef CONFIG_PM_SLEEP
2224 .freeze = virtcons_freeze, 2221 .freeze = virtcons_freeze,
2225 .restore = virtcons_restore, 2222 .restore = virtcons_restore,
2226#endif 2223#endif