summaryrefslogtreecommitdiff
path: root/bsd-core/drm_drv.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-07-19 17:00:17 -0700
committerEric Anholt <eric@anholt.net>2007-07-20 12:53:52 -0700
commite39286eb5eab8846a228863abf8f1b8b07a9e29d (patch)
tree7f0f599e514917546e195f2ec19eb869deb141c1 /bsd-core/drm_drv.c
parent5dc9fd96d7bf48003db832f145ad8acb4bcb73b4 (diff)
Remove DRM_ERR OS macro.
This was used to make all ioctl handlers return -errno on linux and errno on *BSD. Instead, just return -errno in shared code, and flip sign on return from shared code to *BSD code.
Diffstat (limited to 'bsd-core/drm_drv.c')
-rw-r--r--bsd-core/drm_drv.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 75866b1b..fa2958b9 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -532,7 +532,8 @@ static int drm_load(drm_device_t *dev)
if (dev->driver.load != NULL) {
DRM_LOCK();
- retcode = dev->driver.load(dev, dev->id_entry->driver_private);
+ retcode = -dev->driver.load(dev,
+ dev->id_entry->driver_private);
DRM_UNLOCK();
if (retcode != 0)
goto error;
@@ -544,7 +545,7 @@ static int drm_load(drm_device_t *dev)
if (dev->driver.require_agp && dev->agp == NULL) {
DRM_ERROR("Card isn't AGP, or couldn't initialize "
"AGP.\n");
- retcode = DRM_ERR(ENOMEM);
+ retcode = ENOMEM;
goto error;
}
if (dev->agp != NULL) {
@@ -660,7 +661,7 @@ int drm_version(DRM_IOCTL_ARGS)
name##_len = strlen( value ); \
if ( len && name ) { \
if ( DRM_COPY_TO_USER( name, value, len ) ) \
- return DRM_ERR(EFAULT); \
+ return EFAULT; \
}
version.version_major = dev->driver.major;
@@ -755,7 +756,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
for (;;) {
if ( !dev->lock.hw_lock ) {
/* Device has been unregistered */
- retcode = DRM_ERR(EINTR);
+ retcode = EINTR;
break;
}
if (drm_lock_take(&dev->lock.hw_lock->lock,
@@ -914,13 +915,18 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
if (is_driver_ioctl)
DRM_LOCK();
retcode = func(kdev, cmd, data, flags, p, filp);
- if (is_driver_ioctl)
+ if (is_driver_ioctl) {
DRM_UNLOCK();
+ /* Driver ioctls in shared code follow the linux convention of
+ * returning -errno instead of errno.
+ */
+ retcode = -retcode;
+ }
if (retcode != 0)
DRM_DEBUG(" returning %d\n", retcode);
- return DRM_ERR(retcode);
+ return retcode;
}
drm_local_map_t *drm_getsarea(drm_device_t *dev)