All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-renesas-soc@vger.kernel.org,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH v2] drm: rcar-du: Use dev_err_probe() to record cause of KMS init errors
Date: Tue, 30 May 2023 18:32:51 +0300	[thread overview]
Message-ID: <20230530153251.22302-1-laurent.pinchart+renesas@ideasonboard.com> (raw)

The (large) rcar_du_modeset_init() function can fail for many reasons,
two of two involving probe deferral. Use dev_err_probe() in those code
paths to record the cause of the probe deferral, in order to help
debugging probe issues.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c | 4 ++++
 drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
index 12a8839fe3be..5b752adb1b02 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
@@ -701,6 +701,10 @@ static int rcar_du_probe(struct platform_device *pdev)
 	/* DRM/KMS objects */
 	ret = rcar_du_modeset_init(rcdu);
 	if (ret < 0) {
+		/*
+		 * Don't use dev_err_probe(), as it would overwrite the probe
+		 * deferral reason recorded in rcar_du_modeset_init().
+		 */
 		if (ret != -EPROBE_DEFER)
 			dev_err(&pdev->dev,
 				"failed to initialize DRM/KMS (%d)\n", ret);
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
index adfb36b0e815..a9b01027bf03 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
@@ -932,8 +932,10 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
 
 	/* Initialize the Color Management Modules. */
 	ret = rcar_du_cmm_init(rcdu);
-	if (ret)
+	if (ret) {
+		dev_err_probe(rcdu->dev, "failed to initialize CMM\n", ret);
 		return ret;
+	}
 
 	/* Create the CRTCs. */
 	for (swindex = 0, hwindex = 0; swindex < rcdu->num_crtcs; ++hwindex) {
@@ -952,8 +954,10 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
 
 	/* Initialize the encoders. */
 	ret = rcar_du_encoders_init(rcdu);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_err_probe(rcdu->dev, "failed to initialize encoders\n", ret);
 		return ret;
+	}
 
 	if (ret == 0) {
 		dev_err(rcdu->dev, "error: no encoder could be initialized\n");
-- 
Regards,

Laurent Pinchart


WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-renesas-soc@vger.kernel.org,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>
Subject: [PATCH v2] drm: rcar-du: Use dev_err_probe() to record cause of KMS init errors
Date: Tue, 30 May 2023 18:32:51 +0300	[thread overview]
Message-ID: <20230530153251.22302-1-laurent.pinchart+renesas@ideasonboard.com> (raw)

The (large) rcar_du_modeset_init() function can fail for many reasons,
two of two involving probe deferral. Use dev_err_probe() in those code
paths to record the cause of the probe deferral, in order to help
debugging probe issues.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c | 4 ++++
 drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
index 12a8839fe3be..5b752adb1b02 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
@@ -701,6 +701,10 @@ static int rcar_du_probe(struct platform_device *pdev)
 	/* DRM/KMS objects */
 	ret = rcar_du_modeset_init(rcdu);
 	if (ret < 0) {
+		/*
+		 * Don't use dev_err_probe(), as it would overwrite the probe
+		 * deferral reason recorded in rcar_du_modeset_init().
+		 */
 		if (ret != -EPROBE_DEFER)
 			dev_err(&pdev->dev,
 				"failed to initialize DRM/KMS (%d)\n", ret);
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
index adfb36b0e815..a9b01027bf03 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
@@ -932,8 +932,10 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
 
 	/* Initialize the Color Management Modules. */
 	ret = rcar_du_cmm_init(rcdu);
-	if (ret)
+	if (ret) {
+		dev_err_probe(rcdu->dev, "failed to initialize CMM\n", ret);
 		return ret;
+	}
 
 	/* Create the CRTCs. */
 	for (swindex = 0, hwindex = 0; swindex < rcdu->num_crtcs; ++hwindex) {
@@ -952,8 +954,10 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
 
 	/* Initialize the encoders. */
 	ret = rcar_du_encoders_init(rcdu);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_err_probe(rcdu->dev, "failed to initialize encoders\n", ret);
 		return ret;
+	}
 
 	if (ret == 0) {
 		dev_err(rcdu->dev, "error: no encoder could be initialized\n");
-- 
Regards,

Laurent Pinchart


             reply	other threads:[~2023-05-30 15:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 15:32 Laurent Pinchart [this message]
2023-05-30 15:32 ` [PATCH v2] drm: rcar-du: Use dev_err_probe() to record cause of KMS init errors Laurent Pinchart
2023-06-02 19:29 ` Biju Das
2023-06-02 19:29   ` Biju Das
2023-06-04 10:48   ` Laurent Pinchart
2023-06-04 10:48     ` Laurent Pinchart
2023-06-04 10:49 Laurent Pinchart
2023-06-04 10:49 ` Laurent Pinchart
2023-06-04 10:57 ` Laurent Pinchart
2023-06-05 19:47 ` Kieran Bingham

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=20230530153251.22302-1-laurent.pinchart+renesas@ideasonboard.com \
    --to=laurent.pinchart+renesas@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.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 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.