From: Imre Kaloz <kaloz@kernel.org>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] w1: Let bus masters set the search count
Date: Tue, 13 Oct 2026 11:50:45 +0200 [thread overview]
Message-ID: <20261013095046.6006-2-kaloz@kernel.org> (raw)
In-Reply-To: <20261013095046.6006-1-kaloz@kernel.org>
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
next prev parent reply other threads:[~2026-10-13 9:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-10-13 9:50 ` [PATCH 2/2] w1: sgi_w1: Search the bus " Imre Kaloz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261013095046.6006-2-kaloz@kernel.org \
--to=kaloz@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®