FreeBSD/sys/dev/drm2/drm_agpsupport.c
/**
 * Free AGP memory (ioctl).
 *
 * \param inode device inode.
 * \param file_priv DRM file private.
 * \param cmd command.
 * \param arg pointer to a drm_agp_buffer structure.
 * \return zero on success or a negative number on failure.
 *
 * Verifies the AGP device is present and has been acquired and looks up the
 * AGP memory entry. If the memory it's currently bound, unbind it via
 * unbind_agp(). Frees it via free_agp() as well as the entry itself
 * and unlinks from the doubly linked list it's inserted in.
 */
Free AGP memory (ioctl).
\param inode device inode.
\param file_priv DRM file private.
\param cmd command.
\param arg pointer to a drm_agp_buffer structure.
\return zero on success or a negative number on failure.

Verifies the AGP device is present and has been acquired and looks up the
AGP memory entry. If the memory it's currently bound, unbind it via
unbind_agp(). Frees it via free_agp() as well as the entry itself
and unlinks from the doubly linked list it's inserted in.
Free AGP memory ( ioctl ) . \ param inode device inode . \ param file_priv DRM file private . \ param cmd command . \ param arg pointer to a drm_agp_buffer structure . \ return zero on success or a negative number on failure . Verifies the AGP device is present and has been acquired and looks up the AGP memory entry . If the memory it ' s currently bound unbind it via unbind_agp () . Frees it via free_agp () as well as the entry itself and unlinks from the doubly linked list it ' s inserted in .
int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
{
	struct drm_agp_mem *entry;
	if (!dev->agp || !dev->agp->acquired)
		return -EINVAL;
	if (!(entry = drm_agp_lookup_entry(dev, request->handle)))
		return -EINVAL;
	if (entry->bound)
		drm_unbind_agp(entry->memory);
	list_del(&entry->head);
	drm_free_agp(entry->memory, entry->pages);
	free(entry, DRM_MEM_AGPLISTS);
	return 0;
}
int drm_agp_free ( struct drm_device * dev , struct drm_agp_buffer * request ) { struct drm_agp_mem * entry ; if ( ! dev -> agp || ! dev -> agp -> acquired ) return - EINVAL ; if ( ! ( entry = drm_agp_lookup_entry ( dev , request -> handle ) ) ) return - EINVAL ; if ( entry -> bound ) drm_unbind_agp ( entry -> memory ) ; list_del ( & entry -> head ) ; drm_free_agp ( entry -> memory , entry -> pages ) ; free ( entry , DRM_MEM_AGPLISTS ) ; return 0 ; }
Free AGP memory (ioctl).
Free AGP memory ( ioctl ) .