Commit 6848c291 authored by Thomas Zimmermann's avatar Thomas Zimmermann
Browse files

drm/aperture: Convert drivers to aperture interfaces



Mass-convert all drivers from FB helpers to aperture interfaces. No
functional changes besides checking for returned errno codes.

Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210412131043.5787-3-tzimmermann@suse.de
parent 29160591
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
 */

#include <drm/amdgpu_drm.h>
#include <drm/drm_aperture.h>
#include <drm/drm_drv.h>
#include <drm/drm_gem.h>
#include <drm/drm_vblank.h>
@@ -1196,7 +1197,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
#endif

	/* Get rid of things like offb */
	ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "amdgpudrmfb");
	ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "amdgpudrmfb");
	if (ret)
		return ret;

+2 −3
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/of_graph.h>
#include <linux/platform_device.h>

#include <drm/drm_aperture.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_ioctl.h>
@@ -94,9 +95,7 @@ static int armada_drm_bind(struct device *dev)
	}

	/* Remove early framebuffers */
	ret = drm_fb_helper_remove_conflicting_framebuffers(NULL,
							    "armada-drm-fb",
							    false);
	ret = drm_aperture_remove_framebuffers(false, "armada-drm-fb");
	if (ret) {
		dev_err(dev, "[" DRM_NAME ":%s] can't kick out simple-fb: %d\n",
			__func__, ret);
+10 −13
Original line number Diff line number Diff line
@@ -30,10 +30,10 @@
#include <linux/module.h>
#include <linux/pci.h>

#include <drm/drm_aperture.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_gem_vram_helper.h>
#include <drm/drm_probe_helper.h>

@@ -89,23 +89,18 @@ static const struct pci_device_id ast_pciidlist[] = {

MODULE_DEVICE_TABLE(pci, ast_pciidlist);

static void ast_kick_out_firmware_fb(struct pci_dev *pdev)
static int ast_remove_conflicting_framebuffers(struct pci_dev *pdev)
{
	struct apertures_struct *ap;
	bool primary = false;
	resource_size_t base, size;

	ap = alloc_apertures(1);
	if (!ap)
		return;

	ap->ranges[0].base = pci_resource_start(pdev, 0);
	ap->ranges[0].size = pci_resource_len(pdev, 0);

	base = pci_resource_start(pdev, 0);
	size = pci_resource_len(pdev, 0);
#ifdef CONFIG_X86
	primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
#endif
	drm_fb_helper_remove_conflicting_framebuffers(ap, "astdrmfb", primary);
	kfree(ap);

	return drm_aperture_remove_conflicting_framebuffers(base, size, primary, "astdrmfb");
}

static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
@@ -114,7 +109,9 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	struct drm_device *dev;
	int ret;

	ast_kick_out_firmware_fb(pdev);
	ret = ast_remove_conflicting_framebuffers(pdev);
	if (ret)
		return ret;

	ret = pcim_enable_device(pdev);
	if (ret)
+2 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <linux/pci.h>

#include <drm/drm_drv.h>
#include <drm/drm_aperture.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_managed.h>

@@ -109,7 +110,7 @@ static int bochs_pci_probe(struct pci_dev *pdev,
		return -ENOMEM;
	}

	ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "bochsdrmfb");
	ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "bochsdrmfb");
	if (ret)
		return ret;

+2 −2
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/pci.h>

#include <drm/drm_aperture.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_gem_framebuffer_helper.h>
@@ -313,8 +314,7 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
	struct drm_device *dev;
	int ret;

	ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev,
								"hibmcdrmfb");
	ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "hibmcdrmfb");
	if (ret)
		return ret;

Loading