drm: Push BKL down into drivers
PATCH 1/1 drm: Push BKL down into drivers
This is a fairly simple change but affects all the drivers. The actual lock is pushed down rather than eliminated. Hopefully it will then get pushed down further. More importantly it helps us get rid of the old BKL locked ioctl
Signed-off-by Alan Cox <[email protected]>
drivers/char/drm/drmP.h +1 -1
@@ -888,7 +888,7 @@ static inline int drm_mtrr_del(int handle, unsigned long offset,/* Driver support (drm_drv.h) */ extern int drm_init (struct drm_driver *driver);extern void drm_exit (struct drm_driver *driver); -extern int drm_ioctl (struct inode *inode,struct file *filp, +extern long drm_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);extern long drm_compat_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);
drivers/char/drm/drm_drv.c +4 -3
@@ -435,7 +435,6 @@ static int drm_version(struct drm_device *dev, void *data,/** * Called whenever a process performs an ioctl on /dev/drm. * -* \param inode device inode. * \param file_priv DRM file private. * \param cmd command. * \param arg user argument.
@@ -444,8 +443,7 @@ static int drm_version(struct drm_device *dev, void *data,* Looks up the ioctl function in the ::ioctls table, checking for root * previleges if so required, and dispatches to the respective function. */ -int drm_ioctl (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg) +long drm_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {struct drm_file *file_priv = filp->private_data;struct drm_device *dev = file_priv->minor->dev;
@@ -457,6 +455,8 @@ int drm_ioctl(struct inode *inode, struct file *filp,atomic_inc (&dev->ioctl_count);atomic_inc (&dev->counts[_DRM_STAT_IOCTLS]); + +lock_kernel (); ++file_priv->ioctl_count; DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
@@ -519,6 +519,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,atomic_dec (&dev->ioctl_count);if (retcode)DRM_DEBUG ("ret = %x\n" , retcode); +unlock_kernel ();return retcode; }
drivers/char/drm/i810_dma.c +1 -1
@@ -115,7 +115,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)static const struct file_operations i810_buffer_fops = { .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = i810_mmap_buffers, .fasync = drm_fasync, };
drivers/char/drm/i810_drv.c +1 -1
@@ -59,7 +59,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync,
drivers/char/drm/i830_dma.c +1 -1
@@ -117,7 +117,7 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)static const struct file_operations i830_buffer_fops = { .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = i830_mmap_buffers, .fasync = drm_fasync, };
drivers/char/drm/i830_drv.c +1 -1
@@ -70,7 +70,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync,
drivers/char/drm/i915_drv.c +1 -1
@@ -556,7 +556,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync,
drivers/char/drm/mga_drv.c +1 -1
@@ -68,7 +68,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync,
drivers/char/drm/r128_drv.c +1 -1
@@ -63,7 +63,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync,
drivers/char/drm/radeon_drv.c +1 -1
@@ -85,7 +85,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync,
drivers/char/drm/savage_drv.c +1 -1
@@ -50,7 +50,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync,
drivers/char/drm/sis_drv.c +1 -1
@@ -80,7 +80,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync,
drivers/char/drm/tdfx_drv.c +1 -1
@@ -48,7 +48,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync,
drivers/char/drm/via_drv.c +1 -1
@@ -64,7 +64,7 @@ static struct drm_driver driver = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, - .ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync,