aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-05-25 15:04:51 -0400
committerDave Airlie <airlied@linux.ie>2007-07-10 21:58:02 -0400
commitda509d7a02cb54938776439edc81f057e39f81e0 (patch)
tree9610b5c9040393041807014ed20c4497459550b8 /drivers/char
parentbd1b331fae2813d9f03ceee649296f02edc0b893 (diff)
drm: remove DRM_GETSAREA and replace with drm_getsarea function
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/drm/drmP.h2
-rw-r--r--drivers/char/drm/drm_drv.c14
-rw-r--r--drivers/char/drm/drm_os_linux.h18
-rw-r--r--drivers/char/drm/i915_dma.c2
-rw-r--r--drivers/char/drm/mga_dma.c3
-rw-r--r--drivers/char/drm/r128_cce.c3
-rw-r--r--drivers/char/drm/radeon_cp.c2
-rw-r--r--drivers/char/drm/savage_bci.c2
-rw-r--r--drivers/char/drm/via_map.c2
9 files changed, 22 insertions, 26 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 22779582ee5b..8634f7613620 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -1024,6 +1024,8 @@ extern drm_head_t **drm_heads;
1024extern struct class *drm_class; 1024extern struct class *drm_class;
1025extern struct proc_dir_entry *drm_proc_root; 1025extern struct proc_dir_entry *drm_proc_root;
1026 1026
1027extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
1028
1027 /* Proc support (drm_proc.h) */ 1029 /* Proc support (drm_proc.h) */
1028extern int drm_proc_init(drm_device_t * dev, 1030extern int drm_proc_init(drm_device_t * dev,
1029 int minor, 1031 int minor,
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index d7d10f118eaa..30933bb5fd83 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -517,3 +517,17 @@ int drm_ioctl(struct inode *inode, struct file *filp,
517} 517}
518 518
519EXPORT_SYMBOL(drm_ioctl); 519EXPORT_SYMBOL(drm_ioctl);
520
521drm_local_map_t *drm_getsarea(struct drm_device *dev)
522{
523 drm_map_list_t *entry;
524
525 list_for_each_entry(entry, &dev->maplist->head, head) {
526 if (entry->map && entry->map->type == _DRM_SHM &&
527 (entry->map->flags & _DRM_CONTAINS_LOCK)) {
528 return entry->map;
529 }
530 }
531 return NULL;
532}
533EXPORT_SYMBOL(drm_getsarea);
diff --git a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h
index e6e5ae89e100..24767aaa8ea5 100644
--- a/drivers/char/drm/drm_os_linux.h
+++ b/drivers/char/drm/drm_os_linux.h
@@ -96,24 +96,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
96 96
97#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data 97#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data
98 98
99/**
100 * Get the pointer to the SAREA.
101 *
102 * Searches the SAREA on the mapping lists and points drm_device::sarea to it.
103 */
104#define DRM_GETSAREA() \
105do { \
106 drm_map_list_t *entry; \
107 list_for_each_entry( entry, &dev->maplist, head ) { \
108 if ( entry->map && \
109 entry->map->type == _DRM_SHM && \
110 (entry->map->flags & _DRM_CONTAINS_LOCK) ) { \
111 dev_priv->sarea = entry->map; \
112 break; \
113 } \
114 } \
115} while (0)
116
117#define DRM_HZ HZ 99#define DRM_HZ HZ
118 100
119#define DRM_WAIT_ON( ret, queue, timeout, condition ) \ 101#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index ea52740af4f6..9ba114657c5e 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -132,7 +132,7 @@ static int i915_initialize(drm_device_t * dev,
132{ 132{
133 memset(dev_priv, 0, sizeof(drm_i915_private_t)); 133 memset(dev_priv, 0, sizeof(drm_i915_private_t));
134 134
135 DRM_GETSAREA(); 135 dev_priv->sarea = drm_getsarea(dev);
136 if (!dev_priv->sarea) { 136 if (!dev_priv->sarea) {
137 DRM_ERROR("can not find sarea!\n"); 137 DRM_ERROR("can not find sarea!\n");
138 dev->dev_private = (void *)dev_priv; 138 dev->dev_private = (void *)dev_priv;
diff --git a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c
index 5781a8d934f8..769fee8cc309 100644
--- a/drivers/char/drm/mga_dma.c
+++ b/drivers/char/drm/mga_dma.c
@@ -823,8 +823,7 @@ static int mga_do_init_dma(drm_device_t * dev, drm_mga_init_t * init)
823 dev_priv->texture_offset = init->texture_offset[0]; 823 dev_priv->texture_offset = init->texture_offset[0];
824 dev_priv->texture_size = init->texture_size[0]; 824 dev_priv->texture_size = init->texture_size[0];
825 825
826 DRM_GETSAREA(); 826 dev_priv->sarea = drm_getsarea(dev);
827
828 if (!dev_priv->sarea) { 827 if (!dev_priv->sarea) {
829 DRM_ERROR("failed to find sarea!\n"); 828 DRM_ERROR("failed to find sarea!\n");
830 return DRM_ERR(EINVAL); 829 return DRM_ERR(EINVAL);
diff --git a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c
index 1014602c43a7..eabb4c42c319 100644
--- a/drivers/char/drm/r128_cce.c
+++ b/drivers/char/drm/r128_cce.c
@@ -456,8 +456,7 @@ static int r128_do_init_cce(drm_device_t * dev, drm_r128_init_t * init)
456 dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch / 8) << 21) | 456 dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch / 8) << 21) |
457 (dev_priv->span_offset >> 5)); 457 (dev_priv->span_offset >> 5));
458 458
459 DRM_GETSAREA(); 459 dev_priv->sarea = drm_getsarea(dev);
460
461 if (!dev_priv->sarea) { 460 if (!dev_priv->sarea) {
462 DRM_ERROR("could not find sarea!\n"); 461 DRM_ERROR("could not find sarea!\n");
463 dev->dev_private = (void *)dev_priv; 462 dev->dev_private = (void *)dev_priv;
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 68338389d836..aac5db3a0eb0 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -1501,13 +1501,13 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
1501 RADEON_ROUND_MODE_TRUNC | 1501 RADEON_ROUND_MODE_TRUNC |
1502 RADEON_ROUND_PREC_8TH_PIX); 1502 RADEON_ROUND_PREC_8TH_PIX);
1503 1503
1504 DRM_GETSAREA();
1505 1504
1506 dev_priv->ring_offset = init->ring_offset; 1505 dev_priv->ring_offset = init->ring_offset;
1507 dev_priv->ring_rptr_offset = init->ring_rptr_offset; 1506 dev_priv->ring_rptr_offset = init->ring_rptr_offset;
1508 dev_priv->buffers_offset = init->buffers_offset; 1507 dev_priv->buffers_offset = init->buffers_offset;
1509 dev_priv->gart_textures_offset = init->gart_textures_offset; 1508 dev_priv->gart_textures_offset = init->gart_textures_offset;
1510 1509
1510 dev_priv->sarea = drm_getsarea(dev);
1511 if (!dev_priv->sarea) { 1511 if (!dev_priv->sarea) {
1512 DRM_ERROR("could not find sarea!\n"); 1512 DRM_ERROR("could not find sarea!\n");
1513 radeon_do_cleanup_cp(dev); 1513 radeon_do_cleanup_cp(dev);
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c
index b94fab556809..0321144e7a35 100644
--- a/drivers/char/drm/savage_bci.c
+++ b/drivers/char/drm/savage_bci.c
@@ -711,7 +711,7 @@ static int savage_do_init_bci(drm_device_t * dev, drm_savage_init_t * init)
711 dev_priv->texture_offset = init->texture_offset; 711 dev_priv->texture_offset = init->texture_offset;
712 dev_priv->texture_size = init->texture_size; 712 dev_priv->texture_size = init->texture_size;
713 713
714 DRM_GETSAREA(); 714 dev_priv->sarea = drm_getsarea(dev);
715 if (!dev_priv->sarea) { 715 if (!dev_priv->sarea) {
716 DRM_ERROR("could not find sarea!\n"); 716 DRM_ERROR("could not find sarea!\n");
717 savage_do_cleanup_bci(dev); 717 savage_do_cleanup_bci(dev);
diff --git a/drivers/char/drm/via_map.c b/drivers/char/drm/via_map.c
index 4e3fc072aa3b..dea6390a61f0 100644
--- a/drivers/char/drm/via_map.c
+++ b/drivers/char/drm/via_map.c
@@ -31,7 +31,7 @@ static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init)
31 31
32 DRM_DEBUG("%s\n", __FUNCTION__); 32 DRM_DEBUG("%s\n", __FUNCTION__);
33 33
34 DRM_GETSAREA(); 34 dev_priv->sarea = drm_getsarea(dev);
35 if (!dev_priv->sarea) { 35 if (!dev_priv->sarea) {
36 DRM_ERROR("could not find sarea!\n"); 36 DRM_ERROR("could not find sarea!\n");
37 dev->dev_private = (void *)dev_priv; 37 dev->dev_private = (void *)dev_priv;