Commit e3353853730eb99c56b7b0aed1667d51c0e3699a
Committed by
Rusty Russell
1 parent
c89e80168b
Exists in
master
and in
4 other branches
virtio: enhance id_matching for virtio drivers
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> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Showing 2 changed files with 2 additions and 2 deletions Side-by-side Diff
drivers/virtio/virtio.c
... | ... | @@ -58,7 +58,7 @@ |
58 | 58 | static inline int virtio_id_match(const struct virtio_device *dev, |
59 | 59 | const struct virtio_device_id *id) |
60 | 60 | { |
61 | - if (id->device != dev->id.device) | |
61 | + if (id->device != dev->id.device && id->device != VIRTIO_DEV_ANY_ID) | |
62 | 62 | return 0; |
63 | 63 | |
64 | 64 | return id->vendor == VIRTIO_DEV_ANY_ID || id->vendor == dev->id.vendor; |
scripts/mod/file2alias.c
... | ... | @@ -641,7 +641,7 @@ |
641 | 641 | id->vendor = TO_NATIVE(id->vendor); |
642 | 642 | |
643 | 643 | strcpy(alias, "virtio:"); |
644 | - ADD(alias, "d", 1, id->device); | |
644 | + ADD(alias, "d", id->device != VIRTIO_DEV_ANY_ID, id->device); | |
645 | 645 | ADD(alias, "v", id->vendor != VIRTIO_DEV_ANY_ID, id->vendor); |
646 | 646 | |
647 | 647 | add_wildcard(alias); |