Skip to content

Commit d6d8bb9

Browse files
stefano-garzarellamstsirkin
authored andcommitted
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>
1 parent 442706f commit d6d8bb9

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

drivers/vhost/vdpa.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,8 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
188188
static int vhost_vdpa_config_validate(struct vhost_vdpa *v,
189189
struct vhost_vdpa_config *c)
190190
{
191-
long size = 0;
192-
193-
switch (v->virtio_id) {
194-
case VIRTIO_ID_NET:
195-
size = sizeof(struct virtio_net_config);
196-
break;
197-
}
191+
struct vdpa_device *vdpa = v->vdpa;
192+
long size = vdpa->config->get_config_size(vdpa);
198193

199194
if (c->len == 0)
200195
return -EINVAL;

0 commit comments

Comments
 (0)