Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43d1337c authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie
Browse files

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: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent b8673b64
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -315,7 +315,6 @@ long drm_ioctl(struct file *filp,
	if (drm_device_is_unplugged(dev))
	if (drm_device_is_unplugged(dev))
		return -ENODEV;
		return -ENODEV;


	atomic_inc(&dev->ioctl_count);
	++file_priv->ioctl_count;
	++file_priv->ioctl_count;


	if ((nr >= DRM_CORE_IOCTL_COUNT) &&
	if ((nr >= DRM_CORE_IOCTL_COUNT) &&
@@ -410,7 +409,6 @@ long drm_ioctl(struct file *filp,


	if (kdata != stack_kdata)
	if (kdata != stack_kdata)
		kfree(kdata);
		kfree(kdata);
	atomic_dec(&dev->ioctl_count);
	if (retcode)
	if (retcode)
		DRM_DEBUG("ret = %d\n", retcode);
		DRM_DEBUG("ret = %d\n", retcode);
	return retcode;
	return retcode;
+1 −7
Original line number Original line Diff line number Diff line
@@ -392,7 +392,6 @@ static void drm_legacy_dev_reinit(struct drm_device *dev)
	if (drm_core_check_feature(dev, DRIVER_MODESET))
	if (drm_core_check_feature(dev, DRIVER_MODESET))
		return;
		return;


	atomic_set(&dev->ioctl_count, 0);
	atomic_set(&dev->vma_count, 0);
	atomic_set(&dev->vma_count, 0);


	dev->sigdata.lock = NULL;
	dev->sigdata.lock = NULL;
@@ -578,11 +577,6 @@ int drm_release(struct inode *inode, struct file *filp)
	 */
	 */


	if (!--dev->open_count) {
	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))
		if (drm_device_is_unplugged(dev))
			drm_put_dev(dev);
			drm_put_dev(dev);
+0 −1
Original line number Original line Diff line number Diff line
@@ -1110,7 +1110,6 @@ struct drm_device {
	/** \name Usage Counters */
	/** \name Usage Counters */
	/*@{ */
	/*@{ */
	int open_count;			/**< Outstanding files open */
	int open_count;			/**< Outstanding files open */
	atomic_t ioctl_count;		/**< Outstanding IOCTLs pending */
	atomic_t vma_count;		/**< Outstanding vma areas open */
	atomic_t vma_count;		/**< Outstanding vma areas open */
	int buf_use;			/**< Buffers in use -- cannot alloc */
	int buf_use;			/**< Buffers in use -- cannot alloc */
	atomic_t buf_alloc;		/**< Buffer allocation in progress */
	atomic_t buf_alloc;		/**< Buffer allocation in progress */