diff options
Diffstat (limited to 'drivers/gpu/drm/drm_drv.c')
-rw-r--r-- | drivers/gpu/drm/drm_drv.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index ff2f1042cb44..766c46875a20 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -434,11 +434,11 @@ static int drm_version(struct drm_device *dev, void *data, | |||
434 | * Looks up the ioctl function in the ::ioctls table, checking for root | 434 | * Looks up the ioctl function in the ::ioctls table, checking for root |
435 | * previleges if so required, and dispatches to the respective function. | 435 | * previleges if so required, and dispatches to the respective function. |
436 | */ | 436 | */ |
437 | int drm_ioctl(struct inode *inode, struct file *filp, | 437 | long drm_ioctl(struct file *filp, |
438 | unsigned int cmd, unsigned long arg) | 438 | unsigned int cmd, unsigned long arg) |
439 | { | 439 | { |
440 | struct drm_file *file_priv = filp->private_data; | 440 | struct drm_file *file_priv = filp->private_data; |
441 | struct drm_device *dev = file_priv->minor->dev; | 441 | struct drm_device *dev; |
442 | struct drm_ioctl_desc *ioctl; | 442 | struct drm_ioctl_desc *ioctl; |
443 | drm_ioctl_t *func; | 443 | drm_ioctl_t *func; |
444 | unsigned int nr = DRM_IOCTL_NR(cmd); | 444 | unsigned int nr = DRM_IOCTL_NR(cmd); |
@@ -446,6 +446,7 @@ int drm_ioctl(struct inode *inode, struct file *filp, | |||
446 | char stack_kdata[128]; | 446 | char stack_kdata[128]; |
447 | char *kdata = NULL; | 447 | char *kdata = NULL; |
448 | 448 | ||
449 | dev = file_priv->minor->dev; | ||
449 | atomic_inc(&dev->ioctl_count); | 450 | atomic_inc(&dev->ioctl_count); |
450 | atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]); | 451 | atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]); |
451 | ++file_priv->ioctl_count; | 452 | ++file_priv->ioctl_count; |
@@ -501,7 +502,13 @@ int drm_ioctl(struct inode *inode, struct file *filp, | |||
501 | goto err_i1; | 502 | goto err_i1; |
502 | } | 503 | } |
503 | } | 504 | } |
504 | retcode = func(dev, kdata, file_priv); | 505 | if (ioctl->flags & DRM_UNLOCKED) |
506 | retcode = func(dev, kdata, file_priv); | ||
507 | else { | ||
508 | lock_kernel(); | ||
509 | retcode = func(dev, kdata, file_priv); | ||
510 | unlock_kernel(); | ||
511 | } | ||
505 | 512 | ||
506 | if (cmd & IOC_OUT) { | 513 | if (cmd & IOC_OUT) { |
507 | if (copy_to_user((void __user *)arg, kdata, | 514 | if (copy_to_user((void __user *)arg, kdata, |