diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 42e09cc1b8ac..b384bbcc9ad3 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -408,6 +408,13 @@ int virtio_device_restore(struct virtio_device *dev) struct virtio_driver *drv = drv_to_virtio(dev->dev.driver); int ret; + /* Short path for stateful devices. Here we assume that if the device + * does not have a freeze callback, its state was not changed when + * suspended. + */ + if (drv && !drv->freeze) + goto on_config_enable; + /* We always start by resetting the device, in case a previous * driver messed it up. */ dev->config->reset(dev); @@ -439,6 +446,7 @@ int virtio_device_restore(struct virtio_device *dev) /* Finally, tell the device we're all set */ virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); +on_config_enable: virtio_config_enable(dev); return 0;