Skip to content

Commit

Permalink
virtio: enhance id_matching for virtio drivers
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
borntraeger authored and rustyrussell committed Jun 12, 2009
1 parent c89e801 commit e335385
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/virtio/virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static struct device_attribute virtio_dev_attrs[] = {
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;
Expand Down
2 changes: 1 addition & 1 deletion scripts/mod/file2alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id,
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);
Expand Down

0 comments on commit e335385

Please sign in to comment.