Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Daniel Vetter and committed by
Dave Airlie
d9906753 8da79ccd

+11 -26
+1 -1
drivers/gpu/drm/drm_agpsupport.c
··· 439 439 { 440 440 struct drm_agp_mem *entry, *tempe; 441 441 442 - if (!drm_core_has_AGP(dev) || !dev->agp) 442 + if (!dev->agp) 443 443 return; 444 444 if (drm_core_check_feature(dev, DRIVER_MODESET)) 445 445 return;
+2 -2
drivers/gpu/drm/drm_bufs.c
··· 261 261 struct drm_agp_mem *entry; 262 262 int valid = 0; 263 263 264 - if (!drm_core_has_AGP(dev)) { 264 + if (!dev->agp) { 265 265 kfree(map); 266 266 return -EINVAL; 267 267 } ··· 1390 1390 spin_unlock(&dev->count_lock); 1391 1391 1392 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 1394 || (drm_core_check_feature(dev, DRIVER_SG) 1395 1395 && (dma->flags & _DRM_DMA_USE_SG))) { 1396 1396 struct drm_local_map *map = dev->agp_buffer_map;
+3 -6
drivers/gpu/drm/drm_memory.c
··· 110 110 111 111 void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev) 112 112 { 113 - if (drm_core_has_AGP(dev) && 114 - dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) 113 + if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) 115 114 map->handle = agp_remap(map->offset, map->size, dev); 116 115 else 117 116 map->handle = ioremap(map->offset, map->size); ··· 119 120 120 121 void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev) 121 122 { 122 - if (drm_core_has_AGP(dev) && 123 - dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) 123 + if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) 124 124 map->handle = agp_remap(map->offset, map->size, dev); 125 125 else 126 126 map->handle = ioremap_wc(map->offset, map->size); ··· 131 133 if (!map->handle || !map->size) 132 134 return; 133 135 134 - if (drm_core_has_AGP(dev) && 135 - dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) 136 + if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) 136 137 vunmap(map->handle); 137 138 else 138 139 iounmap(map->handle);
+2 -2
drivers/gpu/drm/drm_pci.c
··· 264 264 265 265 static 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 268 if (drm_pci_device_is_agp(dev)) 269 269 dev->agp = drm_agp_init(dev); 270 270 if (dev->agp) { ··· 278 278 279 279 static 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 282 arch_phys_wc_del(dev->agp->agp_mtrr); 283 283 drm_agp_clear(dev); 284 284 drm_agp_destroy(dev->agp);
+2 -2
drivers/gpu/drm/drm_vm.c
··· 101 101 /* 102 102 * Find the right map 103 103 */ 104 - if (!drm_core_has_AGP(dev)) 104 + if (!dev->agp) 105 105 goto vm_fault_error; 106 106 107 107 if (!dev->agp || !dev->agp->cant_use_aperture) ··· 592 592 switch (map->type) { 593 593 #if !defined(__arm__) 594 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 597 * On some platforms we can't talk to bus dma address from the CPU, so for 598 598 * memory of type DRM_AGP, we'll deal with sorting out the real physical
+1 -1
drivers/gpu/drm/radeon/radeon_ttm.c
··· 142 142 man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | TTM_MEMTYPE_FLAG_CMA; 143 143 #if __OS_HAS_AGP 144 144 if (rdev->flags & RADEON_IS_AGP) { 145 - if (!(drm_core_has_AGP(rdev->ddev) && rdev->ddev->agp)) { 145 + if (!rdev->ddev->agp) { 146 146 DRM_ERROR("AGP is not enabled for memory type %u\n", 147 147 (unsigned)type); 148 148 return -EINVAL;
-12
include/drm/drm_agpsupport.h
··· 46 46 int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); 47 47 int drm_agp_bind_ioctl(struct drm_device *dev, void *data, 48 48 struct drm_file *file_priv); 49 - 50 - static inline int drm_core_has_AGP(struct drm_device *dev) 51 - { 52 - return drm_core_check_feature(dev, DRIVER_USE_AGP); 53 - } 54 - 55 49 #else /* __OS_HAS_AGP */ 56 50 57 51 static inline void drm_free_agp(DRM_AGP_MEM * handle, int pages) ··· 177 183 { 178 184 return -ENODEV; 179 185 } 180 - 181 - static inline int drm_core_has_AGP(struct drm_device *dev) 182 - { 183 - return 0; 184 - } 185 - 186 186 #endif /* __OS_HAS_AGP */ 187 187 188 188 #endif /* _DRM_AGPSUPPORT_H_ */