The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v4] driver:core: no need to invert the return value of the call_driver_probe()
@ 2024-07-10 14:00 李哲
  2024-07-31 12:45 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: 李哲 @ 2024-07-10 14:00 UTC (permalink / raw)
  To: gregkh, rafael; +Cc: linux-kernel, 李哲

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: 李哲 <sensor1010@163.com>

---
v4:
	Change the pinyin "Lizhe" to the Chinese name 李哲
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v4] driver:core: no need to invert the return value of the call_driver_probe()
  2024-07-10 14:00 [PATCH v4] driver:core: no need to invert the return value of the call_driver_probe() 李哲
@ 2024-07-31 12:45 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2024-07-31 12:45 UTC (permalink / raw)
  To: 李哲; +Cc: rafael, linux-kernel

On Wed, Jul 10, 2024 at 07:00:41AM -0700, 李哲 wrote:
> 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()

Are you sure?  What makes the logic in commit 45ddcb42949f ("driver
core: Don't return EPROBE_DEFER to userspace during sysfs bind")
incorrect?  It required the check for EPROBE_DEFER like this, has
something changed since then to make this test not required?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-31 12:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10 14:00 [PATCH v4] driver:core: no need to invert the return value of the call_driver_probe() 李哲
2024-07-31 12:45 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox