Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: rip out dev->ioctl_count tracking

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>

authored by

Daniel Vetter and committed by
Dave Airlie
43d1337c b8673b64

+1 -10
-2
drivers/gpu/drm/drm_drv.c
··· 315 315 if (drm_device_is_unplugged(dev)) 316 316 return -ENODEV; 317 317 318 - atomic_inc(&dev->ioctl_count); 319 318 ++file_priv->ioctl_count; 320 319 321 320 if ((nr >= DRM_CORE_IOCTL_COUNT) && ··· 409 410 410 411 if (kdata != stack_kdata) 411 412 kfree(kdata); 412 - atomic_dec(&dev->ioctl_count); 413 413 if (retcode) 414 414 DRM_DEBUG("ret = %d\n", retcode); 415 415 return retcode;
+1 -7
drivers/gpu/drm/drm_fops.c
··· 392 392 if (drm_core_check_feature(dev, DRIVER_MODESET)) 393 393 return; 394 394 395 - atomic_set(&dev->ioctl_count, 0); 396 395 atomic_set(&dev->vma_count, 0); 397 396 398 397 dev->sigdata.lock = NULL; ··· 577 578 */ 578 579 579 580 if (!--dev->open_count) { 580 - if (atomic_read(&dev->ioctl_count)) { 581 - DRM_ERROR("Device busy: %d\n", 582 - atomic_read(&dev->ioctl_count)); 583 - retcode = -EBUSY; 584 - } else 585 - retcode = drm_lastclose(dev); 581 + retcode = drm_lastclose(dev); 586 582 if (drm_device_is_unplugged(dev)) 587 583 drm_put_dev(dev); 588 584 }
-1
include/drm/drmP.h
··· 1110 1110 /** \name Usage Counters */ 1111 1111 /*@{ */ 1112 1112 int open_count; /**< Outstanding files open */ 1113 - atomic_t ioctl_count; /**< Outstanding IOCTLs pending */ 1114 1113 atomic_t vma_count; /**< Outstanding vma areas open */ 1115 1114 int buf_use; /**< Buffers in use -- cannot alloc */ 1116 1115 atomic_t buf_alloc; /**< Buffer allocation in progress */