Merge branches 'amd-iommu/fixes' and 'dma-debug/fixes' into iommu/fixes
[linux-2.6-block.git] / drivers / char / agp / amd64-agp.c
index 5aa7a586a7ffc2716004ea771f191a6d548efc15..1afb8968a342082b87381d206beea315108431c2 100644 (file)
@@ -725,12 +725,11 @@ static struct pci_driver agp_amd64_pci_driver = {
 int __init agp_amd64_init(void)
 {
        int err = 0;
-       static int done = 0;
 
        if (agp_off)
                return -EINVAL;
 
-       if (done++)
+       if (gart_iommu_aperture)
                return agp_bridges_found ? 0 : -ENODEV;
 
        err = pci_register_driver(&agp_amd64_pci_driver);
@@ -771,6 +770,8 @@ int __init agp_amd64_init(void)
 
 static void __exit agp_amd64_cleanup(void)
 {
+       if (gart_iommu_aperture)
+               return;
        if (aperture_resource)
                release_resource(aperture_resource);
        pci_unregister_driver(&agp_amd64_pci_driver);