[PATCH v11 15/40] virtio_ring: packed: introduce vring_free_packed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Free the structure struct vring_vritqueue_packed.

Subsequent patches require it.

Signed-off-by: Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>
---
 drivers/virtio/virtio_ring.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 1aaa1e5f9991..4f497b6f2d04 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -1830,6 +1830,27 @@ static struct vring_desc_extra *vring_alloc_desc_extra(unsigned int num)
 	return desc_extra;
 }
 
+static void vring_free_packed(struct vring_virtqueue_packed *vring,
+			      struct virtio_device *vdev)
+{
+	if (vring->vring.desc)
+		vring_free_queue(vdev, vring->ring_size_in_bytes,
+				 vring->vring.desc, vring->ring_dma_addr);
+
+	if (vring->vring.driver)
+		vring_free_queue(vdev, vring->event_size_in_bytes,
+				 vring->vring.driver,
+				 vring->driver_event_dma_addr);
+
+	if (vring->vring.device)
+		vring_free_queue(vdev, vring->event_size_in_bytes,
+				 vring->vring.device,
+				 vring->device_event_dma_addr);
+
+	kfree(vring->desc_state);
+	kfree(vring->desc_extra);
+}
+
 static struct virtqueue *vring_create_virtqueue_packed(
 	unsigned int index,
 	unsigned int num,
-- 
2.31.0




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux