Blob Blame History Raw
From 2d171121773e441272e242af7f268f7ea71d93d1 Mon Sep 17 00:00:00 2001
From: Jani Nikula <jani.nikula@intel.com>
Date: Tue, 11 Feb 2020 16:47:53 +0200
Subject: drm/irq: remove check on dev->dev_private
Git-commit: e62bf83aa1bb9d9953eec2e3663528c766b148ea
Patch-mainline: v5.7-rc1
References: jsc#SLE-12680, jsc#SLE-12880, jsc#SLE-12882, jsc#SLE-12883, jsc#SLE-13496, jsc#SLE-15322

There is no real reason to require drivers to set and use
dev->dev_private. Indeed, the current recommendation, as documented in
drm_device.h, is to embed struct drm_device in the per-device struct
instead of using dev_private.

Remove the requirement for dev_private to have been set to indicate
driver initialization.

For background, quoting Daniel Vetter:

Now there might be some hilarious races this papers over, but:

- Proper drivers should only call drm_dev_register once everything is
  set up, including this stuff here. No race possible with anything else
  really.

- Slightly more wobbly drivers, including the legacy ones, all use
  drm_global_mutex. This was the former BKL, which means that it was
  impossible for soeone to go through the load/unload/reload (between
  lastclose and firstopen) paths and also run the ioctl. But the ioctl
  had to be made unlocked because blocking there killed X:

	 commit 8f4ff2b06afcd6f151868474a432c603057eaf56
	 Author: Ilija Hadzic <ihadzic@research.bell-labs.com>
	 Date:   Mon Oct 31 17:46:18 2011 -0400

	     drm: do not sleep on vblank while holding a mutex

  The even more legacy DRM_CONTROL ioctl stayed fully locked. But the
  file open/close paths are still fully locked, and that's the only
  place legacy drivers should call drm_irq_install/uninstall, so should
  all still be fully ordered and protected and happy.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200211144753.3175-1-jani.nikula@intel.com
Signed-off-by: Patrik Jakobsson <pjakobsson@suse.de>
---
 drivers/gpu/drm/drm_irq.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 03bce566a8c3..588be45abd7a 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -111,10 +111,6 @@ int drm_irq_install(struct drm_device *dev, int irq)
 	if (irq == 0)
 		return -EINVAL;
 
-	/* Driver must have been initialized */
-	if (!dev->dev_private)
-		return -EINVAL;
-
 	if (dev->irq_enabled)
 		return -EBUSY;
 	dev->irq_enabled = true;
-- 
2.28.0