Commit 1f7a6e37 authored by Zhenyu Wang's avatar Zhenyu Wang Committed by Eric Anholt

drm/i915: Add dependency on the intel agp module

See http://bugzilla.kernel.org/show_bug.cgi?id=15021

Make sure that the appropriate AGP module is loaded and probed before
trying to set up the DRM.  The DRM already depends on the AGP core,
but in this case we know the specific AGP driver we need too, and can
help users avoid the trap of loading the AGP driver after the DRM
driver.
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent c619eed4
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
#include <linux/agp_backend.h> #include <linux/agp_backend.h>
#include "agp.h" #include "agp.h"
int intel_agp_enabled;
EXPORT_SYMBOL(intel_agp_enabled);
/* /*
* If we have Intel graphics, we're not going to have anything other than * If we have Intel graphics, we're not going to have anything other than
* an Intel IOMMU. So make the correct use of the PCI DMA API contingent * an Intel IOMMU. So make the correct use of the PCI DMA API contingent
...@@ -2473,7 +2476,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, ...@@ -2473,7 +2476,7 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
struct agp_bridge_data *bridge; struct agp_bridge_data *bridge;
u8 cap_ptr = 0; u8 cap_ptr = 0;
struct resource *r; struct resource *r;
int i; int i, err;
cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
...@@ -2565,7 +2568,10 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, ...@@ -2565,7 +2568,10 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
} }
pci_set_drvdata(pdev, bridge); pci_set_drvdata(pdev, bridge);
return agp_add_bridge(bridge); err = agp_add_bridge(bridge);
if (!err)
intel_agp_enabled = 1;
return err;
} }
static void __devexit agp_intel_remove(struct pci_dev *pdev) static void __devexit agp_intel_remove(struct pci_dev *pdev)
......
...@@ -49,6 +49,7 @@ unsigned int i915_lvds_downclock = 0; ...@@ -49,6 +49,7 @@ unsigned int i915_lvds_downclock = 0;
module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400); module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
static struct drm_driver driver; static struct drm_driver driver;
extern int intel_agp_enabled;
#define INTEL_VGA_DEVICE(id, info) { \ #define INTEL_VGA_DEVICE(id, info) { \
.class = PCI_CLASS_DISPLAY_VGA << 8, \ .class = PCI_CLASS_DISPLAY_VGA << 8, \
...@@ -558,6 +559,11 @@ static struct drm_driver driver = { ...@@ -558,6 +559,11 @@ static struct drm_driver driver = {
static int __init i915_init(void) static int __init i915_init(void)
{ {
if (!intel_agp_enabled) {
DRM_ERROR("drm/i915 can't work without intel_agp module!\n");
return -ENODEV;
}
driver.num_ioctls = i915_max_ioctl; driver.num_ioctls = i915_max_ioctl;
i915_gem_shrinker_init(); i915_gem_shrinker_init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment