drm/virtio: use simpler remove_conflicting_pci_framebuffers()
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Sat, 1 Sep 2018 14:08:49 +0000 (16:08 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 3 Sep 2018 16:17:42 +0000 (18:17 +0200)
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/25f89daf6217da98a52d41c4ad62a78272bb0cf6.1535810304.git.mirq-linux@rere.qmqm.pl
drivers/gpu/drm/virtio/virtgpu_drm_bus.c

index 094b876f6da6cb48221e84e39a7439e29c8ed8ed..757ca28ab93e439a860d9b6fe59dfa862febbdf3 100644 (file)
 
 #include "virtgpu_drv.h"
 
-static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev)
-{
-       struct apertures_struct *ap;
-       bool primary;
-
-       ap = alloc_apertures(1);
-       if (!ap)
-               return;
-
-       ap->ranges[0].base = pci_resource_start(pci_dev, 0);
-       ap->ranges[0].size = pci_resource_len(pci_dev, 0);
-
-       primary = pci_dev->resource[PCI_ROM_RESOURCE].flags
-               & IORESOURCE_ROM_SHADOW;
-
-       drm_fb_helper_remove_conflicting_framebuffers(ap, "virtiodrmfb", primary);
-
-       kfree(ap);
-}
-
 int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev)
 {
        struct drm_device *dev;
@@ -69,7 +49,9 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev)
                         pname);
                dev->pdev = pdev;
                if (vga)
-                       virtio_pci_kick_out_firmware_fb(pdev);
+                       drm_fb_helper_remove_conflicting_pci_framebuffers(pdev,
+                                                                         0,
+                                                                         "virtiodrmfb");
 
                snprintf(unique, sizeof(unique), "pci:%s", pname);
                ret = drm_dev_set_unique(dev, unique);