/* Creates a new mm object and returns a handle to it.  */
int i915_gem_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv)
/* Creates a new mm object and returns a handle to it.  */
int i915_gem_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
	struct drm_i915_gem_create *args = data;
	struct drm_gem_object *obj;
	int ret;
	u32 handle;
	args->size = roundup(args->size, PAGE_SIZE);
	obj = drm_gem_object_alloc(dev, args->size);
	if (obj == NULL)
		return -ENOMEM;
	ret = drm_gem_handle_create(file_priv, obj, &handle);
	mutex_lock(&dev->struct_mutex);
	drm_gem_object_handle_unreference(obj);
	mutex_unlock(&dev->struct_mutex);
	if (ret)
		return ret;
	args->handle = handle;
	return 0;
}