public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
	Christian Borntraeger <borntraeger@de.ibm.com>
Subject: [patch 2/2] virtio: enhance id_matching for virtio drivers
Date: Tue, 26 May 2009 15:46:10 +0200	[thread overview]
Message-ID: <20090526135141.256078000@de.ibm.com> (raw)
In-Reply-To: 20090526134608.545964000@de.ibm.com

[-- Attachment #1: virtio_id_enhance.patch --]
[-- Type: text/plain, Size: 1472 bytes --]

From: Christian Borntraeger <borntraeger@de.ibm.com>

This patch allows a virtio driver to use VIRTIO_DEV_ANY_ID for the 
device id. This will be used by a test module that can be bound to
any virtio device.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 drivers/virtio/virtio.c  |    2 +-
 scripts/mod/file2alias.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-next/drivers/virtio/virtio.c
===================================================================
--- linux-next.orig/drivers/virtio/virtio.c
+++ linux-next/drivers/virtio/virtio.c
@@ -58,7 +58,7 @@ static struct device_attribute virtio_de
 static inline int virtio_id_match(const struct virtio_device *dev,
 				  const struct virtio_device_id *id)
 {
-	if (id->device != dev->id.device)
+	if (id->device != dev->id.device && id->device != VIRTIO_DEV_ANY_ID)
 		return 0;
 
 	return id->vendor == VIRTIO_DEV_ANY_ID || id->vendor == dev->id.vendor;
Index: linux-next/scripts/mod/file2alias.c
===================================================================
--- linux-next.orig/scripts/mod/file2alias.c
+++ linux-next/scripts/mod/file2alias.c
@@ -641,7 +641,7 @@ static int do_virtio_entry(const char *f
 	id->vendor = TO_NATIVE(id->vendor);
 
 	strcpy(alias, "virtio:");
-	ADD(alias, "d", 1, id->device);
+	ADD(alias, "d", id->device != VIRTIO_DEV_ANY_ID, id->device);
 	ADD(alias, "v", id->vendor != VIRTIO_DEV_ANY_ID, id->vendor);
 
 	add_wildcard(alias);


  parent reply	other threads:[~2009-05-26 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26 13:46 [patch 0/2] Fix and enhance virtio device id matching Christian Borntraeger
2009-05-26 13:46 ` [patch 1/2] virtio: fix id_matching for virtio drivers Christian Borntraeger
2009-05-26 13:46 ` Christian Borntraeger [this message]
2009-05-27  2:41 ` [patch 0/2] Fix and enhance virtio device id matching Rusty Russell

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=20090526135141.256078000@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.org \
    /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