From: Rusty Russell <rusty@rustcorp.com.au>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: lkml <linux-kernel@vger.kernel.org>, Amit Shah <amit.shah@redhat.com>
Subject: Re: [PATCH 5/5] virtio: don't require a config space on the console device.
Date: Mon, 09 Feb 2015 10:26:29 +1030 [thread overview]
Message-ID: <87bnl43qky.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20150208110336.GL3185@redhat.com>
"Michael S. Tsirkin" <mst@redhat.com> writes:
> 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@rustcorp.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))
OK, fixed.
Thanks,
Rusty.
virtio: don't require a config space on the console device.
Strictly, it's only needed when we have features (size or multiport).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 26afb56a8073..fae2dbbf5745 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1986,7 +1986,10 @@ static int virtcons_probe(struct virtio_device *vdev)
bool multiport;
bool early = early_put_chars != NULL;
- if (!vdev->config->get) {
+ /* We only need a config space if features are offered */
+ 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;
next prev parent reply other threads:[~2015-02-09 0:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 5:06 [PATCH 0/5] virtio 1.0 cleanups and one fix Rusty Russell
2015-02-06 5:06 ` [PATCH 1/5] virtio: define VIRTIO_PCI_CAP_PCI_CFG in header Rusty Russell
2015-02-08 11:00 ` Michael S. Tsirkin
2015-02-06 5:06 ` [PATCH 2/5] virtio: Don't expose legacy block features when VIRTIO_BLK_NO_LEGACY defined Rusty Russell
2015-02-08 11:01 ` Michael S. Tsirkin
2015-02-06 5:06 ` [PATCH 3/5] virtio: Don't expose legacy net features when VIRTIO_NET_NO_LEGACY defined Rusty Russell
2015-02-08 10:59 ` Michael S. Tsirkin
2015-02-08 23:50 ` Rusty Russell
2015-02-11 0:06 ` Rusty Russell
2015-02-16 5:14 ` Michael S. Tsirkin
2015-02-16 6:09 ` Rusty Russell
2015-02-14 20:43 ` Michael S. Tsirkin
2015-02-16 3:29 ` Rusty Russell
2015-02-06 5:06 ` [PATCH 4/5] virtio: Don't expose legacy config features when VIRTIO_CONFIG_NO_LEGACY defined Rusty Russell
2015-02-08 11:03 ` Michael S. Tsirkin
2015-02-06 5:06 ` [PATCH 5/5] virtio: don't require a config space on the console device Rusty Russell
2015-02-08 11:03 ` Michael S. Tsirkin
2015-02-08 23:56 ` Rusty Russell [this message]
2015-02-11 11:16 ` Amit Shah
2015-02-08 9:52 ` [PATCH 0/5] virtio 1.0 cleanups and one fix Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bnl43qky.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=amit.shah@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome