drm: remove DRM_GETSAREA and replace with drm_getsarea function
authorDave Airlie <airlied@linux.ie>
Fri, 25 May 2007 19:04:51 +0000 (05:04 +1000)
committerDave Airlie <airlied@linux.ie>
Wed, 11 Jul 2007 01:58:02 +0000 (11:58 +1000)
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/char/drm/drmP.h
drivers/char/drm/drm_drv.c
drivers/char/drm/drm_os_linux.h
drivers/char/drm/i915_dma.c
drivers/char/drm/mga_dma.c
drivers/char/drm/r128_cce.c
drivers/char/drm/radeon_cp.c
drivers/char/drm/savage_bci.c
drivers/char/drm/via_map.c

index 22779582ee5b8ea980068b015afd3ee8810db6a4..8634f761362056e4a6cd24719c68742f80548b25 100644 (file)
@@ -1024,6 +1024,8 @@ extern drm_head_t **drm_heads;
 extern struct class *drm_class;
 extern struct proc_dir_entry *drm_proc_root;
 
+extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
+
                                /* Proc support (drm_proc.h) */
 extern int drm_proc_init(drm_device_t * dev,
                         int minor,
index d7d10f118eaa687093e0d6e7949af225413301b3..30933bb5fd834e4c38b8dc0f47de0172d361da95 100644 (file)
@@ -517,3 +517,17 @@ int drm_ioctl(struct inode *inode, struct file *filp,
 }
 
 EXPORT_SYMBOL(drm_ioctl);
+
+drm_local_map_t *drm_getsarea(struct drm_device *dev)
+{
+       drm_map_list_t *entry;
+
+       list_for_each_entry(entry, &dev->maplist->head, head) {
+               if (entry->map && entry->map->type == _DRM_SHM &&
+                   (entry->map->flags & _DRM_CONTAINS_LOCK)) {
+                       return entry->map;
+               }
+       }
+       return NULL;
+}
+EXPORT_SYMBOL(drm_getsarea);
index e6e5ae89e100318d3de60d25a498a12056a7381d..24767aaa8ea57855a76ec744eaa55aa73ffe193e 100644 (file)
@@ -96,24 +96,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
 
 #define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data
 
-/**
- * Get the pointer to the SAREA.
- *
- * Searches the SAREA on the mapping lists and points drm_device::sarea to it.
- */
-#define DRM_GETSAREA()                                                  \
-do {                                                                    \
-       drm_map_list_t *entry;                                           \
-       list_for_each_entry( entry, &dev->maplist, head ) {              \
-               if ( entry->map &&                                       \
-                    entry->map->type == _DRM_SHM &&                     \
-                    (entry->map->flags & _DRM_CONTAINS_LOCK) ) {        \
-                       dev_priv->sarea = entry->map;                    \
-                       break;                                           \
-               }                                                        \
-       }                                                                \
-} while (0)
-
 #define DRM_HZ HZ
 
 #define DRM_WAIT_ON( ret, queue, timeout, condition )          \
index ea52740af4f6d277da7df0977c24636c4a853acb..9ba114657c5e2286368d2ed562606be6428c8b6b 100644 (file)
@@ -132,7 +132,7 @@ static int i915_initialize(drm_device_t * dev,
 {
        memset(dev_priv, 0, sizeof(drm_i915_private_t));
 
-       DRM_GETSAREA();
+       dev_priv->sarea = drm_getsarea(dev);
        if (!dev_priv->sarea) {
                DRM_ERROR("can not find sarea!\n");
                dev->dev_private = (void *)dev_priv;
index 5781a8d934f8bdcb113921acdd4e3e587793a76d..769fee8cc3091b3a12f1f2fe11aee21e29fef3ff 100644 (file)
@@ -823,8 +823,7 @@ static int mga_do_init_dma(drm_device_t * dev, drm_mga_init_t * init)
        dev_priv->texture_offset = init->texture_offset[0];
        dev_priv->texture_size = init->texture_size[0];
 
-       DRM_GETSAREA();
-
+       dev_priv->sarea = drm_getsarea(dev);
        if (!dev_priv->sarea) {
                DRM_ERROR("failed to find sarea!\n");
                return DRM_ERR(EINVAL);
index 1014602c43a71910e4f7eba390e123c47670c3f2..eabb4c42c319cfb0fab8cc726d3338cae9605292 100644 (file)
@@ -456,8 +456,7 @@ static int r128_do_init_cce(drm_device_t * dev, drm_r128_init_t * init)
        dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch / 8) << 21) |
                                         (dev_priv->span_offset >> 5));
 
-       DRM_GETSAREA();
-
+       dev_priv->sarea = drm_getsarea(dev);
        if (!dev_priv->sarea) {
                DRM_ERROR("could not find sarea!\n");
                dev->dev_private = (void *)dev_priv;
index 68338389d836b244258e9db82406f8cb4dc5936b..aac5db3a0eb063f32c9ef66dbde2787c18a5955d 100644 (file)
@@ -1501,13 +1501,13 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
                                         RADEON_ROUND_MODE_TRUNC |
                                         RADEON_ROUND_PREC_8TH_PIX);
 
-       DRM_GETSAREA();
 
        dev_priv->ring_offset = init->ring_offset;
        dev_priv->ring_rptr_offset = init->ring_rptr_offset;
        dev_priv->buffers_offset = init->buffers_offset;
        dev_priv->gart_textures_offset = init->gart_textures_offset;
 
+       dev_priv->sarea = drm_getsarea(dev);
        if (!dev_priv->sarea) {
                DRM_ERROR("could not find sarea!\n");
                radeon_do_cleanup_cp(dev);
index b94fab55680940dd44688052e0987634ad3b9cc1..0321144e7a3592ffc542a5a6fda66918ee61024b 100644 (file)
@@ -711,7 +711,7 @@ static int savage_do_init_bci(drm_device_t * dev, drm_savage_init_t * init)
        dev_priv->texture_offset = init->texture_offset;
        dev_priv->texture_size = init->texture_size;
 
-       DRM_GETSAREA();
+       dev_priv->sarea = drm_getsarea(dev);
        if (!dev_priv->sarea) {
                DRM_ERROR("could not find sarea!\n");
                savage_do_cleanup_bci(dev);
index 4e3fc072aa3b6a4de0b3437eded6b337f91f1fc7..dea6390a61f03756e4c32cf51bffc9a7ccaebc5d 100644 (file)
@@ -31,7 +31,7 @@ static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init)
 
        DRM_DEBUG("%s\n", __FUNCTION__);
 
-       DRM_GETSAREA();
+       dev_priv->sarea = drm_getsarea(dev);
        if (!dev_priv->sarea) {
                DRM_ERROR("could not find sarea!\n");
                dev->dev_private = (void *)dev_priv;