aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-12-11 05:34:35 -0500
committerDave Airlie <airlied@redhat.com>2013-12-17 20:20:04 -0500
commitd9906753bb997d651beaba0e4026a873bd0e8340 (patch)
tree08cfef0a3d712dc1354ce90cd489d33283d9cdcf /drivers/gpu/drm
parent8da79ccd1aaa2efe482b2c555c4684c7b503864a (diff)
drm: rip out drm_core_has_AGP
Most place actually want to just check for dev->agp (most do, but a few don't so this fixes a few potential NULL derefs). The only exception is the agp init code which should check for the AGP driver feature flag. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_agpsupport.c2
-rw-r--r--drivers/gpu/drm/drm_bufs.c4
-rw-r--r--drivers/gpu/drm/drm_memory.c9
-rw-r--r--drivers/gpu/drm/drm_pci.c4
-rw-r--r--drivers/gpu/drm/drm_vm.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c2
6 files changed, 11 insertions, 14 deletions
diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
index e301d653d97e..084a674e4b56 100644
--- a/drivers/gpu/drm/drm_agpsupport.c
+++ b/drivers/gpu/drm/drm_agpsupport.c
@@ -439,7 +439,7 @@ void drm_agp_clear(struct drm_device *dev)
439{ 439{
440 struct drm_agp_mem *entry, *tempe; 440 struct drm_agp_mem *entry, *tempe;
441 441
442 if (!drm_core_has_AGP(dev) || !dev->agp) 442 if (!dev->agp)
443 return; 443 return;
444 if (drm_core_check_feature(dev, DRIVER_MODESET)) 444 if (drm_core_check_feature(dev, DRIVER_MODESET))
445 return; 445 return;
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 766a5474fdbd..edec31fe3fed 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -261,7 +261,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
261 struct drm_agp_mem *entry; 261 struct drm_agp_mem *entry;
262 int valid = 0; 262 int valid = 0;
263 263
264 if (!drm_core_has_AGP(dev)) { 264 if (!dev->agp) {
265 kfree(map); 265 kfree(map);
266 return -EINVAL; 266 return -EINVAL;
267 } 267 }
@@ -1390,7 +1390,7 @@ int drm_mapbufs(struct drm_device *dev, void *data,
1390 spin_unlock(&dev->count_lock); 1390 spin_unlock(&dev->count_lock);
1391 1391
1392 if (request->count >= dma->buf_count) { 1392 if (request->count >= dma->buf_count) {
1393 if ((drm_core_has_AGP(dev) && (dma->flags & _DRM_DMA_USE_AGP)) 1393 if ((dev->agp && (dma->flags & _DRM_DMA_USE_AGP))
1394 || (drm_core_check_feature(dev, DRIVER_SG) 1394 || (drm_core_check_feature(dev, DRIVER_SG)
1395 && (dma->flags & _DRM_DMA_USE_SG))) { 1395 && (dma->flags & _DRM_DMA_USE_SG))) {
1396 struct drm_local_map *map = dev->agp_buffer_map; 1396 struct drm_local_map *map = dev->agp_buffer_map;
diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c
index 64e44fad8ae8..3359bc453e11 100644
--- a/drivers/gpu/drm/drm_memory.c
+++ b/drivers/gpu/drm/drm_memory.c
@@ -110,8 +110,7 @@ static inline void *agp_remap(unsigned long offset, unsigned long size,
110 110
111void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev) 111void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
112{ 112{
113 if (drm_core_has_AGP(dev) && 113 if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)
114 dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)
115 map->handle = agp_remap(map->offset, map->size, dev); 114 map->handle = agp_remap(map->offset, map->size, dev);
116 else 115 else
117 map->handle = ioremap(map->offset, map->size); 116 map->handle = ioremap(map->offset, map->size);
@@ -120,8 +119,7 @@ EXPORT_SYMBOL(drm_core_ioremap);
120 119
121void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev) 120void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev)
122{ 121{
123 if (drm_core_has_AGP(dev) && 122 if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)
124 dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)
125 map->handle = agp_remap(map->offset, map->size, dev); 123 map->handle = agp_remap(map->offset, map->size, dev);
126 else 124 else
127 map->handle = ioremap_wc(map->offset, map->size); 125 map->handle = ioremap_wc(map->offset, map->size);
@@ -133,8 +131,7 @@ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
133 if (!map->handle || !map->size) 131 if (!map->handle || !map->size)
134 return; 132 return;
135 133
136 if (drm_core_has_AGP(dev) && 134 if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)
137 dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)
138 vunmap(map->handle); 135 vunmap(map->handle);
139 else 136 else
140 iounmap(map->handle); 137 iounmap(map->handle);
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index d3875e3f9d9c..626e9cfd8aa5 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -264,7 +264,7 @@ static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
264 264
265static void drm_pci_agp_init(struct drm_device *dev) 265static void drm_pci_agp_init(struct drm_device *dev)
266{ 266{
267 if (drm_core_has_AGP(dev)) { 267 if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
268 if (drm_pci_device_is_agp(dev)) 268 if (drm_pci_device_is_agp(dev))
269 dev->agp = drm_agp_init(dev); 269 dev->agp = drm_agp_init(dev);
270 if (dev->agp) { 270 if (dev->agp) {
@@ -278,7 +278,7 @@ static void drm_pci_agp_init(struct drm_device *dev)
278 278
279static void drm_pci_agp_destroy(struct drm_device *dev) 279static void drm_pci_agp_destroy(struct drm_device *dev)
280{ 280{
281 if (drm_core_has_AGP(dev) && dev->agp) { 281 if (dev->agp) {
282 arch_phys_wc_del(dev->agp->agp_mtrr); 282 arch_phys_wc_del(dev->agp->agp_mtrr);
283 drm_agp_clear(dev); 283 drm_agp_clear(dev);
284 drm_agp_destroy(dev->agp); 284 drm_agp_destroy(dev->agp);
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index 79873bb2923f..ef5540b6b451 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -101,7 +101,7 @@ static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
101 /* 101 /*
102 * Find the right map 102 * Find the right map
103 */ 103 */
104 if (!drm_core_has_AGP(dev)) 104 if (!dev->agp)
105 goto vm_fault_error; 105 goto vm_fault_error;
106 106
107 if (!dev->agp || !dev->agp->cant_use_aperture) 107 if (!dev->agp || !dev->agp->cant_use_aperture)
@@ -592,7 +592,7 @@ int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
592 switch (map->type) { 592 switch (map->type) {
593#if !defined(__arm__) 593#if !defined(__arm__)
594 case _DRM_AGP: 594 case _DRM_AGP:
595 if (drm_core_has_AGP(dev) && dev->agp->cant_use_aperture) { 595 if (dev->agp && dev->agp->cant_use_aperture) {
596 /* 596 /*
597 * On some platforms we can't talk to bus dma address from the CPU, so for 597 * On some platforms we can't talk to bus dma address from the CPU, so for
598 * memory of type DRM_AGP, we'll deal with sorting out the real physical 598 * memory of type DRM_AGP, we'll deal with sorting out the real physical
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 71245d6f34a2..051fa874065a 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -142,7 +142,7 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
142 man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | TTM_MEMTYPE_FLAG_CMA; 142 man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | TTM_MEMTYPE_FLAG_CMA;
143#if __OS_HAS_AGP 143#if __OS_HAS_AGP
144 if (rdev->flags & RADEON_IS_AGP) { 144 if (rdev->flags & RADEON_IS_AGP) {
145 if (!(drm_core_has_AGP(rdev->ddev) && rdev->ddev->agp)) { 145 if (!rdev->ddev->agp) {
146 DRM_ERROR("AGP is not enabled for memory type %u\n", 146 DRM_ERROR("AGP is not enabled for memory type %u\n",
147 (unsigned)type); 147 (unsigned)type);
148 return -EINVAL; 148 return -EINVAL;