mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: mfe@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 2/5] deep-probe: treat any probe deferral as permanent
Date: Mon, 19 Feb 2024 18:29:22 +0100	[thread overview]
Message-ID: <20240219172925.3798024-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240219172925.3798024-1-a.fatoum@pengutronix.de>

As the comment notes, "-EPROBE_DEFER should never appear on a deep-probe
machine so inform the user immediately.". Yet, we still add the device
to the deferred probe list to try it again later, which should only make
a difference if there's a bug with the deep probe mechanism itself.

Therefore, never use the deferred probe list on deep probe system and
directly report any probe deferral as permanent.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - new patch
---
 drivers/base/driver.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 4884e8fda8ef..bb9699ee3795 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -106,6 +106,15 @@ int get_free_deviceid(const char *name_template)
 	};
 }
 
+static void dev_report_permanent_probe_deferral(struct device *dev)
+{
+	if (dev->deferred_probe_reason)
+		dev_err(dev, "probe permanently deferred (%s)\n",
+			dev->deferred_probe_reason);
+	else
+		dev_err(dev, "probe permanently deferred\n");
+}
+
 int device_probe(struct device *dev)
 {
 	static int depth = 0;
@@ -136,17 +145,18 @@ int device_probe(struct device *dev)
 	case 0:
 		return 0;
 	case -EPROBE_DEFER:
-		list_move(&dev->active, &deferred);
-
 		/*
 		 * -EPROBE_DEFER should never appear on a deep-probe machine so
 		 * inform the user immediately.
 		 */
-		if (deep_probe_is_supported())
-			dev_err(dev, "probe deferred\n");
-		else
-			dev_dbg(dev, "probe deferred\n");
+		if (deep_probe_is_supported()) {
+			dev_report_permanent_probe_deferral(dev);
+			break;
+		}
 
+		list_move(&dev->active, &deferred);
+
+		dev_dbg(dev, "probe deferred\n");
 		return -EPROBE_DEFER;
 	case -ENODEV:
 	case -ENXIO:
@@ -155,7 +165,6 @@ int device_probe(struct device *dev)
 	default:
 		dev_err(dev, "probe failed: %pe\n", ERR_PTR(ret));
 		break;
-
 	}
 
 	list_del_init(&dev->active);
@@ -382,13 +391,9 @@ static int device_probe_deferred(void)
 		}
 	} while (success);
 
-	list_for_each_entry(dev, &deferred, active) {
-		if (dev->deferred_probe_reason)
-			dev_err(dev, "probe permanently deferred (%s)\n",
-				dev->deferred_probe_reason);
-		else
-			dev_err(dev, "probe permanently deferred\n");
-	}
+	list_for_each_entry(dev, &deferred, active)
+		dev_report_permanent_probe_deferral(dev);
+
 	return 0;
 }
 late_initcall(device_probe_deferred);
-- 
2.39.2




  reply	other threads:[~2024-02-19 17:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 17:29 [PATCH v2 1/5] driver: refactor probe return value handling into switch statement Ahmad Fatoum
2024-02-19 17:29 ` Ahmad Fatoum [this message]
2024-02-19 17:29 ` [PATCH v2 3/5] deep-probe: use IS_ERR_OR_NULL() instead of opencoding Ahmad Fatoum
2024-02-19 17:29 ` [PATCH v2 4/5] deep-probe: return -EPROBE_DEFER when ensuring probe fails Ahmad Fatoum
2024-02-19 17:29 ` [PATCH v2 5/5] phy: freescale: imx8mq-usb: make i.MX8MP support more explicit Ahmad Fatoum
2024-02-20 11:08 ` [PATCH v2 1/5] driver: refactor probe return value handling into switch statement Sascha Hauer

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=20240219172925.3798024-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=mfe@pengutronix.de \
    /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