diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2014-12-04 11:49:58 -0500 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-12-09 05:06:33 -0500 |
commit | b6098c30423cb1f0f5a4d0a5495e2670e274e544 (patch) | |
tree | 6f3c5ebe2d6fe46677444406eddc8d3a9943a0ea /drivers/virtio | |
parent | 48b36066b48025b7cd7d46c9a879f2f72fd9086a (diff) |
virtio: add API to detect legacy devices
transports need to be able to detect legacy-only
devices (ATM balloon only) to use legacy path
to drive them.
Add a core API to do just that.
The implementation just blacklists balloon:
not too pretty, but let's not over-engineer.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index fa6b75db5f1f..224f85442f3f 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/virtio_config.h> | 3 | #include <linux/virtio_config.h> |
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/idr.h> | 5 | #include <linux/idr.h> |
6 | #include <uapi/linux/virtio_ids.h> | ||
6 | 7 | ||
7 | /* Unique numbering for virtio devices. */ | 8 | /* Unique numbering for virtio devices. */ |
8 | static DEFINE_IDA(virtio_index_ida); | 9 | static DEFINE_IDA(virtio_index_ida); |
@@ -267,6 +268,12 @@ static struct bus_type virtio_bus = { | |||
267 | .remove = virtio_dev_remove, | 268 | .remove = virtio_dev_remove, |
268 | }; | 269 | }; |
269 | 270 | ||
271 | bool virtio_device_is_legacy_only(struct virtio_device_id id) | ||
272 | { | ||
273 | return id.device == VIRTIO_ID_BALLOON; | ||
274 | } | ||
275 | EXPORT_SYMBOL_GPL(virtio_device_is_legacy_only); | ||
276 | |||
270 | int register_virtio_driver(struct virtio_driver *driver) | 277 | int register_virtio_driver(struct virtio_driver *driver) |
271 | { | 278 | { |
272 | /* Catch this early. */ | 279 | /* Catch this early. */ |