Skip to contentSkip to conversation

driver:core: NO need to determine whether the driver is asynchronous

PATCH In review 李哲 2 participants 2 messages Jul 14, 2024 – Jul 31, 2024 Driver core

lore
Share & tools
lore

李哲

author
#0 lore raw

PATCH 1/1 driver:core: NO need to determine whether the driver is asynchronous

When rescanning the device, there is no need to determine whether the driver is asynchronous.

---
 drivers/base/dd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/base/dd.c +7 -5
index 47351d98f6e1..41fd4b1b4779 100644
@@ -915,7 +915,7 @@ static int __device_attach_driver(struct device_driver *drv, void *_data)
 {
 	struct device_attach_data *data = _data;
 	struct device *dev = data->dev;
-	bool async_allowed;
+	bool async_allowed = false;
 	int ret;
 
 	ret = driver_match_device(drv, dev);
@@ -936,12 +936,14 @@ static int __device_attach_driver(struct device_driver *drv, void *_data)
 		return ret;
 	} /* ret > 0 means positive match */
 
-	async_allowed = driver_allows_async_probing(drv);
+	if (data->check_async) {
+		async_allowed = driver_allows_async_probing(drv);
 
-	if (async_allowed)
-		data->have_async = true;
+		if (async_allowed)
+			data->have_async = true;
+	}
 
-	if (data->check_async && async_allowed != data->want_async)
+	if (async_allowed != data->want_async)
 		return 0;
 
 	/*
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 29 lines · 李哲

When rescanning the device, there is no need to determine whether the driver is asynchronous.

---
 drivers/base/dd.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/base/dd.c +3 -2
index 47351d98f6e1..41fd4b1b4779 100644
@@ -915,7 +915,7 @@ static int __device_attach_driver(struct device_driver *drv, void *_data)
 {
 	struct device_attach_data *data = _data;
 	struct device *dev = data->dev;
-	bool async_allowed;
+	bool async_allowed = false;
 	int ret;
 
 	ret = driver_match_device(drv, dev);
@@ -936,12 +936,14 @@ static int __device_attach_driver(struct device_driver *drv, void *_data)
 		return ret;
 	} /* ret > 0 means positive match */
 
-	async_allowed = driver_allows_async_probing(drv);
+	if (data->check_async) {
+		async_allowed = driver_allows_async_probing(drv);
 

drivers/base/dd.c static int __device_attach_driver(struct device_driver *drv, void *_data) · line 948

Quoted 10 lines
drivers/base/dd.c +4 -3
-	if (async_allowed)
-		data->have_async = true;
+		if (async_allowed)
+			data->have_async = true;
+	}
 
-	if (data->check_async && async_allowed != data->want_async)
+	if (async_allowed != data->want_async)
 		return 0;
 

I'm sorry, but I don't see what this is making simpler or cleaner. It's increasing the lines of code, and just moving things around?

What issue is this fixing? What logic is changing? Why is this needed?

thanks,

greg k-h