dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH 03/25] drm/imx: kill firstopen callback
Date: Thu,  8 Aug 2013 15:41:13 +0200	[thread overview]
Message-ID: <1375969295-18929-4-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1375969295-18929-1-git-send-email-daniel.vetter@ffwll.ch>

This thing seems to do some kind of delayed setup. Really, real kms
drivers shouldn't do that at all. Either stuff needs to be dynamically
hotplugged or the driver setup sequence needs to be fixed.

This patch here just moves the setup at the very end of the driver
load callback, with the locking adjusted accordingly.

v2: Also move the corresponding put from ->lastclose to ->unload.

Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---

Note that this is already in the staging tree but due to the follow-up cleanup
it's probably best to merge it again through drm-next.
-Daniel

 drivers/staging/imx-drm/imx-drm-core.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c
index a890049..2c58533 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -69,28 +69,20 @@ struct imx_drm_connector {
 	struct module				*owner;
 };
 
-static int imx_drm_driver_firstopen(struct drm_device *drm)
-{
-	if (!imx_drm_device_get())
-		return -EINVAL;
-
-	return 0;
-}
-
 static void imx_drm_driver_lastclose(struct drm_device *drm)
 {
 	struct imx_drm_device *imxdrm = drm->dev_private;
 
 	if (imxdrm->fbhelper)
 		drm_fbdev_cma_restore_mode(imxdrm->fbhelper);
-
-	imx_drm_device_put();
 }
 
 static int imx_drm_driver_unload(struct drm_device *drm)
 {
 	struct imx_drm_device *imxdrm = drm->dev_private;
 
+	imx_drm_device_put();
+
 	drm_mode_config_cleanup(imxdrm->drm);
 	drm_kms_helper_poll_fini(imxdrm->drm);
 
@@ -226,8 +218,6 @@ struct drm_device *imx_drm_device_get(void)
 	struct imx_drm_connector *con;
 	struct imx_drm_crtc *crtc;
 
-	mutex_lock(&imxdrm->mutex);
-
 	list_for_each_entry(enc, &imxdrm->encoder_list, list) {
 		if (!try_module_get(enc->owner)) {
 			dev_err(imxdrm->dev, "could not get module %s\n",
@@ -254,8 +244,6 @@ struct drm_device *imx_drm_device_get(void)
 
 	imxdrm->references++;
 
-	mutex_unlock(&imxdrm->mutex);
-
 	return imxdrm->drm;
 
 unwind_crtc:
@@ -447,6 +435,9 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
 	 */
 	imxdrm->drm->vblank_disable_allowed = 1;
 
+	if (!imx_drm_device_get())
+		ret = -EINVAL;
+
 	ret = 0;
 
 err_init:
@@ -791,7 +782,6 @@ static struct drm_driver imx_drm_driver = {
 	.driver_features	= DRIVER_MODESET | DRIVER_GEM,
 	.load			= imx_drm_driver_load,
 	.unload			= imx_drm_driver_unload,
-	.firstopen		= imx_drm_driver_firstopen,
 	.lastclose		= imx_drm_driver_lastclose,
 	.gem_free_object	= drm_gem_cma_free_object,
 	.gem_vm_ops		= &drm_gem_cma_vm_ops,
-- 
1.8.3.2

  parent reply	other threads:[~2013-08-08 13:41 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08 13:41 [PATCH 00/25] drm cruft removal Daniel Vetter
2013-08-08 13:41 ` [PATCH 01/25] drm/omap: kill firstopen callback Daniel Vetter
2013-08-08 14:04   ` Rob Clark
2013-08-08 13:41 ` [PATCH 02/25] drm/radeon: kill firstopen callback for kms driver Daniel Vetter
2013-08-08 13:41 ` Daniel Vetter [this message]
2013-08-12 22:23   ` [PATCH 03/25] drm/imx: kill firstopen callback Greg Kroah-Hartman
2013-08-08 13:41 ` [PATCH 04/25] drm/vmwgfx: remove ->firstopen callback Daniel Vetter
2013-08-08 13:41 ` [PATCH 05/25] drm: don't call ->firstopen for KMS drivers Daniel Vetter
2013-08-08 13:41 ` [PATCH 06/25] drm: kill dev->driver->set_version Daniel Vetter
2013-08-08 14:10   ` Rob Clark
2013-08-08 13:41 ` [PATCH 07/25] drm: hide legacy sg cleanup better from common code Daniel Vetter
2013-08-08 13:41 ` [PATCH 08/25] drm: disallow legacy sg ioctls for modesetting drivers Daniel Vetter
2013-08-08 13:41 ` [PATCH 09/25] drm: mark dma setup/teardown as legacy systems Daniel Vetter
2013-08-08 13:41 ` [PATCH 10/25] drm: disallow legacy dma ioctls for modesetting drivers Daniel Vetter
2013-08-08 13:41 ` [PATCH 11/25] drm: mark context support as a legacy subsystem Daniel Vetter
2013-08-08 13:41 ` [PATCH 12/25] drm/vmwgfx: remove redundant clearing of driver->dma_quiescent Daniel Vetter
2013-08-08 13:41 ` [PATCH 13/25] drm: remove FASYNC support Daniel Vetter
2013-08-13 19:26   ` David Herrmann
2013-08-08 13:41 ` [PATCH 14/25] drm: rip out DRIVER_FB_DMA and related code Daniel Vetter
2013-08-08 13:41 ` [PATCH 15/25] drm: rip out a few unused DRIVER flags Daniel Vetter
2013-08-08 13:41 ` [PATCH 16/25] drm: remove a bunch of unused #defines from drmP.h Daniel Vetter
2013-08-08 13:41 ` [PATCH 17/25] drm: rip out drm_core_has_MTRR checks Daniel Vetter
2013-08-09 18:12   ` Andy Lutomirski
2013-08-09 18:36     ` Daniel Vetter
2013-08-09 18:39       ` Andy Lutomirski
2013-08-09 18:47         ` Daniel Vetter
2013-08-09 18:48           ` Andy Lutomirski
2013-08-15 12:44   ` David Herrmann
2013-08-08 13:41 ` [PATCH 18/25] drm/docs: rip out removed driver flags documentation Daniel Vetter
2013-08-08 13:41 ` [PATCH 19/25] drm: remove the dma_ioctl special-case Daniel Vetter
2013-08-13 18:05   ` David Herrmann
2013-08-08 13:41 ` [PATCH 20/25] drm/memory: don't export agp helpers Daniel Vetter
2013-08-08 13:41 ` [PATCH 21/25] drm: hollow-out GET_CLIENT ioctl Daniel Vetter
2013-08-08 13:41 ` [PATCH 22/25] drm: no-op out GET_STATS ioctl Daniel Vetter
2013-08-08 15:55   ` Eric Anholt
2013-08-09  9:05     ` Daniel Vetter
2013-08-08 13:41 ` [PATCH 23/25] drm: fix locking in gem debugfs/procfs file Daniel Vetter
2013-08-08 13:41 ` [PATCH 24/25] drm: remove procfs code, take 2 Daniel Vetter
2013-08-08 13:41 ` [PATCH 25/25] drm: move dev data clearing from drm_setup to lastclose Daniel Vetter
2013-08-13 18:12   ` David Herrmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375969295-18929-4-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).