public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lizhe <sensor1010@163.com>
To: gregkh@linuxfoundation.org, rafael@kernel.org
Cc: linux-kernel@vger.kernel.org, Lizhe <sensor1010@163.com>
Subject: [PATCH v3] driver:core: no need to invert the return value of the call_driver_probe()
Date: Tue,  9 Jul 2024 07:14:17 -0700	[thread overview]
Message-ID: <20240709141417.3349-1-sensor1010@163.com> (raw)

In the probe function (either drv->bus->probe() or drv->probe()),
there is no return value of EPROBE_DEFER. the error return from probe
should be -EPROBE_DEFER, hence no negation of call_driver_probe()'s
return is needed, nor should there be an EPROBE_DEFER check in
driver_probe_device()

Signed-off-by: Lizhe <sensor1010@163.com>

v3:
	Modify commit message and versions go below the ---
v2:
	Delete the judgment with the return value of EPROBEDEFER
	from the _driver_probe.device()
v1:
	Add the judgment with the return value of EPROBEDEFER
	from the _driver_probe.device()
---
 drivers/base/dd.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 83d352394fdf..d047919d1f5e 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -664,11 +664,6 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 		if (link_ret == -EAGAIN)
 			ret = -EPROBE_DEFER;
 
-		/*
-		 * Return probe errors as positive values so that the callers
-		 * can distinguish them from other errors.
-		 */
-		ret = -ret;
 		goto probe_failed;
 	}
 
@@ -826,7 +821,7 @@ static int driver_probe_device(struct device_driver *drv, struct device *dev)
 
 	atomic_inc(&probe_count);
 	ret = __driver_probe_device(drv, dev);
-	if (ret == -EPROBE_DEFER || ret == EPROBE_DEFER) {
+	if (ret == -EPROBE_DEFER) {
 		driver_deferred_probe_add(dev);
 
 		/*
-- 
2.17.1


             reply	other threads:[~2024-07-09 14:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 14:14 Lizhe [this message]
2024-07-09 14:24 ` [PATCH v3] driver:core: no need to invert the return value of the call_driver_probe() Greg KH
2024-07-10 12:50 ` Greg KH

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=20240709141417.3349-1-sensor1010@163.com \
    --to=sensor1010@163.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox