aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_drv.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2005-11-10 06:16:34 -0500
committerDave Airlie <airlied@linux.ie>2005-11-10 06:16:34 -0500
commit22eae947bf76e236ba972f2f11cfd1b083b736ad (patch)
treee18a2cdfef9ac0f606eb249df4924fef5e7daebd /drivers/char/drm/drm_drv.c
parent3b44f137b9a846c5452d9e6e1271b79b1dbcc942 (diff)
drm: rename driver hooks more understandably
Rename the driver hooks in the DRM to something a little more understandable: preinit -> load postinit -> (removed) presetup -> firstopen postsetup -> (removed) open_helper -> open prerelease -> preclose free_filp_priv -> postclose pretakedown -> lastclose postcleanup -> unload release -> reclaim_buffers_locked version -> (removed) postinit and version were replaced with generic code in the Linux DRM (drivers now set their version numbers and description in the driver structure, like on BSD). postsetup wasn't used at all. Fixes the savage hooks for initializing and tearing down mappings at the right times. Testing involved at least starting X, running glxgears, killing glxgears, exiting X, and repeating. Tested on: FreeBSD (g200, g400, r200, r128) Linux (r200, savage4) From: Eric Anholt <anholt@freebsd.org> Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_drv.c')
-rw-r--r--drivers/char/drm/drm_drv.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index 4dff7554eb08..d8ff84bdc3e7 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -129,7 +129,7 @@ static drm_ioctl_desc_t drm_ioctls[] = {
129 * 129 *
130 * \sa drm_device 130 * \sa drm_device
131 */ 131 */
132int drm_takedown(drm_device_t * dev) 132int drm_lastclose(drm_device_t * dev)
133{ 133{
134 drm_magic_entry_t *pt, *next; 134 drm_magic_entry_t *pt, *next;
135 drm_map_list_t *r_list; 135 drm_map_list_t *r_list;
@@ -138,9 +138,9 @@ int drm_takedown(drm_device_t * dev)
138 138
139 DRM_DEBUG("\n"); 139 DRM_DEBUG("\n");
140 140
141 if (dev->driver->pretakedown) 141 if (dev->driver->lastclose)
142 dev->driver->pretakedown(dev); 142 dev->driver->lastclose(dev);
143 DRM_DEBUG("driver pretakedown completed\n"); 143 DRM_DEBUG("driver lastclose completed\n");
144 144
145 if (dev->unique) { 145 if (dev->unique) {
146 drm_free(dev->unique, strlen(dev->unique) + 1, DRM_MEM_DRIVER); 146 drm_free(dev->unique, strlen(dev->unique) + 1, DRM_MEM_DRIVER);
@@ -233,7 +233,7 @@ int drm_takedown(drm_device_t * dev)
233 } 233 }
234 up(&dev->struct_sem); 234 up(&dev->struct_sem);
235 235
236 DRM_DEBUG("takedown completed\n"); 236 DRM_DEBUG("lastclose completed\n");
237 return 0; 237 return 0;
238} 238}
239 239
@@ -281,7 +281,7 @@ EXPORT_SYMBOL(drm_init);
281/** 281/**
282 * Called via cleanup_module() at module unload time. 282 * Called via cleanup_module() at module unload time.
283 * 283 *
284 * Cleans up all DRM device, calling takedown(). 284 * Cleans up all DRM device, calling drm_lastclose().
285 * 285 *
286 * \sa drm_init 286 * \sa drm_init
287 */ 287 */
@@ -294,7 +294,7 @@ static void drm_cleanup(drm_device_t * dev)
294 return; 294 return;
295 } 295 }
296 296
297 drm_takedown(dev); 297 drm_lastclose(dev);
298 298
299 if (dev->maplist) { 299 if (dev->maplist) {
300 drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS); 300 drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
@@ -317,8 +317,8 @@ static void drm_cleanup(drm_device_t * dev)
317 dev->agp = NULL; 317 dev->agp = NULL;
318 } 318 }
319 319
320 if (dev->driver->postcleanup) 320 if (dev->driver->unload)
321 dev->driver->postcleanup(dev); 321 dev->driver->unload(dev);
322 322
323 drm_put_head(&dev->primary); 323 drm_put_head(&dev->primary);
324 if (drm_put_dev(dev)) 324 if (drm_put_dev(dev))
@@ -432,14 +432,17 @@ static int drm_version(struct inode *inode, struct file *filp,
432 drm_device_t *dev = priv->head->dev; 432 drm_device_t *dev = priv->head->dev;
433 drm_version_t __user *argp = (void __user *)arg; 433 drm_version_t __user *argp = (void __user *)arg;
434 drm_version_t version; 434 drm_version_t version;
435 int ret; 435 int len;
436 436
437 if (copy_from_user(&version, argp, sizeof(version))) 437 if (copy_from_user(&version, argp, sizeof(version)))
438 return -EFAULT; 438 return -EFAULT;
439 439
440 /* version is a required function to return the personality module version */ 440 version.version_major = dev->driver->major;
441 if ((ret = dev->driver->version(&version))) 441 version.version_minor = dev->driver->minor;
442 return ret; 442 version.version_patchlevel = dev->driver->patchlevel;
443 DRM_COPY(version.name, dev->driver->name);
444 DRM_COPY(version.date, dev->driver->date);
445 DRM_COPY(version.desc, dev->driver->desc);
443 446
444 if (copy_to_user(argp, &version, sizeof(version))) 447 if (copy_to_user(argp, &version, sizeof(version)))
445 return -EFAULT; 448 return -EFAULT;