diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/gpu/vga/vgaarb.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/gpu/vga/vgaarb.c')
-rw-r--r-- | drivers/gpu/vga/vgaarb.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index 1ac0c93603c9..441e38c95a85 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
21 | #include <linux/poll.h> | 21 | #include <linux/poll.h> |
22 | #include <linux/miscdevice.h> | 22 | #include <linux/miscdevice.h> |
23 | #include <linux/slab.h> | ||
23 | 24 | ||
24 | #include <linux/uaccess.h> | 25 | #include <linux/uaccess.h> |
25 | 26 | ||
@@ -688,7 +689,7 @@ EXPORT_SYMBOL(vga_client_register); | |||
688 | * the arbiter. | 689 | * the arbiter. |
689 | */ | 690 | */ |
690 | 691 | ||
691 | #define MAX_USER_CARDS 16 | 692 | #define MAX_USER_CARDS CONFIG_VGA_ARB_MAX_GPUS |
692 | #define PCI_INVALID_CARD ((struct pci_dev *)-1UL) | 693 | #define PCI_INVALID_CARD ((struct pci_dev *)-1UL) |
693 | 694 | ||
694 | /* | 695 | /* |
@@ -954,6 +955,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
954 | } | 955 | } |
955 | 956 | ||
956 | } else if (strncmp(curr_pos, "target ", 7) == 0) { | 957 | } else if (strncmp(curr_pos, "target ", 7) == 0) { |
958 | struct pci_bus *pbus; | ||
957 | unsigned int domain, bus, devfn; | 959 | unsigned int domain, bus, devfn; |
958 | struct vga_device *vgadev; | 960 | struct vga_device *vgadev; |
959 | 961 | ||
@@ -961,7 +963,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
961 | remaining -= 7; | 963 | remaining -= 7; |
962 | pr_devel("client 0x%p called 'target'\n", priv); | 964 | pr_devel("client 0x%p called 'target'\n", priv); |
963 | /* if target is default */ | 965 | /* if target is default */ |
964 | if (!strncmp(buf, "default", 7)) | 966 | if (!strncmp(curr_pos, "default", 7)) |
965 | pdev = pci_dev_get(vga_default_device()); | 967 | pdev = pci_dev_get(vga_default_device()); |
966 | else { | 968 | else { |
967 | if (!vga_pci_str_to_vars(curr_pos, remaining, | 969 | if (!vga_pci_str_to_vars(curr_pos, remaining, |
@@ -969,18 +971,31 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
969 | ret_val = -EPROTO; | 971 | ret_val = -EPROTO; |
970 | goto done; | 972 | goto done; |
971 | } | 973 | } |
972 | 974 | pr_devel("vgaarb: %s ==> %x:%x:%x.%x\n", curr_pos, | |
973 | pdev = pci_get_bus_and_slot(bus, devfn); | 975 | domain, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); |
976 | |||
977 | pbus = pci_find_bus(domain, bus); | ||
978 | pr_devel("vgaarb: pbus %p\n", pbus); | ||
979 | if (pbus == NULL) { | ||
980 | pr_err("vgaarb: invalid PCI domain and/or bus address %x:%x\n", | ||
981 | domain, bus); | ||
982 | ret_val = -ENODEV; | ||
983 | goto done; | ||
984 | } | ||
985 | pdev = pci_get_slot(pbus, devfn); | ||
986 | pr_devel("vgaarb: pdev %p\n", pdev); | ||
974 | if (!pdev) { | 987 | if (!pdev) { |
975 | pr_info("vgaarb: invalid PCI address!\n"); | 988 | pr_err("vgaarb: invalid PCI address %x:%x\n", |
989 | bus, devfn); | ||
976 | ret_val = -ENODEV; | 990 | ret_val = -ENODEV; |
977 | goto done; | 991 | goto done; |
978 | } | 992 | } |
979 | } | 993 | } |
980 | 994 | ||
981 | vgadev = vgadev_find(pdev); | 995 | vgadev = vgadev_find(pdev); |
996 | pr_devel("vgaarb: vgadev %p\n", vgadev); | ||
982 | if (vgadev == NULL) { | 997 | if (vgadev == NULL) { |
983 | pr_info("vgaarb: this pci device is not a vga device\n"); | 998 | pr_err("vgaarb: this pci device is not a vga device\n"); |
984 | pci_dev_put(pdev); | 999 | pci_dev_put(pdev); |
985 | ret_val = -ENODEV; | 1000 | ret_val = -ENODEV; |
986 | goto done; | 1001 | goto done; |
@@ -998,7 +1013,8 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
998 | } | 1013 | } |
999 | } | 1014 | } |
1000 | if (i == MAX_USER_CARDS) { | 1015 | if (i == MAX_USER_CARDS) { |
1001 | pr_err("vgaarb: maximum user cards number reached!\n"); | 1016 | pr_err("vgaarb: maximum user cards (%d) number reached!\n", |
1017 | MAX_USER_CARDS); | ||
1002 | pci_dev_put(pdev); | 1018 | pci_dev_put(pdev); |
1003 | /* XXX: which value to return? */ | 1019 | /* XXX: which value to return? */ |
1004 | ret_val = -ENOMEM; | 1020 | ret_val = -ENOMEM; |