Commit 55814b74c95a73dae6795e167294e6edc733aae9
Committed by
Dave Airlie
1 parent
99d32bd5c7
Exists in
master
and in
7 other branches
amd64-agp: run fallback when no bridges found, not when driver registration fails
I think the intent was that if no bridges matched agp_amd64_pci_table[], we would fall back to checking for any bridge with the AGP capability. But in the current code, we execute the fallback path only when pci_register_driver() itself fails, which is unrelated to whether any matching devices were found. This patch counts the AGP bridges found in the probe() method and executes the fallback path when none is found. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
Showing 1 changed file with 13 additions and 2 deletions Side-by-side Diff
drivers/char/agp/amd64-agp.c
... | ... | @@ -34,6 +34,7 @@ |
34 | 34 | |
35 | 35 | static struct resource *aperture_resource; |
36 | 36 | static int __initdata agp_try_unsupported = 1; |
37 | +static int agp_bridges_found; | |
37 | 38 | |
38 | 39 | static void amd64_tlbflush(struct agp_memory *temp) |
39 | 40 | { |
... | ... | @@ -489,6 +490,7 @@ |
489 | 490 | { |
490 | 491 | struct agp_bridge_data *bridge; |
491 | 492 | u8 cap_ptr; |
493 | + int err; | |
492 | 494 | |
493 | 495 | cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); |
494 | 496 | if (!cap_ptr) |
... | ... | @@ -536,7 +538,12 @@ |
536 | 538 | } |
537 | 539 | |
538 | 540 | pci_set_drvdata(pdev, bridge); |
539 | - return agp_add_bridge(bridge); | |
541 | + err = agp_add_bridge(bridge); | |
542 | + if (err < 0) | |
543 | + return err; | |
544 | + | |
545 | + agp_bridges_found++; | |
546 | + return 0; | |
540 | 547 | } |
541 | 548 | |
542 | 549 | static void __devexit agp_amd64_remove(struct pci_dev *pdev) |
... | ... | @@ -713,7 +720,11 @@ |
713 | 720 | |
714 | 721 | if (agp_off) |
715 | 722 | return -EINVAL; |
716 | - if (pci_register_driver(&agp_amd64_pci_driver) < 0) { | |
723 | + err = pci_register_driver(&agp_amd64_pci_driver); | |
724 | + if (err < 0) | |
725 | + return err; | |
726 | + | |
727 | + if (agp_bridges_found == 0) { | |
717 | 728 | struct pci_dev *dev; |
718 | 729 | if (!agp_try_unsupported && !agp_try_unsupported_boot) { |
719 | 730 | printk(KERN_INFO PFX "No supported AGP bridge found.\n"); |