aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/w1/w1.c18
-rw-r--r--drivers/w1/w1.h3
2 files changed, 18 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
918 u8 triplet_ret = 0; 918 u8 triplet_ret = 0;
919 919
920 search_bit = 0; 920 search_bit = 0;
921 rn = last_rn = 0; 921 rn = dev->search_id;
922 last_rn = 0;
922 last_device = 0; 923 last_device = 0;
923 last_zero = -1; 924 last_zero = -1;
924 925
@@ -989,16 +990,27 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
989 mutex_unlock(&dev->bus_mutex); 990 mutex_unlock(&dev->bus_mutex);
990 991
991 if ( (triplet_ret & 0x03) != 0x03 ) { 992 if ( (triplet_ret & 0x03) != 0x03 ) {
992 if ( (desc_bit == last_zero) || (last_zero < 0)) 993 if ((desc_bit == last_zero) || (last_zero < 0)) {
993 last_device = 1; 994 last_device = 1;
995 dev->search_id = 0;
996 } else {
997 dev->search_id = rn;
998 }
994 desc_bit = last_zero; 999 desc_bit = last_zero;
995 cb(dev, rn); 1000 cb(dev, rn);
996 } 1001 }
997 1002
998 if (!last_device && slave_count == dev->max_slave_count && 1003 if (!last_device && slave_count == dev->max_slave_count &&
999 !test_bit(W1_WARN_MAX_COUNT, &dev->flags)) { 1004 !test_bit(W1_WARN_MAX_COUNT, &dev->flags)) {
1005 /* Only max_slave_count will be scanned in a search,
1006 * but it will start where it left off next search
1007 * until all ids are identified and then it will start
1008 * over. A continued search will report the previous
1009 * last id as the first id (provided it is still on the
1010 * bus).
1011 */
1000 dev_info(&dev->dev, "%s: max_slave_count %d reached, " 1012 dev_info(&dev->dev, "%s: max_slave_count %d reached, "
1001 "additional sensors ignored\n", __func__, 1013 "will continue next search.\n", __func__,
1002 dev->max_slave_count); 1014 dev->max_slave_count);
1003 set_bit(W1_WARN_MAX_COUNT, &dev->flags); 1015 set_bit(W1_WARN_MAX_COUNT, &dev->flags);
1004 } 1016 }
diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h
index bd10b3c2a406..80fbdf908919 100644
--- a/drivers/w1/w1.h
+++ b/drivers/w1/w1.h
@@ -150,6 +150,7 @@ struct w1_bus_master
150 150
151 /** Really nice hardware can handles the different types of ROM search 151 /** Really nice hardware can handles the different types of ROM search
152 * w1_master* is passed to the slave found callback. 152 * w1_master* is passed to the slave found callback.
153 * u8 is search_type, W1_SEARCH or W1_ALARM_SEARCH
153 */ 154 */
154 void (*search)(void *, struct w1_master *, 155 void (*search)(void *, struct w1_master *,
155 u8, w1_slave_found_callback); 156 u8, w1_slave_found_callback);
@@ -177,6 +178,8 @@ struct w1_master
177 int initialized; 178 int initialized;
178 u32 id; 179 u32 id;
179 int search_count; 180 int search_count;
181 /* id to start searching on, to continue a search or 0 to restart */
182 u64 search_id;
180 183
181 atomic_t refcnt; 184 atomic_t refcnt;
182 185