summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-07-31 15:34:32 +1000
committerDave Airlie <airlied@redhat.com>2009-07-31 15:34:32 +1000
commit0596c559af5ca277a069b04a6402d21724464cda (patch)
tree9865258129fcc9e7f758fbac268fa0ab63d687b2 /src
parent453928b8485bc7beff69996abe12628efc09405f (diff)
vgaarb: add support for targetting default device
Diffstat (limited to 'src')
-rw-r--r--src/common_vgaarb.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common_vgaarb.c b/src/common_vgaarb.c
index 302b89d..79d3f93 100644
--- a/src/common_vgaarb.c
+++ b/src/common_vgaarb.c
@@ -169,9 +169,13 @@ pci_device_vgaarb_set_target(struct pci_device *dev)
int len;
char buf[BUFSIZE];
int ret;
+ int rsrc;
- len = snprintf(buf, BUFSIZE, "target PCI:%d:%d:%d.%d",
- dev->domain, dev->bus, dev->dev, dev->func);
+ if (!dev)
+ len = snprintf(buf, BUFSIZE, "default");
+ else
+ len = snprintf(buf, BUFSIZE, "target PCI:%d:%d:%d.%d",
+ dev->domain, dev->bus, dev->dev, dev->func);
ret = vgaarb_write(pci_sys->vgaarb_fd, buf, len);
if (ret)
@@ -181,7 +185,9 @@ pci_device_vgaarb_set_target(struct pci_device *dev)
if (ret <= 0)
return -1;
- dev->vgaarb_rsrc = parse_string_to_decodes_rsrc(buf, &pci_sys->vga_count);
+ rsrc = parse_string_to_decodes_rsrc(buf, &pci_sys->vga_count);
+ if (dev)
+ dev->vgaarb_rsrc = rsrc;
return 0;
}