[PATCH 1/2] w1: Let bus masters set the search count
From: Imre Kaloz
Date: Tue Oct 13 2026 - 06:21:21 EST
A master whose slaves cannot change after probe gains nothing from
repeated searches. Let the master set the number of automatic searches
on its bus; zero keeps the search_count module parameter.
Signed-off-by: Imre Kaloz <kaloz@xxxxxxxxxx>
---
drivers/w1/w1_int.c | 3 +++
include/linux/w1.h | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index 19a0ea28e9f3..54c87927eb60 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -130,6 +130,9 @@ int w1_add_master_device(struct w1_bus_master *master)
memcpy(dev->bus_master, master, sizeof(struct w1_bus_master));
+ if (master->search_count)
+ dev->search_count = master->search_count;
+
dev->initialized = 1;
dev->thread = kthread_run(&w1_process, dev, "%s", dev->name);
diff --git a/include/linux/w1.h b/include/linux/w1.h
index 064805bfae3f..88c5299476ed 100644
--- a/include/linux/w1.h
+++ b/include/linux/w1.h
@@ -122,6 +122,9 @@ typedef void (*w1_slave_found_callback)(struct w1_master *, u64);
* @dev_id: Optional device id string, which w1 slaves could use for
* creating names, which then give a connection to the w1 master
*
+ * @search_count: Optional number of automatic searches to run on this
+ * bus, -1 for unlimited; 0 uses the search_count module parameter
+ *
* Note: read_bit and write_bit are very low level functions and should only
* be used with hardware that doesn't really support 1-wire operations,
* like a parallel/serial port.
@@ -156,6 +159,8 @@ struct w1_bus_master {
u8, w1_slave_found_callback);
char *dev_id;
+
+ int search_count;
};
/**
--
2.47.3