[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1323017210-14666-1-git-send-email-h.feurstein@gmail.com>
Date: Sun, 4 Dec 2011 17:46:50 +0100
From: Hubert Feurstein <h.feurstein@...il.com>
To: zbr@...emap.net, jeff.dagenais@...il.com
Cc: linux-kernel@...r.kernel.org,
Hubert Feurstein <h.feurstein@...il.com>
Subject: [PATCH v2] w1: add fast search for single slave bus
This enables a much more efficient way of device searching. It uses the
1-wire read-rom operation which allows the direct reading of the slave
address. BUT this works only with exactly one slave on the bus.
Signed-off-by: Hubert Feurstein <h.feurstein@...il.com>
---
v2: remove config option
drivers/w1/w1.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index c374978..9761950 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -892,6 +892,16 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
break;
}
+ /* Do fast search on single slave bus */
+ if (dev->max_slave_count == 1) {
+ w1_write_8(dev, W1_READ_ROM);
+
+ if (w1_read_block(dev, (u8 *)&rn, 8) == 8 && rn)
+ cb(dev, rn);
+
+ break;
+ }
+
/* Start the search */
w1_write_8(dev, search_type);
for (i = 0; i < 64; ++i) {
--
1.7.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists