diff options
author | Evgeniy Polyakov <zbr@ioremap.net> | 2011-12-09 20:36:11 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-09 22:19:18 -0500 |
commit | c9cbf558e7793d312a4dd5d839ad7eae1aa8bd12 (patch) | |
tree | 5a06a20dc0de4365b2d385662dd5fa178d9d3a61 /drivers/w1 | |
parent | 74099b18b8db0670484e0caeb3425fb29ff3144e (diff) |
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@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
index c374978..9761950 100644
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/w1')
-rw-r--r-- | 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 c37497823851..9761950697b4 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 | |||
892 | break; | 892 | break; |
893 | } | 893 | } |
894 | 894 | ||
895 | /* Do fast search on single slave bus */ | ||
896 | if (dev->max_slave_count == 1) { | ||
897 | w1_write_8(dev, W1_READ_ROM); | ||
898 | |||
899 | if (w1_read_block(dev, (u8 *)&rn, 8) == 8 && rn) | ||
900 | cb(dev, rn); | ||
901 | |||
902 | break; | ||
903 | } | ||
904 | |||
895 | /* Start the search */ | 905 | /* Start the search */ |
896 | w1_write_8(dev, search_type); | 906 | w1_write_8(dev, search_type); |
897 | for (i = 0; i < 64; ++i) { | 907 | for (i = 0; i < 64; ++i) { |