virtio-input: reset device when going to sleep
Subsystems (2)
PATCH 1/1 virtio-input: reset device when going to sleep
When going to sleep all virtqueues are deleted, memory used for descriptor table entries are freed. Device reset is required in this case to notify the backend driver.
Signed-off-by Jian Jun Chen <[email protected]>
--- drivers/virtio/virtio_input.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/virtio/virtio_input.c +4 -0
@@ -332,12 +332,16 @@ static void virtinput_remove(struct virtio_device *vdev)static int virtinput_freeze (struct virtio_device *vdev) {struct virtio_input *vi = vdev->priv; +void *buf;unsigned long flags;spin_lock_irqsave (&vi->lock, flags); vi->ready = false;spin_unlock_irqrestore (&vi->lock, flags); + vdev->config->reset (vdev); +while ((buf =virtqueue_detach_unused_buf (vi->sts)) !=NULL ) +kfree (buf); vdev->config->del_vqs (vdev);return 0 ; }
Signature · 1 line
2.17.1