Skip to content

Commit 740c433

Browse files
teddywlqgregkh
authored andcommitted
staging: sm750fb: avoid conflicting vesafb
If vesafb is enabled in the config then /dev/fb0 is created by vesa and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to effectively work with xorg. So if it has been alloted fb1, then try to remove the other fb0. In the previous send, why #ifdef is used was asked. https://lkml.org/lkml/2017/6/25/57 Answered at: https://lkml.org/lkml/2017/6/25/69 Also pasting here for reference. 'Did a quick research into "why". The patch d8801e4 ("x86/PCI: Set IORESOURCE_ROM_SHADOW only for the default VGA device") has started setting IORESOURCE_ROM_SHADOW in flags for a default VGA device and that is being done only for x86. And so, we will need that #ifdef to check IORESOURCE_ROM_SHADOW as that needs to be checked only for a x86 and not for other arch.' Cc: <[email protected]> # v4.4+ Signed-off-by: Teddy Wang <[email protected]> Signed-off-by: Sudip Mukherjee <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 566e1ce commit 740c433

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

drivers/staging/sm750fb/sm750.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,26 @@ static int sm750fb_frambuffer_alloc(struct sm750_dev *sm750_dev, int fbidx)
10531053
return err;
10541054
}
10551055

1056+
static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev)
1057+
{
1058+
struct apertures_struct *ap;
1059+
bool primary = false;
1060+
1061+
ap = alloc_apertures(1);
1062+
if (!ap)
1063+
return -ENOMEM;
1064+
1065+
ap->ranges[0].base = pci_resource_start(pdev, 0);
1066+
ap->ranges[0].size = pci_resource_len(pdev, 0);
1067+
#ifdef CONFIG_X86
1068+
primary = pdev->resource[PCI_ROM_RESOURCE].flags &
1069+
IORESOURCE_ROM_SHADOW;
1070+
#endif
1071+
remove_conflicting_framebuffers(ap, "sm750_fb1", primary);
1072+
kfree(ap);
1073+
return 0;
1074+
}
1075+
10561076
static int lynxfb_pci_probe(struct pci_dev *pdev,
10571077
const struct pci_device_id *ent)
10581078
{
@@ -1061,6 +1081,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
10611081
int fbidx;
10621082
int err;
10631083

1084+
err = lynxfb_kick_out_firmware_fb(pdev);
1085+
if (err)
1086+
return err;
1087+
10641088
/* enable device */
10651089
err = pcim_enable_device(pdev);
10661090
if (err)

0 commit comments

Comments
 (0)