diff options
author | Dave Airlie <airlied@redhat.com> | 2009-07-31 15:34:32 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-07-31 15:34:32 +1000 |
commit | 0596c559af5ca277a069b04a6402d21724464cda (patch) | |
tree | 9865258129fcc9e7f758fbac268fa0ab63d687b2 /src | |
parent | 453928b8485bc7beff69996abe12628efc09405f (diff) |
vgaarb: add support for targetting default device
Diffstat (limited to 'src')
-rw-r--r-- | src/common_vgaarb.c | 12 |
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; } |