diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2017-03-29 19:06:20 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2017-04-07 16:38:59 +0300 |
commit | 404123c2db798027e852480ed9c4accef9f1d9e6 (patch) | |
tree | 07f8ecc47704cfbc7759e19d0121acf201f7e6ba /drivers/virtio | |
parent | 2e123b44a3c19de75f40ee0081d6d4fc04adfdc7 (diff) | |
download | op-kernel-dev-404123c2db798027e852480ed9c4accef9f1d9e6.zip op-kernel-dev-404123c2db798027e852480ed9c4accef9f1d9e6.tar.gz |
virtio: allow drivers to validate features
Some drivers can't support all features in all configurations. At the
moment we blindly set FEATURES_OK and later FAILED. Support this better
by adding a callback drivers can use to do some early checks.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 400d70b..48230a5 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -232,6 +232,12 @@ static int virtio_dev_probe(struct device *_d) if (device_features & (1ULL << i)) __virtio_set_bit(dev, i); + if (drv->validate) { + err = drv->validate(dev); + if (err) + goto err; + } + err = virtio_finalize_features(dev); if (err) goto err; |