static int agpioc_deallocate_wrap(agp_file_private * priv, unsigned long arg)
{
	agp_memory *memory;

	memory = agp_find_mem_by_key((int) arg);

	if (memory == NULL) {
		return -EINVAL;
	}
	agp_free_memory_wrap(memory);
	return 0;
}
static int agpioc_deallocate_wrap(struct agp_file_private *priv, int arg)
{
	struct agp_memory *memory;

	DBG("");
	memory = agp_find_mem_by_key(arg);

	if (memory == NULL)
		return -EINVAL;

	agp_free_memory_wrap(memory);
	return 0;
}
static void agp_remove_all_memory(struct agp_controller *controller)
{
	struct agp_memory *memory;
	struct agp_memory *temp;

	memory = controller->pool;

	while (memory) {
		temp = memory;
		memory = memory->next;
		agp_free_memory_wrap(temp);
	}
}
static int agpioc_allocate_wrap(agp_file_private * priv, unsigned long arg)
{
	agp_memory *memory;
	agp_allocate alloc;

	if (copy_from_user(&alloc, (void *) arg, sizeof(agp_allocate))) {
		return -EFAULT;
	}
	memory = agp_allocate_memory_wrap(alloc.pg_count, alloc.type);

	if (memory == NULL) {
		return -ENOMEM;
	}
	alloc.key = memory->key;
	alloc.physical = memory->physical;

	if (copy_to_user((void *) arg, &alloc, sizeof(agp_allocate))) {
		agp_free_memory_wrap(memory);
		return -EFAULT;
	}
	return 0;
}
Example #5
0
static int compat_agpioc_allocate_wrap(struct agp_file_private *priv, void __user *arg)
{
	struct agp_memory *memory;
	struct agp_allocate32 alloc;

	DBG("");
	if (copy_from_user(&alloc, arg, sizeof(alloc)))
		return -EFAULT;

	memory = agp_allocate_memory_wrap(alloc.pg_count, alloc.type);

	if (memory == NULL)
		return -ENOMEM;

	alloc.key = memory->key;
	alloc.physical = memory->physical;

	if (copy_to_user(arg, &alloc, sizeof(alloc))) {
		agp_free_memory_wrap(memory);
		return -EFAULT;
	}
	return 0;
}