summaryrefslogtreecommitdiff
path: root/drivers/w1/w1.c
diff options
context:
space:
mode:
authorDavid Fries <David@Fries.net>2014-01-16 08:29:16 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-08 03:40:17 +0400
commit3c6955e5aa2a7ebf18a44486be6a7f047811650b (patch)
treeb9365215e9e5421e24e111a6b3e792af1ade73d9 /drivers/w1/w1.c
parenta16130569af7e92b0a68a8c96170d84756f91c47 (diff)
downloadlinux-3c6955e5aa2a7ebf18a44486be6a7f047811650b.tar.xz
w1: continue slave search where previous left off
Search will detect at most max_slave_count devices per run, if there are more pick up the next search where the previous left off. Signed-off-by: David Fries <David@Fries.net> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1/w1.c')
-rw-r--r--drivers/w1/w1.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 34ffdc6da4fb..4c89f85edfe6 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -918,7 +918,8 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
u8 triplet_ret = 0;
search_bit = 0;
- rn = last_rn = 0;
+ rn = dev->search_id;
+ last_rn = 0;
last_device = 0;
last_zero = -1;
@@ -989,16 +990,27 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
mutex_unlock(&dev->bus_mutex);
if ( (triplet_ret & 0x03) != 0x03 ) {
- if ( (desc_bit == last_zero) || (last_zero < 0))
+ if ((desc_bit == last_zero) || (last_zero < 0)) {
last_device = 1;
+ dev->search_id = 0;
+ } else {
+ dev->search_id = rn;
+ }
desc_bit = last_zero;
cb(dev, rn);
}
if (!last_device && slave_count == dev->max_slave_count &&
!test_bit(W1_WARN_MAX_COUNT, &dev->flags)) {
+ /* Only max_slave_count will be scanned in a search,
+ * but it will start where it left off next search
+ * until all ids are identified and then it will start
+ * over. A continued search will report the previous
+ * last id as the first id (provided it is still on the
+ * bus).
+ */
dev_info(&dev->dev, "%s: max_slave_count %d reached, "
- "additional sensors ignored\n", __func__,
+ "will continue next search.\n", __func__,
dev->max_slave_count);
set_bit(W1_WARN_MAX_COUNT, &dev->flags);
}