aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2012-04-16 16:26:02 -0400
committerDave Airlie <airlied@redhat.com>2012-04-24 04:50:15 -0400
commit1a39b310e920bb7098067d96411b31e459ae8f32 (patch)
tree90f45eed83bcd5308ac9ad850844d0b57038e5f8 /drivers/pci
parentf122c6109b1a79153cfb1e188c665ce3f312a886 (diff)
vgaarb: Add support for setting the default video device (v2)
The default VGA device is a somewhat fluid concept on platforms with multiple GPUs. Add support for setting it so switching code can update things appropriately, and make sure that the sysfs code returns the right device if it's changed. v2: Updated to fix builds when __ARCH_HAS_VGA_DEFAULT_DEVICE is false. Signed-off-by: Matthew Garrett <mjg@redhat.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Acked-by: benh@kernel.crashing.org Cc: airlied@redhat.com Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-sysfs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index a55e248618cd..86c63fe45d11 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -27,6 +27,7 @@
27#include <linux/security.h> 27#include <linux/security.h>
28#include <linux/pci-aspm.h> 28#include <linux/pci-aspm.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/vgaarb.h>
30#include "pci.h" 31#include "pci.h"
31 32
32static int sysfs_initialized; /* = 0 */ 33static int sysfs_initialized; /* = 0 */
@@ -417,6 +418,10 @@ static ssize_t
417boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf) 418boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf)
418{ 419{
419 struct pci_dev *pdev = to_pci_dev(dev); 420 struct pci_dev *pdev = to_pci_dev(dev);
421 struct pci_dev *vga_dev = vga_default_device();
422
423 if (vga_dev)
424 return sprintf(buf, "%u\n", (pdev == vga_dev));
420 425
421 return sprintf(buf, "%u\n", 426 return sprintf(buf, "%u\n",
422 !!(pdev->resource[PCI_ROM_RESOURCE].flags & 427 !!(pdev->resource[PCI_ROM_RESOURCE].flags &