* [PATCH 0/2] w1: Search the SGI 1-wire buses only once
@ 2026-10-13 9:50 Imre Kaloz
2026-10-13 9:50 ` [PATCH 1/2] w1: Let bus masters set the search count Imre Kaloz
2026-10-13 9:50 ` [PATCH 2/2] w1: sgi_w1: Search the bus only once Imre Kaloz
0 siblings, 2 replies; 3+ messages in thread
From: Imre Kaloz @ 2026-10-13 9:50 UTC (permalink / raw)
To: Krzysztof Kozlowski; +Cc: linux-kernel
The slaves on the SGI 1-wire buses are soldered to the board, yet the
w1 core rescans each bus every 10 seconds, busy-waiting through the
time slots.
Patch 1 lets a bus master set its search count, and patch 2 has
sgi_w1 search once.
Tested on an Octane.
Imre Kaloz (2):
w1: Let bus masters set the search count
w1: sgi_w1: Search the bus only once
drivers/w1/masters/sgi_w1.c | 3 +++
drivers/w1/w1_int.c | 3 +++
include/linux/w1.h | 5 +++++
3 files changed, 11 insertions(+)
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] w1: Let bus masters set the search count
2026-10-13 9:50 [PATCH 0/2] w1: Search the SGI 1-wire buses only once Imre Kaloz
@ 2026-10-13 9:50 ` Imre Kaloz
2026-10-13 9:50 ` [PATCH 2/2] w1: sgi_w1: Search the bus only once Imre Kaloz
1 sibling, 0 replies; 3+ messages in thread
From: Imre Kaloz @ 2026-10-13 9:50 UTC (permalink / raw)
To: Krzysztof Kozlowski; +Cc: linux-kernel
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@kernel.org>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] w1: sgi_w1: Search the bus only once
2026-10-13 9:50 [PATCH 0/2] w1: Search the SGI 1-wire buses only once Imre Kaloz
2026-10-13 9:50 ` [PATCH 1/2] w1: Let bus masters set the search count Imre Kaloz
@ 2026-10-13 9:50 ` Imre Kaloz
1 sibling, 0 replies; 3+ messages in thread
From: Imre Kaloz @ 2026-10-13 9:50 UTC (permalink / raw)
To: Krzysztof Kozlowski; +Cc: linux-kernel
The slaves on this bus are soldered to the board, so rescanning it
every timeout period only busy-waits through the time slots.
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
drivers/w1/masters/sgi_w1.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/w1/masters/sgi_w1.c b/drivers/w1/masters/sgi_w1.c
index 48c10062022c..a583821d2421 100644
--- a/drivers/w1/masters/sgi_w1.c
+++ b/drivers/w1/masters/sgi_w1.c
@@ -90,6 +90,9 @@ static int sgi_w1_probe(struct platform_device *pdev)
sdev->bus_master.reset_bus = sgi_w1_reset_bus;
sdev->bus_master.touch_bit = sgi_w1_touch_bit;
+ /* The slaves are soldered on; one search finds them all. */
+ sdev->bus_master.search_count = 1;
+
pdata = dev_get_platdata(&pdev->dev);
if (pdata) {
strscpy(sdev->dev_id, pdata->dev_id, sizeof(sdev->dev_id));
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-13 9:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-13 9:50 [PATCH 0/2] w1: Search the SGI 1-wire buses only once Imre Kaloz
2026-10-13 9:50 ` [PATCH 1/2] w1: Let bus masters set the search count Imre Kaloz
2026-10-13 9:50 ` [PATCH 2/2] w1: sgi_w1: Search the bus only once Imre Kaloz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®