summaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2021-01-04 07:54:48 +0100
committerMichael S. Tsirkin <mst@redhat.com>2021-02-23 13:52:57 +0100
commit32490370883822e9e8dd7e4410bbe22bb3b77b58 (patch)
tree5e15541982a3a52f4de8ad9dae1b154801d8da17 /drivers/virtio
parentvirtio-pci-modern: factor out modern device initialization logic (diff)
downloadlinux-32490370883822e9e8dd7e4410bbe22bb3b77b58.tar.xz
linux-32490370883822e9e8dd7e4410bbe22bb3b77b58.zip
virtio-pci-modern: introduce vp_modern_remove()
This patch introduces vp_modern_remove() doing device resources cleanup to make it can be used. Signed-off-by: Jason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20210104065503.199631-5-jasowang@redhat.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio_pci_modern.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
index 5d2d2ae0dfdb..4be9afad547e 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -873,9 +873,12 @@ int virtio_pci_modern_probe(struct virtio_pci_device *vp_dev)
return 0;
}
-void virtio_pci_modern_remove(struct virtio_pci_device *vp_dev)
+/*
+ * vp_modern_probe: remove and cleanup the modern virtio pci device
+ * @mdev: the modern virtio-pci device
+ */
+static void vp_modern_remove(struct virtio_pci_modern_device *mdev)
{
- struct virtio_pci_modern_device *mdev = &vp_dev->mdev;
struct pci_dev *pci_dev = mdev->pci_dev;
if (mdev->device)
@@ -886,3 +889,10 @@ void virtio_pci_modern_remove(struct virtio_pci_device *vp_dev)
pci_iounmap(pci_dev, mdev->common);
pci_release_selected_regions(pci_dev, mdev->modern_bars);
}
+
+void virtio_pci_modern_remove(struct virtio_pci_device *vp_dev)
+{
+ struct virtio_pci_modern_device *mdev = &vp_dev->mdev;
+
+ vp_modern_remove(mdev);
+}