Commit c9cbf558 authored by Evgeniy Polyakov's avatar Evgeniy Polyakov Committed by Greg Kroah-Hartman

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: default avatarHubert Feurstein <h.feurstein@gmail.com>
Acked-by: default avatarEvgeniy Polyakov <zbr@ioremap.net>

index c374978..9761950 100644
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 74099b18
...@@ -892,6 +892,16 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb ...@@ -892,6 +892,16 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
break; 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 */ /* Start the search */
w1_write_8(dev, search_type); w1_write_8(dev, search_type);
for (i = 0; i < 64; ++i) { for (i = 0; i < 64; ++i) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment