aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTeddy Wang <teddy.wang@siliconmotion.com>2017-06-30 16:57:43 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-18 02:53:45 -0400
commit740c433ec35187b45abe08bb6c45a321a791be8e (patch)
treec2a250e7e5cb2b9f8b9d1190dd18af729a9bede2 /drivers
parent566e1ce22e04426fa52328b2adcdf1df49acd98e (diff)
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 d8801e4df91e ("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: <stable@vger.kernel.org> # v4.4+ Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/sm750fb/sm750.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 3aa4128703d5..67207b0554cd 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1053,6 +1053,26 @@ release_fb:
1053 return err; 1053 return err;
1054} 1054}
1055 1055
1056static 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
1056static int lynxfb_pci_probe(struct pci_dev *pdev, 1076static int lynxfb_pci_probe(struct pci_dev *pdev,
1057 const struct pci_device_id *ent) 1077 const struct pci_device_id *ent)
1058{ 1078{
@@ -1061,6 +1081,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
1061 int fbidx; 1081 int fbidx;
1062 int err; 1082 int err;
1063 1083
1084 err = lynxfb_kick_out_firmware_fb(pdev);
1085 if (err)
1086 return err;
1087
1064 /* enable device */ 1088 /* enable device */
1065 err = pcim_enable_device(pdev); 1089 err = pcim_enable_device(pdev);
1066 if (err) 1090 if (err)