mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
fbdev: add remove_conflicting_pci_framebuffers()
Almost all PCI drivers using remove_conflicting_framebuffers() wrap it with the same code. v2: add kerneldoc for DRM helper v3: propagate remove_conflicting_framebuffers() return value + move kerneldoc to where function is implemented Signed-off-by: Michał Mirosław <[email protected]> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/7db1c278276de420eb45a1b71d06b5eb6bbd49ef.1535810304.git.mirq-linux@rere.qmqm.pl
This commit is contained in:
parent
69aa5355ab
commit
4d18975c78
3 changed files with 49 additions and 0 deletions
|
|
@ -34,6 +34,7 @@
|
|||
#include <linux/fb.h>
|
||||
#include <linux/fbcon.h>
|
||||
#include <linux/mem_encrypt.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include <asm/fb.h>
|
||||
|
||||
|
|
@ -1830,6 +1831,40 @@ int remove_conflicting_framebuffers(struct apertures_struct *a,
|
|||
}
|
||||
EXPORT_SYMBOL(remove_conflicting_framebuffers);
|
||||
|
||||
/**
|
||||
* remove_conflicting_pci_framebuffers - remove firmware-configured framebuffers for PCI devices
|
||||
* @pdev: PCI device
|
||||
* @resource_id: index of PCI BAR configuring framebuffer memory
|
||||
* @name: requesting driver name
|
||||
*
|
||||
* This function removes framebuffer devices (eg. initialized by firmware)
|
||||
* using memory range configured for @pdev's BAR @resource_id.
|
||||
*
|
||||
* The function assumes that PCI device with shadowed ROM drives a primary
|
||||
* display and so kicks out vga16fb.
|
||||
*/
|
||||
int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, const char *name)
|
||||
{
|
||||
struct apertures_struct *ap;
|
||||
bool primary = false;
|
||||
int err;
|
||||
|
||||
ap = alloc_apertures(1);
|
||||
if (!ap)
|
||||
return -ENOMEM;
|
||||
|
||||
ap->ranges[0].base = pci_resource_start(pdev, res_id);
|
||||
ap->ranges[0].size = pci_resource_len(pdev, res_id);
|
||||
#ifdef CONFIG_X86
|
||||
primary = pdev->resource[PCI_ROM_RESOURCE].flags &
|
||||
IORESOURCE_ROM_SHADOW;
|
||||
#endif
|
||||
err = remove_conflicting_framebuffers(ap, name, primary);
|
||||
kfree(ap);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(remove_conflicting_pci_framebuffers);
|
||||
|
||||
/**
|
||||
* register_framebuffer - registers a frame buffer device
|
||||
* @fb_info: frame buffer info structure
|
||||
|
|
|
|||
Loading…
Reference in a new issue