-/* $OpenBSD: drm_drv.c,v 1.133 2015/02/10 21:56:09 miod Exp $ */
+/* $OpenBSD: drm_drv.c,v 1.134 2015/04/15 09:48:18 kettenis Exp $ */
/*-
* Copyright 2007-2009 Owain G. Ainsworth <oga@openbsd.org>
* Copyright © 2008 Intel Corporation
*(int *)data = dev->buf_pgid;
return 0;
case DRM_IOCTL_VERSION:
- return (drm_version(dev, data, file_priv));
+ return -drm_version(dev, data, file_priv);
case DRM_IOCTL_GET_UNIQUE:
- return (drm_getunique(dev, data, file_priv));
+ return -drm_getunique(dev, data, file_priv);
case DRM_IOCTL_GET_MAGIC:
- return (drm_getmagic(dev, data, file_priv));
+ return -drm_getmagic(dev, data, file_priv);
case DRM_IOCTL_WAIT_VBLANK:
- return (drm_wait_vblank(dev, data, file_priv));
+ return -drm_wait_vblank(dev, data, file_priv);
case DRM_IOCTL_MODESET_CTL:
- return (drm_modeset_ctl(dev, data, file_priv));
+ return -drm_modeset_ctl(dev, data, file_priv);
case DRM_IOCTL_GEM_CLOSE:
return -drm_gem_close_ioctl(dev, data, file_priv);
if (file_priv->authenticated == 1) {
switch (cmd) {
case DRM_IOCTL_GEM_FLINK:
- return (drm_gem_flink_ioctl(dev, data, file_priv));
+ return -drm_gem_flink_ioctl(dev, data, file_priv);
case DRM_IOCTL_GEM_OPEN:
return -drm_gem_open_ioctl(dev, data, file_priv);
case DRM_IOCTL_GET_CAP:
- return (drm_getcap(dev, data, file_priv));
+ return -drm_getcap(dev, data, file_priv);
}
}
if (file_priv->master == 1) {
switch(cmd) {
case DRM_IOCTL_SET_VERSION:
- return (drm_setversion(dev, data, file_priv));
+ return -drm_setversion(dev, data, file_priv);
case DRM_IOCTL_IRQ_BUSID:
- return (drm_irq_by_busid(dev, data, file_priv));
+ return -drm_irq_by_busid(dev, data, file_priv);
case DRM_IOCTL_AUTH_MAGIC:
- return (drm_authmagic(dev, data, file_priv));
+ return -drm_authmagic(dev, data, file_priv);
case DRM_IOCTL_CONTROL:
- return (drm_control(dev, data, file_priv));
+ return -drm_control(dev, data, file_priv);
case DRM_IOCTL_ADD_DRAW:
case DRM_IOCTL_RM_DRAW:
case DRM_IOCTL_UPDATE_DRAW:
mtx_leave(&dev->quiesce_mtx);
error = drm_do_ioctl(dev, minor(kdev), cmd, data);
+ if (error < 0 && error != ERESTART && error != EJUSTRETURN)
+ printf("%s: cmd 0x%lx errno %d\n", __func__, cmd, error);
mtx_enter(&dev->quiesce_mtx);
dev->quiesce_count--;
if (u->unique_len >= dev->unique_len) {
if (DRM_COPY_TO_USER(u->unique, dev->unique, dev->unique_len))
- return EFAULT;
+ return -EFAULT;
}
u->unique_len = dev->unique_len;
req->value = drm_timestamp_monotonic;
break;
default:
- return EINVAL;
+ return -EINVAL;
}
return 0;
}
name##_len = strlen( value ); \
if ( len && name ) { \
if ( DRM_COPY_TO_USER( name, value, len ) ) \
- return EFAULT; \
+ return -EFAULT; \
}
version->version_major = dev->driver->major;
if (ver.drm_di_major != -1) {
if (ver.drm_di_major != DRM_IF_MAJOR || ver.drm_di_minor < 1 ||
ver.drm_di_minor > DRM_IF_MINOR) {
- return EINVAL;
+ return -EINVAL;
}
if_version = DRM_IF_VERSION(ver.drm_di_major, ver.drm_dd_minor);
dev->if_version = imax(if_version, dev->if_version);
if (ver.drm_dd_major != dev->driver->major ||
ver.drm_dd_minor < 0 ||
ver.drm_dd_minor > dev->driver->minor)
- return EINVAL;
+ return -EINVAL;
}
return 0;
}
DRM_DEBUG("%u\n", auth->magic);
- return (0);
+ return 0;
}
/**
{
struct drm_file *p;
struct drm_auth *auth = data;
- int ret = EINVAL;
+ int ret = -EINVAL;
DRM_DEBUG("%u\n", auth->magic);
if (auth->magic == 0)
- return (ret);
+ return ret;
mutex_lock(&dev->struct_mutex);
SPLAY_FOREACH(p, drm_file_tree, &dev->files) {
}
mutex_unlock(&dev->struct_mutex);
- return (ret);
+ return ret;
}
struct uvm_pagerops drm_pgops = {
struct drm_gem_object *obj;
if (!(dev->driver->flags & DRIVER_GEM))
- return (ENODEV);
+ return -ENODEV;
obj = drm_gem_object_lookup(dev, file_priv, args->handle);
if (obj == NULL)
- return (ENOENT);
+ return -ENOENT;
mtx_enter(&dev->obj_name_lock);
if (!obj->name) {
drm_unref(&obj->uobj);
- return (0);
+ return 0;
}
/**
-/* $OpenBSD: drm_irq.c,v 1.62 2015/04/12 03:54:10 jsg Exp $ */
+/* $OpenBSD: drm_irq.c,v 1.63 2015/04/15 09:48:19 kettenis Exp $ */
/**
* \file drm_irq.c
* IRQ support
int ret;
if (dev->irq == 0 || dev->dev_private == NULL)
- return (EINVAL);
+ return -EINVAL;
DRM_DEBUG("irq=%d\n", dev->irq);
mutex_lock(&dev->struct_mutex);
if (dev->irq_enabled) {
mutex_unlock(&dev->struct_mutex);
- return (EBUSY);
+ return -EBUSY;
}
dev->irq_enabled = 1;
mutex_unlock(&dev->struct_mutex);
dev->driver->irq_postinstall(dev);
}
- return (0);
+ return 0;
err:
mutex_lock(&dev->struct_mutex);
dev->irq_enabled = 0;
mutex_unlock(&dev->struct_mutex);
- return (ret);
+ return ret;
}
EXPORT_SYMBOL(drm_irq_install);
mutex_lock(&dev->struct_mutex);
if (!dev->irq_enabled) {
mutex_unlock(&dev->struct_mutex);
- return (EINVAL);
+ return -EINVAL;
}
dev->irq_enabled = 0;
dev->driver->irq_uninstall(dev);
- return (0);
+ return 0;
}
EXPORT_SYMBOL(drm_irq_uninstall);
/* Handle drivers who used to require IRQ setup no longer does. */
if (!(dev->driver->flags & DRIVER_IRQ))
- return (0);
+ return 0;
switch (ctl->func) {
case DRM_INST_HANDLER:
return 0;
if (dev->if_version < DRM_IF_VERSION(1, 2) &&
ctl->irq != dev->irq)
- return (EINVAL);
- return (drm_irq_install(dev));
+ return -EINVAL;
+ return drm_irq_install(dev);
case DRM_UNINST_HANDLER:
if (drm_core_check_feature(dev, DRIVER_MODESET))
return 0;
- return (drm_irq_uninstall(dev));
+ return drm_irq_uninstall(dev);
default:
- return (EINVAL);
+ return -EINVAL;
}
}