[PATCH 1/2] driver: remove the const of struct platform_device_id *id_table

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Fri Mar 3 23:14:07 PST 2017


so we can generate the hash at register time

This will allow speed up the device/driver matching as strcmp is slow.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 drivers/base/bus.c | 4 ++--
 include/driver.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index b889a4866..03feba502 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -55,7 +55,7 @@ int device_match(struct device_d *dev, struct driver_d *drv)
 		return of_match(dev, drv);
 
 	if (drv->id_table) {
-		const struct platform_device_id *id = drv->id_table;
+		struct platform_device_id *id = drv->id_table;
 
 		while (id->name) {
 			if (!strcmp(id->name, dev->name)) {
@@ -73,7 +73,7 @@ int device_match(struct device_d *dev, struct driver_d *drv)
 
 int device_match_of_modalias(struct device_d *dev, struct driver_d *drv)
 {
-	const struct platform_device_id *id = drv->id_table;
+	struct platform_device_id *id = drv->id_table;
 	const char *of_modalias = NULL, *p;
 	int cplen;
 	const char *compat;
diff --git a/include/driver.h b/include/driver.h
index 6abaaad8b..db7f9c780 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -107,7 +107,7 @@ struct driver_d {
 
 	struct bus_type *bus;
 
-	const struct platform_device_id *id_table;
+	struct platform_device_id *id_table;
 	const struct of_device_id *of_compatible;
 };
 
-- 
2.11.0




More information about the barebox mailing list