diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2021-03-15 19:34:45 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-05-03 11:55:53 +0300 |
commit | d6d8bb92fdde6390037bf9da174ed3ab551c04d7 (patch) | |
tree | 586e6c05146827672d64c6ab94ac0442c809f8f0 /drivers/vhost | |
parent | 442706f9f94d28fe3c9f188ae4ebbd6b40addffe (diff) | |
download | linux-d6d8bb92fdde6390037bf9da174ed3ab551c04d7.tar.xz |
vhost/vdpa: use get_config_size callback in vhost_vdpa_config_validate()
Let's use the new 'get_config_size()' callback available instead of
using the 'virtio_id' to get the size of the device config space.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20210315163450.254396-10-sgarzare@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vdpa.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index c79d2f2387aa..a27756e2f99b 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -188,13 +188,8 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp) static int vhost_vdpa_config_validate(struct vhost_vdpa *v, struct vhost_vdpa_config *c) { - long size = 0; - - switch (v->virtio_id) { - case VIRTIO_ID_NET: - size = sizeof(struct virtio_net_config); - break; - } + struct vdpa_device *vdpa = v->vdpa; + long size = vdpa->config->get_config_size(vdpa); if (c->len == 0) return -EINVAL; |