diff options
author | Matthew Garrett <mjg@redhat.com> | 2012-04-16 16:26:04 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-04-24 04:50:17 -0400 |
commit | 88674088d10ca2538b2efd2559f6620ade8ec373 (patch) | |
tree | 6a77b0d946017cb7e8765bf993495499828bf032 /arch/x86/video | |
parent | 2fbe8c7c3ebfed2059a6597322bb0dbc4d96feb5 (diff) |
x86: Use vga_default_device() when determining whether an fb is primary
IORESOURCE_ROM_SHADOW is not necessarily an indication that the hardware
is the primary device. Add support for using the vgaarb functions and
fall back if nothing's set them.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: mingo@redhat.com
Acked-by: hpa@zytor.com
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'arch/x86/video')
-rw-r--r-- | arch/x86/video/fbdev.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/arch/x86/video/fbdev.c b/arch/x86/video/fbdev.c index c5ffb6ac8707..d5644bbe8cba 100644 --- a/arch/x86/video/fbdev.c +++ b/arch/x86/video/fbdev.c | |||
@@ -9,24 +9,34 @@ | |||
9 | #include <linux/fb.h> | 9 | #include <linux/fb.h> |
10 | #include <linux/pci.h> | 10 | #include <linux/pci.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/vgaarb.h> | ||
12 | 13 | ||
13 | int fb_is_primary_device(struct fb_info *info) | 14 | int fb_is_primary_device(struct fb_info *info) |
14 | { | 15 | { |
15 | struct device *device = info->device; | 16 | struct device *device = info->device; |
16 | struct pci_dev *pci_dev = NULL; | 17 | struct pci_dev *pci_dev = NULL; |
18 | struct pci_dev *default_device = vga_default_device(); | ||
17 | struct resource *res = NULL; | 19 | struct resource *res = NULL; |
18 | int retval = 0; | ||
19 | 20 | ||
20 | if (device) | 21 | if (device) |
21 | pci_dev = to_pci_dev(device); | 22 | pci_dev = to_pci_dev(device); |
22 | 23 | ||
23 | if (pci_dev) | 24 | if (!pci_dev) |
24 | res = &pci_dev->resource[PCI_ROM_RESOURCE]; | 25 | return 0; |
26 | |||
27 | if (default_device) { | ||
28 | if (pci_dev == default_device) | ||
29 | return 1; | ||
30 | else | ||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | res = &pci_dev->resource[PCI_ROM_RESOURCE]; | ||
25 | 35 | ||
26 | if (res && res->flags & IORESOURCE_ROM_SHADOW) | 36 | if (res && res->flags & IORESOURCE_ROM_SHADOW) |
27 | retval = 1; | 37 | return 1; |
28 | 38 | ||
29 | return retval; | 39 | return 0; |
30 | } | 40 | } |
31 | EXPORT_SYMBOL(fb_is_primary_device); | 41 | EXPORT_SYMBOL(fb_is_primary_device); |
32 | MODULE_LICENSE("GPL"); | 42 | MODULE_LICENSE("GPL"); |