mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] driver: remove the const of struct platform_device_id *id_table
Date: Sat,  4 Mar 2017 08:14:07 +0100	[thread overview]
Message-ID: <1488611648-22773-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20170304071241.GG4120@mail.ovh.net>

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2017-03-04  7:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-04  7:12 [RFC PATCH 0/2] use gnuhash to speed up device/driver match Jean-Christophe PLAGNIOL-VILLARD
2017-03-04  7:14 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2017-03-04  7:14   ` [PATCH 2/2] driver: generate hash at runtime to speed up device/driver matching Jean-Christophe PLAGNIOL-VILLARD
2017-03-06  8:11 ` [RFC PATCH 0/2] use gnuhash to speed up device/driver match 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=1488611648-22773-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.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