drm: rip out dev->ioctl_count tracking
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 11 Dec 2013 10:35:08 +0000 (11:35 +0100)
committerDave Airlie <airlied@redhat.com>
Wed, 18 Dec 2013 01:41:55 +0000 (11:41 +1000)
Now dev->ioctl_count tries to prevent the device from disappearing if
it's still in use. And if we'd actually need this code it would be
hopelessly racy and broken.

But luckily the vfs already takes care of this. So we can just rip it
out.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_drv.c
drivers/gpu/drm/drm_fops.c
include/drm/drmP.h

index d9137e49c4e81594a992297a1dd10181006faf06..9fd4dd476d33a247fea24a466ae366bec80dbbf3 100644 (file)
@@ -315,7 +315,6 @@ long drm_ioctl(struct file *filp,
        if (drm_device_is_unplugged(dev))
                return -ENODEV;
 
-       atomic_inc(&dev->ioctl_count);
        ++file_priv->ioctl_count;
 
        if ((nr >= DRM_CORE_IOCTL_COUNT) &&
@@ -410,7 +409,6 @@ long drm_ioctl(struct file *filp,
 
        if (kdata != stack_kdata)
                kfree(kdata);
-       atomic_dec(&dev->ioctl_count);
        if (retcode)
                DRM_DEBUG("ret = %d\n", retcode);
        return retcode;
index c5b929c3f77ae617d14fa87b387557bbf3cd3f7b..97ebc828de5b41e490f786a4fde9ba7e67f78eb2 100644 (file)
@@ -392,7 +392,6 @@ static void drm_legacy_dev_reinit(struct drm_device *dev)
        if (drm_core_check_feature(dev, DRIVER_MODESET))
                return;
 
-       atomic_set(&dev->ioctl_count, 0);
        atomic_set(&dev->vma_count, 0);
 
        dev->sigdata.lock = NULL;
@@ -578,12 +577,7 @@ int drm_release(struct inode *inode, struct file *filp)
         */
 
        if (!--dev->open_count) {
-               if (atomic_read(&dev->ioctl_count)) {
-                       DRM_ERROR("Device busy: %d\n",
-                                 atomic_read(&dev->ioctl_count));
-                       retcode = -EBUSY;
-               } else
-                       retcode = drm_lastclose(dev);
+               retcode = drm_lastclose(dev);
                if (drm_device_is_unplugged(dev))
                        drm_put_dev(dev);
        }
index c34a2cc2d9b6f79dbfb68262510505633d19a646..0670857b14207dbecdadc328a2edf66fa0ba4acb 100644 (file)
@@ -1110,7 +1110,6 @@ struct drm_device {
        /** \name Usage Counters */
        /*@{ */
        int open_count;                 /**< Outstanding files open */
-       atomic_t ioctl_count;           /**< Outstanding IOCTLs pending */
        atomic_t vma_count;             /**< Outstanding vma areas open */
        int buf_use;                    /**< Buffers in use -- cannot alloc */
        atomic_t buf_alloc;             /**< Buffer allocation in progress */