]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
virtio-console: Use virtio_config_val() for retrieving config
authorSasha Levin <levinsasha928@gmail.com>
Sun, 14 Aug 2011 14:52:31 +0000 (17:52 +0300)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 1 Nov 2011 23:04:22 +0000 (10:04 +1100)
This patch modifies virtio-console to use virtio_config_val() instead
of a 'if(virtio_has_feature()) vdev->config->get()' construct to retrieve
optional values from the config space.

Cc: Amit Shah <amit.shah@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/char/virtio_console.c

index fb68b1295373e7287aa92a577b6aa937ba7ffe09..ed99f3bf341addc4221971f445c7921e41a7a8bf 100644 (file)
@@ -1675,13 +1675,11 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
 
        multiport = false;
        portdev->config.max_nr_ports = 1;
-       if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) {
+       if (virtio_config_val(vdev, VIRTIO_CONSOLE_F_MULTIPORT,
+                             offsetof(struct virtio_console_config,
+                                      max_nr_ports),
+                             &portdev->config.max_nr_ports) == 0)
                multiport = true;
-               vdev->config->get(vdev, offsetof(struct virtio_console_config,
-                                                max_nr_ports),
-                                 &portdev->config.max_nr_ports,
-                                 sizeof(portdev->config.max_nr_ports));
-       }
 
        err = init_vqs(portdev);
        if (err < 0) {