Commit 8d69d008 authored by Thomas Zimmermann's avatar Thomas Zimmermann

fbdev: Convert drivers to aperture helpers

Convert fbdev drivers from fbdev's remove_conflicting_framebuffers() to
the framework-independent aperture_remove_conflicting_devices(). Calling
this function will also remove conflicting DRM drivers.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220718072322.8927-6-tzimmermann@suse.de
parent 9d69ef18
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <linux/aperture.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -987,22 +988,16 @@ static int sm750fb_framebuffer_alloc(struct sm750_dev *sm750_dev, int fbidx) ...@@ -987,22 +988,16 @@ static int sm750fb_framebuffer_alloc(struct sm750_dev *sm750_dev, int fbidx)
static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev) static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev)
{ {
struct apertures_struct *ap; resource_size_t base = pci_resource_start(pdev, 0);
resource_size_t size = pci_resource_len(pdev, 0);
bool primary = false; bool primary = false;
ap = alloc_apertures(1);
if (!ap)
return -ENOMEM;
ap->ranges[0].base = pci_resource_start(pdev, 0);
ap->ranges[0].size = pci_resource_len(pdev, 0);
#ifdef CONFIG_X86 #ifdef CONFIG_X86
primary = pdev->resource[PCI_ROM_RESOURCE].flags & primary = pdev->resource[PCI_ROM_RESOURCE].flags &
IORESOURCE_ROM_SHADOW; IORESOURCE_ROM_SHADOW;
#endif #endif
remove_conflicting_framebuffers(ap, "sm750_fb1", primary);
kfree(ap); return aperture_remove_conflicting_devices(base, size, primary, "sm750_fb1");
return 0;
} }
static int lynxfb_pci_probe(struct pci_dev *pdev, static int lynxfb_pci_probe(struct pci_dev *pdev,
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include "radeonfb.h" #include "radeonfb.h"
#include <linux/aperture.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -2239,20 +2240,10 @@ static const struct bin_attribute edid2_attr = { ...@@ -2239,20 +2240,10 @@ static const struct bin_attribute edid2_attr = {
static int radeon_kick_out_firmware_fb(struct pci_dev *pdev) static int radeon_kick_out_firmware_fb(struct pci_dev *pdev)
{ {
struct apertures_struct *ap; resource_size_t base = pci_resource_start(pdev, 0);
resource_size_t size = pci_resource_len(pdev, 0);
ap = alloc_apertures(1); return aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME, false);
if (!ap)
return -ENOMEM;
ap->ranges[0].base = pci_resource_start(pdev, 0);
ap->ranges[0].size = pci_resource_len(pdev, 0);
remove_conflicting_framebuffers(ap, KBUILD_MODNAME, false);
kfree(ap);
return 0;
} }
static int radeonfb_pci_register(struct pci_dev *pdev, static int radeonfb_pci_register(struct pci_dev *pdev,
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/aperture.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
...@@ -1074,7 +1075,8 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) ...@@ -1074,7 +1075,8 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
info->screen_size = dio_fb_size; info->screen_size = dio_fb_size;
getmem_done: getmem_done:
remove_conflicting_framebuffers(info->apertures, aperture_remove_conflicting_devices(info->apertures->ranges[0].base,
info->apertures->ranges[0].size,
KBUILD_MODNAME, false); KBUILD_MODNAME, false);
if (gen2vm) { if (gen2vm) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment