From: Stefano Garzarella <[email protected]>

commit fde5b51795fa87107c13092eb54f6632b3b2f70b from
https://github.com/altera-opensource/linux-socfpga.git

[upstream commit d6d8bb92fdde6390037bf9da174ed3ab551c04d7]

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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Jason Wang <[email protected]>
Signed-off-by: Wenlin Kang <[email protected]>
---
 drivers/vhost/vdpa.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 04578aa87e4d..b2d4b1139ab5 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -191,13 +191,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 || c->off > size)
                return -EINVAL;
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12523): 
https://lists.yoctoproject.org/g/linux-yocto/message/12523
Mute This Topic: https://lists.yoctoproject.org/mt/98898758/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to