Round 2 of getting rid of inter_module_get()

This commit is contained in:
Jon Smirl 2004-10-23 18:12:34 +00:00
parent 43cbf43a5f
commit b37efdadca
4 changed files with 33 additions and 57 deletions

View file

@ -884,7 +884,6 @@ extern int drm_vblank_wait(drm_device_t * dev, unsigned int *vbl_seq);
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 int drm_agp_acquire(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);

View file

@ -36,11 +36,6 @@
#if __OS_HAS_AGP
/**
* Pointer to the drm_agp_t structure made available by the agpgart module.
*/
const drm_agp_t *drm_agp = NULL;
/**
* AGP information ioctl.
*
@ -61,7 +56,7 @@ int drm_agp_info(struct inode *inode, struct file *filp,
DRM_AGP_KERN *kern;
drm_agp_info_t info;
if (!dev->agp || !dev->agp->acquired || !drm_agp->copy_info)
if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
kern = &dev->agp->agp_info;
@ -90,7 +85,7 @@ int drm_agp_info(struct inode *inode, struct file *filp,
* \return zero on success or a negative number on failure.
*
* Verifies the AGP device hasn't been acquired before and calls
* drm_agp->acquire().
* agp_backend_acquire().
*/
int drm_agp_acquire(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
@ -103,13 +98,11 @@ int drm_agp_acquire(struct inode *inode, struct file *filp,
return -ENODEV;
if (dev->agp->acquired)
return -EBUSY;
if (!drm_agp->acquire)
return -EINVAL;
#ifndef VMAP_4_ARGS
if (dev->agp->cant_use_aperture)
return -EINVAL;
#endif
if ((retcode = drm_agp->acquire()))
if ((retcode = agp_backend_acquire()))
return retcode;
dev->agp->acquired = 1;
return 0;
@ -124,7 +117,7 @@ int drm_agp_acquire(struct inode *inode, struct file *filp,
* \param arg user argument.
* \return zero on success or a negative number on failure.
*
* Verifies the AGP device has been acquired and calls drm_agp->release().
* Verifies the AGP device has been acquired and calls agp_backend_release().
*/
int drm_agp_release(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
@ -132,9 +125,9 @@ int drm_agp_release(struct inode *inode, struct file *filp,
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev;
if (!dev->agp || !dev->agp->acquired || !drm_agp->release)
if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
drm_agp->release();
agp_backend_release();
dev->agp->acquired = 0;
return 0;
@ -143,12 +136,11 @@ int drm_agp_release(struct inode *inode, struct file *filp,
/**
* Release the AGP device.
*
* Calls drm_agp->release().
* Calls agp_backend_release().
*/
void drm_agp_do_release(void)
{
if (drm_agp->release)
drm_agp->release();
agp_backend_release();
}
/**
@ -161,7 +153,7 @@ void drm_agp_do_release(void)
* \return zero on success or a negative number on failure.
*
* Verifies the AGP device has been acquired but not enabled, and calls
* drm_agp->enable().
* agp_enable().
*/
int drm_agp_enable(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
@ -170,14 +162,14 @@ int drm_agp_enable(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->head->dev;
drm_agp_mode_t mode;
if (!dev->agp || !dev->agp->acquired || !drm_agp->enable)
if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
if (copy_from_user(&mode, (drm_agp_mode_t __user *) arg, sizeof(mode)))
return -EFAULT;
dev->agp->mode = mode.mode;
drm_agp->enable(mode.mode);
agp_enable(mode.mode);
dev->agp->base = dev->agp->agp_info.aper_base;
dev->agp->enabled = 1;
return 0;
@ -327,7 +319,7 @@ int drm_agp_bind(struct inode *inode, struct file *filp,
int retcode;
int page;
if (!dev->agp || !dev->agp->acquired || !drm_agp->bind_memory)
if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
if (copy_from_user
(&request, (drm_agp_binding_t __user *) arg, sizeof(request)))
@ -403,58 +395,49 @@ drm_agp_head_t *drm_agp_init(void)
{
drm_agp_head_t *head = NULL;
if (drm_agp) {
if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
return NULL;
memset((void *)head, 0, sizeof(*head));
drm_agp->copy_info(&head->agp_info);
if (head->agp_info.chipset == NOT_SUPPORTED) {
drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
return NULL;
}
head->memory = NULL;
#if LINUX_VERSION_CODE <= 0x020408
head->cant_use_aperture = 0;
head->page_mask = ~(0xfff);
#else
head->cant_use_aperture = head->agp_info.cant_use_aperture;
head->page_mask = head->agp_info.page_mask;
#endif
if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
return NULL;
memset((void *)head, 0, sizeof(*head));
agp_copy_info(&head->agp_info);
if (head->agp_info.chipset == NOT_SUPPORTED) {
drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
return NULL;
}
head->memory = NULL;
head->cant_use_aperture = head->agp_info.cant_use_aperture;
head->page_mask = head->agp_info.page_mask;
return head;
}
/** Calls drm_agp->allocate_memory() */
/** Calls agp_allocate_memory() */
DRM_AGP_MEM *drm_agp_allocate_memory(size_t pages, u32 type)
{
if (!drm_agp->allocate_memory)
return NULL;
return drm_agp->allocate_memory(pages, type);
return agp_allocate_memory(pages, type);
}
/** Calls drm_agp->free_memory() */
/** Calls agp_free_memory() */
int drm_agp_free_memory(DRM_AGP_MEM * handle)
{
if (!handle || !drm_agp->free_memory)
if (!handle)
return 0;
drm_agp->free_memory(handle);
agp_free_memory(handle);
return 1;
}
/** Calls drm_agp->bind_memory() */
/** Calls agp_bind_memory() */
int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start)
{
if (!handle || !drm_agp->bind_memory)
if (!handle)
return -EINVAL;
return drm_agp->bind_memory(handle, start);
return agp_bind_memory(handle, start);
}
/** Calls drm_agp->unbind_memory() */
/** Calls agp_unbind_memory() */
int drm_agp_unbind_memory(DRM_AGP_MEM * handle)
{
if (!handle || !drm_agp->unbind_memory)
if (!handle)
return -EINVAL;
return drm_agp->unbind_memory(handle);
return agp_unbind_memory(handle);
}
#endif /* __OS_HAS_AGP */

View file

@ -191,8 +191,6 @@ static inline int remap_pfn_range(struct vm_area_struct *vma, unsigned long from
}
#endif
extern const drm_agp_t drm_agp_entry;
/* old architectures */
#ifdef __AMD64__
#define __x86_64__

View file

@ -489,7 +489,6 @@ static int __init drm_core_init(void)
ret = -1;
goto err_p3;
}
drm_agp = (drm_agp_t *) inter_module_get("drm_agp");
DRM_INFO("Initialized %s %d.%d.%d %s\n",
DRIVER_NAME,
@ -506,9 +505,6 @@ 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);