summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drmP.h9
-rw-r--r--linux-core/drm_agpsupport.c19
-rw-r--r--linux-core/drm_drv.c6
3 files changed, 11 insertions, 23 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 3bd11aaa..b1b23b58 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -246,9 +246,10 @@
#define LOCK_TEST_WITH_RETURN( dev, filp ) \
do { \
if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
- dev->lock.filp != filp ) { \
- DRM_ERROR( "%s called without lock held\n", \
- __FUNCTION__ ); \
+ dev->lock.filp != filp ) { \
+ DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\
+ __FUNCTION__, _DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ),\
+ dev->lock.filp, filp ); \
return -EINVAL; \
} \
} while (0)
@@ -907,8 +908,8 @@ extern void drm_vbl_send_signals( drm_device_t *dev );
/* AGP/GART support (drm_agpsupport.h) */
+extern const drm_agp_t *drm_agp;
extern drm_agp_head_t *drm_agp_init(void);
-extern void drm_agp_uninit(void);
extern int drm_agp_acquire(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern void drm_agp_do_release(void);
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index 8165c835..bdb57a97 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -36,13 +36,10 @@
#if __OS_HAS_AGP
-#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp")
-#define DRM_AGP_PUT inter_module_put("drm_agp")
-
/**
* Pointer to the drm_agp_t structure made available by the agpgart module.
*/
-static const drm_agp_t *drm_agp = NULL;
+const drm_agp_t *drm_agp = NULL;
/**
* AGP information ioctl.
@@ -401,9 +398,8 @@ int drm_agp_free(struct inode *inode, struct file *filp,
*/
drm_agp_head_t *drm_agp_init(void)
{
- drm_agp_head_t *head = NULL;
+ drm_agp_head_t *head = NULL;
- drm_agp = DRM_AGP_GET;
if (drm_agp) {
if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
return NULL;
@@ -425,17 +421,6 @@ drm_agp_head_t *drm_agp_init(void)
return head;
}
-/**
- * Free the AGP resources.
- *
- * Releases the pointer in ::drm_agp.
- */
-void drm_agp_uninit(void)
-{
- DRM_AGP_PUT;
- drm_agp = NULL;
-}
-
/** Calls drm_agp->allocate_memory() */
DRM_AGP_MEM *drm_agp_allocate_memory(size_t pages, u32 type)
{
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 425320b1..669b1a25 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -608,7 +608,6 @@ static void __exit drm_cleanup( drm_device_t *dev )
}
if (drm_core_has_AGP(dev) && dev->agp ) {
- drm_agp_uninit();
drm_free( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS );
dev->agp = NULL;
}
@@ -670,7 +669,7 @@ static int __init drm_core_init(void)
ret = -1;
goto err_p3;
}
- DRM_DEBUG("calling inter_module_register\n");
+ drm_agp = (drm_agp_t *)inter_module_get("drm_agp");
DRM_INFO( "Initialized %s %d.%d.%d %s\n",
DRIVER_NAME,
@@ -691,6 +690,9 @@ err_p1:
static void __exit drm_core_exit (void)
{
+ if (drm_agp)
+ inter_module_put("drm_agp");
+
remove_proc_entry("dri", NULL);
drm_sysfs_destroy(drm_class);