FreeBSD/sys/dev/drm2/drm_bufs.c
/**
 * Unreserve the buffers in list, previously reserved using drmDMA.
 *
 * \param inode device inode.
 * \param file_priv DRM file private.
 * \param cmd command.
 * \param arg pointer to a drm_buf_free structure.
 * \return zero on success or a negative number on failure.
 *
 * Calls free_buffer() for each used buffer.
 * This function is primarily used for debugging.
 */
Unreserve the buffers in list, previously reserved using drmDMA.
\param inode device inode.
\param file_priv DRM file private.
\param cmd command.
\param arg pointer to a drm_buf_free structure.
\return zero on success or a negative number on failure.

Calls free_buffer() for each used buffer.
This function is primarily used for debugging.
Unreserve the buffers in list previously reserved using drmDMA . \ param inode device inode . \ param file_priv DRM file private . \ param cmd command . \ param arg pointer to a drm_buf_free structure . \ return zero on success or a negative number on failure . Calls free_buffer () for each used buffer . This function is primarily used for debugging .
int drm_freebufs(struct drm_device *dev, void *data,
		 struct drm_file *file_priv)
{
	struct drm_device_dma *dma = dev->dma;
	struct drm_buf_free *request = data;
	int i;
	int idx;
	struct drm_buf *buf;
	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
		return -EINVAL;
	if (!dma)
		return -EINVAL;
	DRM_DEBUG("%d\n", request->count);
	for (i = 0; i < request->count; i++) {
		if (copy_from_user(&idx, &request->list[i], sizeof(idx)))
			return -EFAULT;
		if (idx < 0 || idx >= dma->buf_count) {
			DRM_ERROR("Index %d (of %d max)\n",
				  idx, dma->buf_count - 1);
			return -EINVAL;
		}
		buf = dma->buflist[idx];
		if (buf->file_priv != file_priv) {
			DRM_ERROR("Process %d freeing buffer not owned\n",
				  DRM_CURRENTPID);
			return -EINVAL;
		}
		drm_free_buffer(dev, buf);
	}
	return 0;
}
int drm_freebufs ( struct drm_device * dev , void * data , struct drm_file * file_priv ) { struct drm_device_dma * dma = dev -> dma ; struct drm_buf_free * request = data ; int i ; int idx ; struct drm_buf * buf ; if ( ! drm_core_check_feature ( dev , DRIVER_HAVE_DMA ) ) return - EINVAL ; if ( ! dma ) return - EINVAL ; DRM_DEBUG ( " \n " , request -> count ) ; for ( i = 0 ; i < request -> count ; i ++ ) { if ( copy_from_user ( & idx , & request -> list [ i ] , sizeof ( idx ) ) ) return - EFAULT ; if ( idx < 0 || idx >= dma -> buf_count ) { DRM_ERROR ( " \n " , idx , dma -> buf_count - 1 ) ; return - EINVAL ; } buf = dma -> buflist [ idx ] ; if ( buf -> file_priv != file_priv ) { DRM_ERROR ( " \n " , DRM_CURRENTPID ) ; return - EINVAL ; } drm_free_buffer ( dev , buf ) ; } return 0 ; }
Unreserve the buffers in list, previously reserved using drmDMA.
Unreserve the buffers in list previously reserved using drmDMA .