drm/aperture: Inline fbdev conflict helpers into aperture helpers

Fbdev's helpers for handling conflicting framebuffer drivers are
related to framebuffer apertures, not console emulation. Therefore
remove them from drm_fb_helper.h and inline them into the aperture
helpers. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210412131043.5787-4-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann 2021-04-12 15:10:43 +02:00
parent 6848c291a5
commit 603dc7ed91
2 changed files with 20 additions and 54 deletions

View File

@ -1,7 +1,9 @@
// SPDX-License-Identifier: MIT
#include <linux/fb.h>
#include <linux/vgaarb.h>
#include <drm/drm_aperture.h>
#include <drm/drm_fb_helper.h>
/**
* DOC: overview
@ -78,6 +80,7 @@
int drm_aperture_remove_conflicting_framebuffers(resource_size_t base, resource_size_t size,
bool primary, const char *name)
{
#if IS_REACHABLE(CONFIG_FB)
struct apertures_struct *a;
int ret;
@ -88,10 +91,13 @@ int drm_aperture_remove_conflicting_framebuffers(resource_size_t base, resource_
a->ranges[0].base = base;
a->ranges[0].size = size;
ret = drm_fb_helper_remove_conflicting_framebuffers(a, name, primary);
ret = remove_conflicting_framebuffers(a, name, primary);
kfree(a);
return ret;
#else
return 0;
#endif
}
EXPORT_SYMBOL(drm_aperture_remove_conflicting_framebuffers);
@ -109,6 +115,17 @@ EXPORT_SYMBOL(drm_aperture_remove_conflicting_framebuffers);
*/
int drm_aperture_remove_conflicting_pci_framebuffers(struct pci_dev *pdev, const char *name)
{
return drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, name);
int ret = 0;
/*
* WARNING: Apparently we must kick fbdev drivers before vgacon,
* otherwise the vga fbdev driver falls over.
*/
#if IS_REACHABLE(CONFIG_FB)
ret = remove_conflicting_pci_framebuffers(pdev, name);
#endif
if (ret == 0)
ret = vga_remove_vgacon(pdev);
return ret;
}
EXPORT_SYMBOL(drm_aperture_remove_conflicting_pci_framebuffers);

View File

@ -36,7 +36,6 @@ struct drm_fb_helper;
#include <drm/drm_crtc.h>
#include <drm/drm_device.h>
#include <linux/kgdb.h>
#include <linux/vgaarb.h>
enum mode_set_atomic {
LEAVE_ATOMIC_MODE_SET,
@ -451,54 +450,4 @@ drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
#endif
/**
* drm_fb_helper_remove_conflicting_framebuffers - remove firmware-configured framebuffers
* @a: memory range, users of which are to be removed
* @name: requesting driver name
* @primary: also kick vga16fb if present
*
* This function removes framebuffer devices (initialized by firmware/bootloader)
* which use memory range described by @a. If @a is NULL all such devices are
* removed.
*/
static inline int
drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a,
const char *name, bool primary)
{
#if IS_REACHABLE(CONFIG_FB)
return remove_conflicting_framebuffers(a, name, primary);
#else
return 0;
#endif
}
/**
* drm_fb_helper_remove_conflicting_pci_framebuffers - remove firmware-configured framebuffers for PCI devices
* @pdev: PCI device
* @name: requesting driver name
*
* This function removes framebuffer devices (eg. initialized by firmware)
* using memory range configured for any of @pdev's memory bars.
*
* The function assumes that PCI device with shadowed ROM drives a primary
* display and so kicks out vga16fb.
*/
static inline int
drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
const char *name)
{
int ret = 0;
/*
* WARNING: Apparently we must kick fbdev drivers before vgacon,
* otherwise the vga fbdev driver falls over.
*/
#if IS_REACHABLE(CONFIG_FB)
ret = remove_conflicting_pci_framebuffers(pdev, name);
#endif
if (ret == 0)
ret = vga_remove_vgacon(pdev);
return ret;
}
#endif