vdpa: skip suspend/resume ops if not DRIVER_OK
If a vdpa device is not in state DRIVER_OK, then there is no driver state to preserve, so no need to call the suspend and resume driver ops. Suggested-by: Eugenio Perez Martin <eperezma@redhat.com>" Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Message-Id: <1707834358-165470-1-git-send-email-steven.sistare@oracle.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eugenio Pérez <eperezma@redhat.com>
This commit is contained in:
parent
310227f428
commit
c4e8b5aed7
@ -595,6 +595,9 @@ static long vhost_vdpa_suspend(struct vhost_vdpa *v)
|
||||
const struct vdpa_config_ops *ops = vdpa->config;
|
||||
int ret;
|
||||
|
||||
if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK))
|
||||
return 0;
|
||||
|
||||
if (!ops->suspend)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
@ -615,6 +618,9 @@ static long vhost_vdpa_resume(struct vhost_vdpa *v)
|
||||
const struct vdpa_config_ops *ops = vdpa->config;
|
||||
int ret;
|
||||
|
||||
if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK))
|
||||
return 0;
|
||||
|
||||
if (!ops->resume)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user