From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: [PATCH 47/50] drm: rip out dev->ioctl_count tracking Date: Wed, 11 Dec 2013 11:35:08 +0100 Message-ID: <1386758111-3446-48-git-send-email-daniel.vetter@ffwll.ch> References: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ea0-f170.google.com (mail-ea0-f170.google.com [209.85.215.170]) by gabe.freedesktop.org (Postfix) with ESMTP id 79918105796 for ; Wed, 11 Dec 2013 02:35:32 -0800 (PST) Received: by mail-ea0-f170.google.com with SMTP id k10so2780683eaj.15 for ; Wed, 11 Dec 2013 02:35:31 -0800 (PST) In-Reply-To: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org To: DRI Development Cc: Daniel Vetter List-Id: dri-devel@lists.freedesktop.org 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 --- drivers/gpu/drm/drm_drv.c | 2 -- drivers/gpu/drm/drm_fops.c | 8 +------- include/drm/drmP.h | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index d9137e49c4e8..9fd4dd476d33 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -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; diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index c5b929c3f77a..97ebc828de5b 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -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); } diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 610eb5c221c4..2644ba1564eb 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1073,7 +1073,6 @@ struct drm_device { /** \name Usage Counters */ /*@{ */ int open_count; /**< Outstanding files open, protected by drm_global_lock. */ - atomic_t ioctl_count; /**< Outstanding IOCTLs pending */ atomic_t vma_count; /**< Outstanding vma areas open */ spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */ int buf_use; /**< Buffers in use -- cannot alloc */ -- 1.8.4.3