aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyuw@linux.intel.com>2010-02-23 01:05:24 -0500
committerEric Anholt <eric@anholt.net>2010-02-26 16:23:20 -0500
commit1f7a6e372e9cb4d749f34c0738d832e6cadb4071 (patch)
treedd9d5a80528078424dd4b3385917c3e82ee374cd /drivers
parentc619eed4b2ee1b2bde3e02464eb81632a08bb976 (diff)
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: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/agp/intel-agp.c10
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c6
2 files changed, 14 insertions, 2 deletions
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 918e484f41b7..c1c07a2ccb11 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -10,6 +10,9 @@
10#include <linux/agp_backend.h> 10#include <linux/agp_backend.h>
11#include "agp.h" 11#include "agp.h"
12 12
13int intel_agp_enabled;
14EXPORT_SYMBOL(intel_agp_enabled);
15
13/* 16/*
14 * If we have Intel graphics, we're not going to have anything other than 17 * If we have Intel graphics, we're not going to have anything other than
15 * an Intel IOMMU. So make the correct use of the PCI DMA API contingent 18 * 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 struct agp_bridge_data *bridge; 2476 struct agp_bridge_data *bridge;
2474 u8 cap_ptr = 0; 2477 u8 cap_ptr = 0;
2475 struct resource *r; 2478 struct resource *r;
2476 int i; 2479 int i, err;
2477 2480
2478 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP); 2481 cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
2479 2482
@@ -2565,7 +2568,10 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
2565 } 2568 }
2566 2569
2567 pci_set_drvdata(pdev, bridge); 2570 pci_set_drvdata(pdev, bridge);
2568 return agp_add_bridge(bridge); 2571 err = agp_add_bridge(bridge);
2572 if (!err)
2573 intel_agp_enabled = 1;
2574 return err;
2569} 2575}
2570 2576
2571static void __devexit agp_intel_remove(struct pci_dev *pdev) 2577static void __devexit agp_intel_remove(struct pci_dev *pdev)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 2a9178bb2748..85ad020125c8 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -49,6 +49,7 @@ unsigned int i915_lvds_downclock = 0;
49module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400); 49module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
50 50
51static struct drm_driver driver; 51static struct drm_driver driver;
52extern int intel_agp_enabled;
52 53
53#define INTEL_VGA_DEVICE(id, info) { \ 54#define INTEL_VGA_DEVICE(id, info) { \
54 .class = PCI_CLASS_DISPLAY_VGA << 8, \ 55 .class = PCI_CLASS_DISPLAY_VGA << 8, \
@@ -558,6 +559,11 @@ static struct drm_driver driver = {
558 559
559static int __init i915_init(void) 560static int __init i915_init(void)
560{ 561{
562 if (!intel_agp_enabled) {
563 DRM_ERROR("drm/i915 can't work without intel_agp module!\n");
564 return -ENODEV;
565 }
566
561 driver.num_ioctls = i915_max_ioctl; 567 driver.num_ioctls = i915_max_ioctl;
562 568
563 i915_gem_shrinker_init(); 569 i915_gem_shrinker_init();