All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jyri Sarha <jsarha@ti.com>
To: dri-devel@lists.freedesktop.org
Cc: Jyri Sarha <jsarha@ti.com>,
	tomi.valkeinen@ti.com, laurent.pinchart@ideasonboard.com
Subject: [PATCH v2 01/21] drm/tilcdc: Fix tilcdc component master unloading
Date: Tue, 28 Jun 2016 10:20:56 +0300	[thread overview]
Message-ID: <ddf8b7e369324e5d79ca800eeeabf2ff35384467.1467098026.git.jsarha@ti.com> (raw)
In-Reply-To: <cover.1467098026.git.jsarha@ti.com>

Fix tilcdc component master unloading. If a subcomponent module
(tda998x in this case) is unloaded before its master (tilcdc in this
case), it calls drm_put_dev() and it should not be called again by
the master when its module is unloaded. However component_master_del()
must still be called and the check if the drm_put_dev() has been
called must be in component_master_ops unbind() callback, not in
platform_driver remove() callback.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 148b1ed..10fd3ee 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -652,6 +652,12 @@ static int tilcdc_bind(struct device *dev)
 
 static void tilcdc_unbind(struct device *dev)
 {
+	struct drm_device *ddev = dev_get_drvdata(dev);
+
+	/* Check if a subcomponent has already triggered the unloading. */
+	if (!ddev->dev_private)
+		return;
+
 	drm_put_dev(dev_get_drvdata(dev));
 }
 
@@ -684,17 +690,15 @@ static int tilcdc_pdev_probe(struct platform_device *pdev)
 
 static int tilcdc_pdev_remove(struct platform_device *pdev)
 {
-	struct drm_device *ddev = dev_get_drvdata(&pdev->dev);
-	struct tilcdc_drm_private *priv = ddev->dev_private;
-
-	/* Check if a subcomponent has already triggered the unloading. */
-	if (!priv)
-		return 0;
+	int ret;
 
-	if (priv->is_componentized)
-		component_master_del(&pdev->dev, &tilcdc_comp_ops);
-	else
+	ret = tilcdc_get_external_components(&pdev->dev, NULL);
+	if (ret < 0)
+		return ret;
+	else if (ret == 0)
 		drm_put_dev(platform_get_drvdata(pdev));
+	else
+		component_master_del(&pdev->dev, &tilcdc_comp_ops);
 
 	return 0;
 }
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-06-28  7:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28  7:20 [PATCH v2 00/21] drm/tilcdc: Atomic modeset support Jyri Sarha
2016-06-28  7:20 ` Jyri Sarha [this message]
2016-06-28  7:20 ` [PATCH v2 02/21] drm/tilcdc: Make tilcdc_crtc_page_flip() public Jyri Sarha
2016-06-28  7:20 ` [PATCH v2 03/21] drm/tilcdc: Make tilcdc_crtc_page_flip() work if crtc is not yet on Jyri Sarha
2016-06-28  7:20 ` [PATCH v2 04/21] drm/tilcdc: Add dummy primary plane implementation Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 05/21] drm/tilcdc: Initialize dummy primary plane from crtc init Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 06/21] drm/tilcdc: Add tilcdc_crtc_mode_set_nofb() Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 07/21] drm/tilcdc: Add tilcdc_crtc_atomic_check() Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 08/21] drm/tilcdc: Add atomic mode config funcs Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 09/21] drm/tilcdc: Add drm_mode_config_reset() call to tilcdc_load() Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 10/21] drm/tilcdc: Set DRIVER_ATOMIC and use atomic crtc helpers Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 11/21] drm/tilcdc: Remove obsolete crtc helper functions Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 12/21] drm/tilcdc: Remove tilcdc_verify_fb() Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 13/21] drm/tilcdc: panel: Set crtc panel info at init phase Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 14/21] drm/tilcdc: panel: Add atomic modeset helpers to connector funcs Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 15/21] drm/tilcdc: tfp410: Set crtc panel info at init phase Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 16/21] drm/tilcdc: tfp410: Add atomic modeset helpers to connector funcs Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 17/21] drm/tilcdc: Enable and disable interrupts in crtc start() and stop() Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 18/21] drm/tilcdc: Use drm_atomic_helper_resume/suspend() Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 19/21] drm/tilcdc: Get rid of legacy dpms mechanism Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 20/21] drm/tilcdc: Remove unnecessary pm_runtime_get() and *_put() calls Jyri Sarha
2016-06-28  7:21 ` [PATCH v2 21/21] drm/tilcdc: Change tilcdc_crtc_page_flip() to tilcdc_crtc_update_fb() Jyri Sarha

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=ddf8b7e369324e5d79ca800eeeabf2ff35384467.1467098026.git.jsarha@ti.com \
    --to=jsarha@ti.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=tomi.valkeinen@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.