aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2005-07-10 02:56:52 -0400
committerDave Airlie <airlied@linux.ie>2005-07-10 02:56:52 -0400
commit7ab984012a879a53abb56abfe03b0c686f42b281 (patch)
tree53738f82e57b2aa91c5706f6c463831ddf19164d /drivers/char/drm
parent9c8da5ebbf6f87293cf8555182da271449889a69 (diff)
drm: update some function so a driver can call them
This patch splits some ioctl functions so that they can be called in-kernel by a DRM driver. The driver will use them later. From: Ian Romanick <idr@us.ibm.com> Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm')
-rw-r--r--drivers/char/drm/drmP.h34
-rw-r--r--drivers/char/drm/drm_agpsupport.c135
-rw-r--r--drivers/char/drm/drm_bufs.c84
-rw-r--r--drivers/char/drm/drm_drv.c15
4 files changed, 167 insertions, 101 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 7e633a9ce933..d16d07e28b4c 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -889,11 +889,16 @@ extern int drm_lock_free(drm_device_t *dev,
889 unsigned int context); 889 unsigned int context);
890 890
891 /* Buffer management support (drm_bufs.h) */ 891 /* Buffer management support (drm_bufs.h) */
892extern int drm_addmap(drm_device_t *dev, unsigned int offset,
893 unsigned int size, drm_map_type_t type,
894 drm_map_flags_t flags, drm_map_t **map_ptr);
895extern int drm_addmap_ioctl(struct inode *inode, struct file *filp,
896 unsigned int cmd, unsigned long arg);
897extern int drm_rmmap(drm_device_t *dev, void *handle);
898extern int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
899 unsigned int cmd, unsigned long arg);
900
892extern int drm_order( unsigned long size ); 901extern int drm_order( unsigned long size );
893extern int drm_addmap( struct inode *inode, struct file *filp,
894 unsigned int cmd, unsigned long arg );
895extern int drm_rmmap( struct inode *inode, struct file *filp,
896 unsigned int cmd, unsigned long arg );
897extern int drm_addbufs( struct inode *inode, struct file *filp, 902extern int drm_addbufs( struct inode *inode, struct file *filp,
898 unsigned int cmd, unsigned long arg ); 903 unsigned int cmd, unsigned long arg );
899extern int drm_infobufs( struct inode *inode, struct file *filp, 904extern int drm_infobufs( struct inode *inode, struct file *filp,
@@ -927,15 +932,18 @@ extern void drm_vbl_send_signals( drm_device_t *dev );
927 932
928 /* AGP/GART support (drm_agpsupport.h) */ 933 /* AGP/GART support (drm_agpsupport.h) */
929extern drm_agp_head_t *drm_agp_init(drm_device_t *dev); 934extern drm_agp_head_t *drm_agp_init(drm_device_t *dev);
930extern int drm_agp_acquire(struct inode *inode, struct file *filp, 935extern int drm_agp_acquire(drm_device_t * dev);
931 unsigned int cmd, unsigned long arg); 936extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
932extern void drm_agp_do_release(drm_device_t *dev); 937 unsigned int cmd, unsigned long arg);
933extern int drm_agp_release(struct inode *inode, struct file *filp, 938extern int drm_agp_release(drm_device_t *dev);
934 unsigned int cmd, unsigned long arg); 939extern int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
935extern int drm_agp_enable(struct inode *inode, struct file *filp, 940 unsigned int cmd, unsigned long arg);
936 unsigned int cmd, unsigned long arg); 941extern int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode);
937extern int drm_agp_info(struct inode *inode, struct file *filp, 942extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
938 unsigned int cmd, unsigned long arg); 943 unsigned int cmd, unsigned long arg);
944extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t *info);
945extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
946 unsigned int cmd, unsigned long arg);
939extern int drm_agp_alloc(struct inode *inode, struct file *filp, 947extern int drm_agp_alloc(struct inode *inode, struct file *filp,
940 unsigned int cmd, unsigned long arg); 948 unsigned int cmd, unsigned long arg);
941extern int drm_agp_free(struct inode *inode, struct file *filp, 949extern int drm_agp_free(struct inode *inode, struct file *filp,
diff --git a/drivers/char/drm/drm_agpsupport.c b/drivers/char/drm/drm_agpsupport.c
index 8d94c0b5fa44..10c8b4daec51 100644
--- a/drivers/char/drm/drm_agpsupport.c
+++ b/drivers/char/drm/drm_agpsupport.c
@@ -37,7 +37,7 @@
37#if __OS_HAS_AGP 37#if __OS_HAS_AGP
38 38
39/** 39/**
40 * AGP information ioctl. 40 * Get AGP information.
41 * 41 *
42 * \param inode device inode. 42 * \param inode device inode.
43 * \param filp file pointer. 43 * \param filp file pointer.
@@ -48,51 +48,56 @@
48 * Verifies the AGP device has been initialized and acquired and fills in the 48 * Verifies the AGP device has been initialized and acquired and fills in the
49 * drm_agp_info structure with the information in drm_agp_head::agp_info. 49 * drm_agp_info structure with the information in drm_agp_head::agp_info.
50 */ 50 */
51int drm_agp_info(struct inode *inode, struct file *filp, 51int drm_agp_info(drm_device_t *dev, drm_agp_info_t *info)
52 unsigned int cmd, unsigned long arg)
53{ 52{
54 drm_file_t *priv = filp->private_data;
55 drm_device_t *dev = priv->head->dev;
56 DRM_AGP_KERN *kern; 53 DRM_AGP_KERN *kern;
57 drm_agp_info_t info;
58 54
59 if (!dev->agp || !dev->agp->acquired) 55 if (!dev->agp || !dev->agp->acquired)
60 return -EINVAL; 56 return -EINVAL;
61 57
62 kern = &dev->agp->agp_info; 58 kern = &dev->agp->agp_info;
63 info.agp_version_major = kern->version.major; 59 info->agp_version_major = kern->version.major;
64 info.agp_version_minor = kern->version.minor; 60 info->agp_version_minor = kern->version.minor;
65 info.mode = kern->mode; 61 info->mode = kern->mode;
66 info.aperture_base = kern->aper_base; 62 info->aperture_base = kern->aper_base;
67 info.aperture_size = kern->aper_size * 1024 * 1024; 63 info->aperture_size = kern->aper_size * 1024 * 1024;
68 info.memory_allowed = kern->max_memory << PAGE_SHIFT; 64 info->memory_allowed = kern->max_memory << PAGE_SHIFT;
69 info.memory_used = kern->current_memory << PAGE_SHIFT; 65 info->memory_used = kern->current_memory << PAGE_SHIFT;
70 info.id_vendor = kern->device->vendor; 66 info->id_vendor = kern->device->vendor;
71 info.id_device = kern->device->device; 67 info->id_device = kern->device->device;
72 68
73 if (copy_to_user((drm_agp_info_t __user *)arg, &info, sizeof(info))) 69 return 0;
70}
71EXPORT_SYMBOL(drm_agp_info);
72
73int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
74 unsigned int cmd, unsigned long arg)
75{
76 drm_file_t *priv = filp->private_data;
77 drm_device_t *dev = priv->head->dev;
78 drm_agp_info_t info;
79 int err;
80
81 err = drm_agp_info(dev, &info);
82 if (err)
83 return err;
84
85 if (copy_to_user((drm_agp_info_t __user *) arg, &info, sizeof(info)))
74 return -EFAULT; 86 return -EFAULT;
75 return 0; 87 return 0;
76} 88}
77 89
78/** 90/**
79 * Acquire the AGP device (ioctl). 91 * Acquire the AGP device.
80 * 92 *
81 * \param inode device inode. 93 * \param dev DRM device that is to acquire AGP
82 * \param filp file pointer.
83 * \param cmd command.
84 * \param arg user argument.
85 * \return zero on success or a negative number on failure. 94 * \return zero on success or a negative number on failure.
86 * 95 *
87 * Verifies the AGP device hasn't been acquired before and calls 96 * Verifies the AGP device hasn't been acquired before and calls
88 * agp_acquire(). 97 * \c agp_backend_acquire.
89 */ 98 */
90int drm_agp_acquire(struct inode *inode, struct file *filp, 99int drm_agp_acquire(drm_device_t *dev)
91 unsigned int cmd, unsigned long arg)
92{ 100{
93 drm_file_t *priv = filp->private_data;
94 drm_device_t *dev = priv->head->dev;
95
96 if (!dev->agp) 101 if (!dev->agp)
97 return -ENODEV; 102 return -ENODEV;
98 if (dev->agp->acquired) 103 if (dev->agp->acquired)
@@ -102,9 +107,10 @@ int drm_agp_acquire(struct inode *inode, struct file *filp,
102 dev->agp->acquired = 1; 107 dev->agp->acquired = 1;
103 return 0; 108 return 0;
104} 109}
110EXPORT_SYMBOL(drm_agp_acquire);
105 111
106/** 112/**
107 * Release the AGP device (ioctl). 113 * Acquire the AGP device (ioctl).
108 * 114 *
109 * \param inode device inode. 115 * \param inode device inode.
110 * \param filp file pointer. 116 * \param filp file pointer.
@@ -112,63 +118,80 @@ int drm_agp_acquire(struct inode *inode, struct file *filp,
112 * \param arg user argument. 118 * \param arg user argument.
113 * \return zero on success or a negative number on failure. 119 * \return zero on success or a negative number on failure.
114 * 120 *
115 * Verifies the AGP device has been acquired and calls agp_backend_release(). 121 * Verifies the AGP device hasn't been acquired before and calls
122 * \c agp_backend_acquire.
116 */ 123 */
117int drm_agp_release(struct inode *inode, struct file *filp, 124int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
118 unsigned int cmd, unsigned long arg) 125 unsigned int cmd, unsigned long arg)
119{ 126{
120 drm_file_t *priv = filp->private_data; 127 drm_file_t *priv = filp->private_data;
121 drm_device_t *dev = priv->head->dev; 128
129 return drm_agp_acquire( (drm_device_t *) priv->head->dev );
130}
122 131
132/**
133 * Release the AGP device.
134 *
135 * \param dev DRM device that is to release AGP
136 * \return zero on success or a negative number on failure.
137 *
138 * Verifies the AGP device has been acquired and calls \c agp_backend_release.
139 */
140int drm_agp_release(drm_device_t *dev)
141{
123 if (!dev->agp || !dev->agp->acquired) 142 if (!dev->agp || !dev->agp->acquired)
124 return -EINVAL; 143 return -EINVAL;
125 agp_backend_release(dev->agp->bridge); 144 agp_backend_release(dev->agp->bridge);
126 dev->agp->acquired = 0; 145 dev->agp->acquired = 0;
127 return 0; 146 return 0;
128
129} 147}
148EXPORT_SYMBOL(drm_agp_release);
130 149
131/** 150int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
132 * Release the AGP device. 151 unsigned int cmd, unsigned long arg)
133 *
134 * Calls agp_backend_release().
135 */
136void drm_agp_do_release(drm_device_t *dev)
137{ 152{
138 agp_backend_release(dev->agp->bridge); 153 drm_file_t *priv = filp->private_data;
154 drm_device_t *dev = priv->head->dev;
155
156 return drm_agp_release(dev);
139} 157}
140 158
141/** 159/**
142 * Enable the AGP bus. 160 * Enable the AGP bus.
143 * 161 *
144 * \param inode device inode. 162 * \param dev DRM device that has previously acquired AGP.
145 * \param filp file pointer. 163 * \param mode Requested AGP mode.
146 * \param cmd command.
147 * \param arg pointer to a drm_agp_mode structure.
148 * \return zero on success or a negative number on failure. 164 * \return zero on success or a negative number on failure.
149 * 165 *
150 * Verifies the AGP device has been acquired but not enabled, and calls 166 * Verifies the AGP device has been acquired but not enabled, and calls
151 * agp_enable(). 167 * \c agp_enable.
152 */ 168 */
153int drm_agp_enable(struct inode *inode, struct file *filp, 169int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode)
154 unsigned int cmd, unsigned long arg)
155{ 170{
156 drm_file_t *priv = filp->private_data;
157 drm_device_t *dev = priv->head->dev;
158 drm_agp_mode_t mode;
159
160 if (!dev->agp || !dev->agp->acquired) 171 if (!dev->agp || !dev->agp->acquired)
161 return -EINVAL; 172 return -EINVAL;
162 173
163 if (copy_from_user(&mode, (drm_agp_mode_t __user *)arg, sizeof(mode)))
164 return -EFAULT;
165
166 dev->agp->mode = mode.mode; 174 dev->agp->mode = mode.mode;
167 agp_enable(dev->agp->bridge, mode.mode); 175 agp_enable(dev->agp->bridge, mode.mode);
168 dev->agp->base = dev->agp->agp_info.aper_base; 176 dev->agp->base = dev->agp->agp_info.aper_base;
169 dev->agp->enabled = 1; 177 dev->agp->enabled = 1;
170 return 0; 178 return 0;
171} 179}
180EXPORT_SYMBOL(drm_agp_enable);
181
182int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
183 unsigned int cmd, unsigned long arg)
184{
185 drm_file_t *priv = filp->private_data;
186 drm_device_t *dev = priv->head->dev;
187 drm_agp_mode_t mode;
188
189
190 if (copy_from_user(&mode, (drm_agp_mode_t __user *) arg, sizeof(mode)))
191 return -EFAULT;
192
193 return drm_agp_enable(dev, mode);
194}
172 195
173/** 196/**
174 * Allocate AGP memory. 197 * Allocate AGP memory.
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index be54efbefe84..cd4636f7f187 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -82,26 +82,22 @@ static unsigned int map32_handle = 0x10000000;
82 * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where 82 * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where
83 * applicable and if supported by the kernel. 83 * applicable and if supported by the kernel.
84 */ 84 */
85int drm_addmap( struct inode *inode, struct file *filp, 85int drm_addmap(drm_device_t * dev, unsigned int offset,
86 unsigned int cmd, unsigned long arg ) 86 unsigned int size, drm_map_type_t type,
87 drm_map_flags_t flags, drm_local_map_t ** map_ptr)
87{ 88{
88 drm_file_t *priv = filp->private_data;
89 drm_device_t *dev = priv->head->dev;
90 drm_map_t *map; 89 drm_map_t *map;
91 drm_map_t __user *argp = (void __user *)arg;
92 drm_map_list_t *list; 90 drm_map_list_t *list;
93 drm_dma_handle_t *dmah; 91 drm_dma_handle_t *dmah;
94 92
95 if ( !(filp->f_mode & 3) ) return -EACCES; /* Require read/write */
96
97 map = drm_alloc( sizeof(*map), DRM_MEM_MAPS ); 93 map = drm_alloc( sizeof(*map), DRM_MEM_MAPS );
98 if ( !map ) 94 if ( !map )
99 return -ENOMEM; 95 return -ENOMEM;
100 96
101 if ( copy_from_user( map, argp, sizeof(*map) ) ) { 97 map->offset = offset;
102 drm_free( map, sizeof(*map), DRM_MEM_MAPS ); 98 map->size = size;
103 return -EFAULT; 99 map->flags = flags;
104 } 100 map->type = type;
105 101
106 /* Only allow shared memory to be removable since we only keep enough 102 /* Only allow shared memory to be removable since we only keep enough
107 * book keeping information about shared memory to allow for removal 103 * book keeping information about shared memory to allow for removal
@@ -218,10 +214,42 @@ int drm_addmap( struct inode *inode, struct file *filp,
218#endif 214#endif
219 up(&dev->struct_sem); 215 up(&dev->struct_sem);
220 216
221 if ( copy_to_user( argp, map, sizeof(*map) ) ) 217 *map_ptr = map;
218 return 0;
219}
220EXPORT_SYMBOL(drm_addmap);
221
222int drm_addmap_ioctl(struct inode *inode, struct file *filp,
223 unsigned int cmd, unsigned long arg)
224{
225 drm_file_t *priv = filp->private_data;
226 drm_device_t *dev = priv->head->dev;
227 drm_map_t map;
228 drm_map_t *map_ptr;
229 drm_map_t __user *argp = (void __user *)arg;
230 int err;
231
232 if (!(filp->f_mode & 3))
233 return -EACCES; /* Require read/write */
234
235 if (copy_from_user(& map, argp, sizeof(map))) {
222 return -EFAULT; 236 return -EFAULT;
223 if (copy_to_user(&argp->handle, &map->offset, sizeof(map->offset))) 237 }
238
239 err = drm_addmap( dev, map.offset, map.size, map.type, map.flags,
240 &map_ptr );
241
242 if (err) {
243 return err;
244 }
245
246 if (copy_to_user(argp, map_ptr, sizeof(*map_ptr)))
224 return -EFAULT; 247 return -EFAULT;
248 if (map_ptr->type != _DRM_SHM) {
249 if (copy_to_user(&argp->handle, &map_ptr->offset,
250 sizeof(map_ptr->offset)))
251 return -EFAULT;
252 }
225 return 0; 253 return 0;
226} 254}
227 255
@@ -240,32 +268,23 @@ int drm_addmap( struct inode *inode, struct file *filp,
240 * its being used, and free any associate resource (such as MTRR's) if it's not 268 * its being used, and free any associate resource (such as MTRR's) if it's not
241 * being on use. 269 * being on use.
242 * 270 *
243 * \sa addmap(). 271 * \sa drm_addmap
244 */ 272 */
245int drm_rmmap(struct inode *inode, struct file *filp, 273int drm_rmmap(drm_device_t *dev, void *handle)
246 unsigned int cmd, unsigned long arg)
247{ 274{
248 drm_file_t *priv = filp->private_data;
249 drm_device_t *dev = priv->head->dev;
250 struct list_head *list; 275 struct list_head *list;
251 drm_map_list_t *r_list = NULL; 276 drm_map_list_t *r_list = NULL;
252 drm_vma_entry_t *pt, *prev; 277 drm_vma_entry_t *pt, *prev;
253 drm_map_t *map; 278 drm_map_t *map;
254 drm_map_t request;
255 int found_maps = 0; 279 int found_maps = 0;
256 280
257 if (copy_from_user(&request, (drm_map_t __user *)arg,
258 sizeof(request))) {
259 return -EFAULT;
260 }
261
262 down(&dev->struct_sem); 281 down(&dev->struct_sem);
263 list = &dev->maplist->head; 282 list = &dev->maplist->head;
264 list_for_each(list, &dev->maplist->head) { 283 list_for_each(list, &dev->maplist->head) {
265 r_list = list_entry(list, drm_map_list_t, head); 284 r_list = list_entry(list, drm_map_list_t, head);
266 285
267 if(r_list->map && 286 if(r_list->map &&
268 r_list->map->offset == (unsigned long) request.handle && 287 r_list->map->handle == handle &&
269 r_list->map->flags & _DRM_REMOVABLE) break; 288 r_list->map->flags & _DRM_REMOVABLE) break;
270 } 289 }
271 290
@@ -319,6 +338,21 @@ int drm_rmmap(struct inode *inode, struct file *filp,
319 up(&dev->struct_sem); 338 up(&dev->struct_sem);
320 return 0; 339 return 0;
321} 340}
341EXPORT_SYMBOL(drm_rmmap);
342
343int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
344 unsigned int cmd, unsigned long arg)
345{
346 drm_file_t *priv = filp->private_data;
347 drm_device_t *dev = priv->head->dev;
348 drm_map_t request;
349
350 if (copy_from_user(&request, (drm_map_t __user *)arg, sizeof(request))) {
351 return -EFAULT;
352 }
353
354 return drm_rmmap(dev, request.handle);
355}
322 356
323/** 357/**
324 * Cleanup after an error on one of the addbufs() functions. 358 * Cleanup after an error on one of the addbufs() functions.
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index ab172ea8e98a..9b09b105e1d6 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -70,8 +70,8 @@ static drm_ioctl_desc_t drm_ioctls[] = {
70 [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_noop, 1, 1 }, 70 [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_noop, 1, 1 },
71 [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, 71 [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 },
72 72
73 [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, 73 [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap_ioctl,1, 1 },
74 [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = { drm_rmmap, 1, 0 }, 74 [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = { drm_rmmap_ioctl, 1, 0 },
75 75
76 [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { drm_setsareactx, 1, 1 }, 76 [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { drm_setsareactx, 1, 1 },
77 [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { drm_getsareactx, 1, 0 }, 77 [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { drm_getsareactx, 1, 0 },
@@ -102,10 +102,10 @@ static drm_ioctl_desc_t drm_ioctls[] = {
102 [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { drm_control, 1, 1 }, 102 [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { drm_control, 1, 1 },
103 103
104#if __OS_HAS_AGP 104#if __OS_HAS_AGP
105 [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 }, 105 [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire_ioctl, 1, 1 },
106 [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 }, 106 [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release_ioctl, 1, 1 },
107 [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 }, 107 [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable_ioctl, 1, 1 },
108 [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 }, 108 [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info_ioctl, 1, 0 },
109 [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 }, 109 [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 },
110 [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 }, 110 [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 },
111 [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 }, 111 [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 },
@@ -178,7 +178,8 @@ int drm_takedown( drm_device_t *dev )
178 } 178 }
179 dev->agp->memory = NULL; 179 dev->agp->memory = NULL;
180 180
181 if ( dev->agp->acquired ) drm_agp_do_release(dev); 181 if (dev->agp->acquired)
182 drm_agp_release(dev);
182 183
183 dev->agp->acquired = 0; 184 dev->agp->acquired = 0;
184 dev->agp->enabled = 0; 185 dev->agp->enabled = 0;