aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/vga/vga_switcheroo.c
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2012-04-16 16:26:03 -0400
committerDave Airlie <airlied@redhat.com>2012-04-24 04:50:16 -0400
commit2fbe8c7c3ebfed2059a6597322bb0dbc4d96feb5 (patch)
tree262a6f5783ec3a91a5c7d51a63383a99965f2697 /drivers/gpu/vga/vga_switcheroo.c
parent1a39b310e920bb7098067d96411b31e459ae8f32 (diff)
vga-switcheroo: Use vga_default_device()
vga-switcheroo currently changes the default VGA device by fiddling with the IORESOURCE_ROM_SHADOW flag on the device. This isn't strictly accurate, since there's no guarantee that switching also changes the ROM decoding. Switch over to using the vgaarb functions for this. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/vga/vga_switcheroo.c')
-rw-r--r--drivers/gpu/vga/vga_switcheroo.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index 58434e804d91..9d830286f883 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -28,6 +28,8 @@
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/vga_switcheroo.h> 29#include <linux/vga_switcheroo.h>
30 30
31#include <linux/vgaarb.h>
32
31struct vga_switcheroo_client { 33struct vga_switcheroo_client {
32 struct pci_dev *pdev; 34 struct pci_dev *pdev;
33 struct fb_info *fb_info; 35 struct fb_info *fb_info;
@@ -122,7 +124,7 @@ int vga_switcheroo_register_client(struct pci_dev *pdev,
122 vgasr_priv.clients[index].reprobe = reprobe; 124 vgasr_priv.clients[index].reprobe = reprobe;
123 vgasr_priv.clients[index].can_switch = can_switch; 125 vgasr_priv.clients[index].can_switch = can_switch;
124 vgasr_priv.clients[index].id = -1; 126 vgasr_priv.clients[index].id = -1;
125 if (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW) 127 if (pdev == vga_default_device())
126 vgasr_priv.clients[index].active = true; 128 vgasr_priv.clients[index].active = true;
127 129
128 vgasr_priv.registered_clients |= (1 << index); 130 vgasr_priv.registered_clients |= (1 << index);
@@ -230,9 +232,8 @@ static int vga_switchto_stage1(struct vga_switcheroo_client *new_client)
230 if (new_client->pwr_state == VGA_SWITCHEROO_OFF) 232 if (new_client->pwr_state == VGA_SWITCHEROO_OFF)
231 vga_switchon(new_client); 233 vga_switchon(new_client);
232 234
233 /* swap shadow resource to denote boot VGA device has changed so X starts on new device */ 235 vga_set_default_device(new_client->pdev);
234 active->pdev->resource[PCI_ROM_RESOURCE].flags &= ~IORESOURCE_ROM_SHADOW; 236
235 new_client->pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
236 return 0; 237 return 0;
237} 238}
238 239