* [PATCH] virtio-input: reset device when going to sleep
@ 2018-08-07 3:02 Jian Jun Chen
0 siblings, 0 replies; only message in thread
From: Jian Jun Chen @ 2018-08-07 3:02 UTC (permalink / raw)
To: virtualization, linux-kernel
Cc: kraxel, mst, jasowang, yu1.wang, shuo.a.liu, jie.deng,
conghui.chen, Jian Jun Chen
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 <jian.jun.chen@intel.com>
---
drivers/virtio/virtio_input.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c
index 3a0468f2ceb0..20ea660bf1fc 100644
--- a/drivers/virtio/virtio_input.c
+++ b/drivers/virtio/virtio_input.c
@@ -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;
}
--
2.17.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-08-07 2:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-07 3:02 [PATCH] virtio-input: reset device when going to sleep Jian Jun Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®