aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-03-18 17:52:17 -0400
committerDave Airlie <airlied@linux.ie>2007-03-18 17:52:17 -0400
commit99da6d861c659bb1a961b70f50fad268b9ed5a5f (patch)
treeaaa921d73006211ccfce0d9ae1bea55d8cb5e214 /drivers
parent6244270ef62203e057191bf85489e2ff91cc0e60 (diff)
drm: allow for more generic drm ioctls
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/drm/drm.h4
-rw-r--r--drivers/char/drm/drm_drv.c9
2 files changed, 9 insertions, 4 deletions
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 8db9041e306c..089198491f16 100644
--- a/drivers/char/drm/drm.h
+++ b/drivers/char/drm/drm.h
@@ -654,11 +654,13 @@ typedef struct drm_set_version {
654 654
655/** 655/**
656 * Device specific ioctls should only be in their respective headers 656 * Device specific ioctls should only be in their respective headers
657 * The device specific ioctl range is from 0x40 to 0x79. 657 * The device specific ioctl range is from 0x40 to 0x99.
658 * Generic IOCTLS restart at 0xA0.
658 * 659 *
659 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and 660 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
660 * drmCommandReadWrite(). 661 * drmCommandReadWrite().
661 */ 662 */
662#define DRM_COMMAND_BASE 0x40 663#define DRM_COMMAND_BASE 0x40
664#define DRM_COMMAND_END 0xA0
663 665
664#endif 666#endif
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index f5b9b2480c14..26bec30ee86e 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -496,11 +496,14 @@ int drm_ioctl(struct inode *inode, struct file *filp,
496 (long)old_encode_dev(priv->head->device), 496 (long)old_encode_dev(priv->head->device),
497 priv->authenticated); 497 priv->authenticated);
498 498
499 if (nr < DRIVER_IOCTL_COUNT) 499 if ((nr >= DRIVER_IOCTL_COUNT) &&
500 ioctl = &drm_ioctls[nr]; 500 ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
501 else if ((nr >= DRM_COMMAND_BASE) 501 goto err_i1;
502 if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END)
502 && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls)) 503 && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls))
503 ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE]; 504 ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE];
505 else if ((nr >= DRM_COMMAND_END) || (nr < DRM_COMMAND_BASE))
506 ioctl = &drm_ioctls[nr];
504 else 507 else
505 goto err_i1; 508 goto err_i1;
506 509