[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150208110336.GL3185@redhat.com>
Date: Sun, 8 Feb 2015 12:03:37 +0100
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Rusty Russell <rusty@...tcorp.com.au>
Cc: lkml <linux-kernel@...r.kernel.org>,
Amit Shah <amit.shah@...hat.com>
Subject: Re: [PATCH 5/5] virtio: don't require a config space on the console
device.
On Fri, Feb 06, 2015 at 03:36:56PM +1030, Rusty Russell wrote:
> Strictly, it's only needed when we have features (size or multiport).
>
> Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
> ---
> drivers/char/virtio_console.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> index 26afb56a8073..8f182b0015b5 100644
> --- a/drivers/char/virtio_console.c
> +++ b/drivers/char/virtio_console.c
> @@ -1986,10 +1986,14 @@ static int virtcons_probe(struct virtio_device *vdev)
> bool multiport;
> bool early = early_put_chars != NULL;
>
> - if (!vdev->config->get) {
> - dev_err(&vdev->dev, "%s failure: config access disabled\n",
> - __func__);
> - return -EINVAL;
> + /* We only need a config space if features are offered */
> + if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)
> + || virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) {
> + if (!vdev->config->get) {
I dislike nested ifs. How about
if (!vdev->config->get && (
(virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)
|| virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT))
?
> + dev_err(&vdev->dev, "%s failure: config access disabled\n",
> + __func__);
> + return -EINVAL;
> + }
> }
>
> /* Ensure to read early_put_chars now */
> --
> 2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists