diff options
Diffstat (limited to 'drivers/char/agp/amd64-agp.c')
-rw-r--r-- | drivers/char/agp/amd64-agp.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 2fb2e6cc322a..fd50ead59c79 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -728,6 +728,7 @@ int __init agp_amd64_init(void) | |||
728 | 728 | ||
729 | if (agp_off) | 729 | if (agp_off) |
730 | return -EINVAL; | 730 | return -EINVAL; |
731 | |||
731 | err = pci_register_driver(&agp_amd64_pci_driver); | 732 | err = pci_register_driver(&agp_amd64_pci_driver); |
732 | if (err < 0) | 733 | if (err < 0) |
733 | return err; | 734 | return err; |
@@ -764,19 +765,28 @@ int __init agp_amd64_init(void) | |||
764 | return err; | 765 | return err; |
765 | } | 766 | } |
766 | 767 | ||
768 | static int __init agp_amd64_mod_init(void) | ||
769 | { | ||
770 | #ifndef MODULE | ||
771 | if (gart_iommu_aperture) | ||
772 | return agp_bridges_found ? 0 : -ENODEV; | ||
773 | #endif | ||
774 | return agp_amd64_init(); | ||
775 | } | ||
776 | |||
767 | static void __exit agp_amd64_cleanup(void) | 777 | static void __exit agp_amd64_cleanup(void) |
768 | { | 778 | { |
779 | #ifndef MODULE | ||
780 | if (gart_iommu_aperture) | ||
781 | return; | ||
782 | #endif | ||
769 | if (aperture_resource) | 783 | if (aperture_resource) |
770 | release_resource(aperture_resource); | 784 | release_resource(aperture_resource); |
771 | pci_unregister_driver(&agp_amd64_pci_driver); | 785 | pci_unregister_driver(&agp_amd64_pci_driver); |
772 | } | 786 | } |
773 | 787 | ||
774 | /* On AMD64 the PCI driver needs to initialize this driver early | 788 | module_init(agp_amd64_mod_init); |
775 | for the IOMMU, so it has to be called via a backdoor. */ | ||
776 | #ifndef CONFIG_GART_IOMMU | ||
777 | module_init(agp_amd64_init); | ||
778 | module_exit(agp_amd64_cleanup); | 789 | module_exit(agp_amd64_cleanup); |
779 | #endif | ||
780 | 790 | ||
781 | MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen"); | 791 | MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen"); |
782 | module_param(agp_try_unsupported, bool, 0); | 792 | module_param(agp_try_unsupported, bool, 0); |