* [PATCH] w1: add fast search for single slave bus
@ 2011-11-28 20:06 Hubert Feurstein
2011-11-28 20:24 ` Evgeniy Polyakov
2011-12-03 14:46 ` Jean-François Dagenais
0 siblings, 2 replies; 7+ messages in thread
From: Hubert Feurstein @ 2011-11-28 20:06 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: linux-kernel, Hubert Feurstein
This enables a much more efficient way of device searching. It uses the
1-wire read-rom operation which allows the direct reading of the slave
address. BUT this works only with exactly one slave on the bus.
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
---
drivers/w1/Kconfig | 8 ++++++++
drivers/w1/w1.c | 11 +++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig
index fd2c7bd..e5006bc 100644
--- a/drivers/w1/Kconfig
+++ b/drivers/w1/Kconfig
@@ -25,6 +25,14 @@ config W1_CON
2. Userspace commands. Includes read/write and search/alarm search commands.
3. Replies to userspace commands.
+config W1_FAST_SEARCH
+ bool "Fast search (single slave bus only!)"
+ ---help---
+ This enables a much more efficient way of device searching. It uses the
+ 1-wire read-rom operation which allows the direct reading of the slave
+ address. BUT this works only with exactly one slave on the bus.
+ If unsure, say 'N'.
+
source drivers/w1/masters/Kconfig
source drivers/w1/slaves/Kconfig
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index c374978..7c648ec 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -892,6 +892,17 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
break;
}
+#ifdef CONFIG_W1_FAST_SEARCH
+ if (dev->max_slave_count == 1) {
+ w1_write_8(dev, W1_READ_ROM);
+
+ if (w1_read_block(dev, (u8 *)&rn, 8) == 8 && rn)
+ cb(dev, rn);
+
+ break;
+ }
+#endif
+
/* Start the search */
w1_write_8(dev, search_type);
for (i = 0; i < 64; ++i) {
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] w1: add fast search for single slave bus
2011-11-28 20:06 [PATCH] w1: add fast search for single slave bus Hubert Feurstein
@ 2011-11-28 20:24 ` Evgeniy Polyakov
2011-12-03 14:46 ` Jean-François Dagenais
1 sibling, 0 replies; 7+ messages in thread
From: Evgeniy Polyakov @ 2011-11-28 20:24 UTC (permalink / raw)
To: Hubert Feurstein; +Cc: linux-kernel
Hi
On Mon, Nov 28, 2011 at 09:06:47PM +0100, Hubert Feurstein (h.feurstein@gmail.com) wrote:
> This enables a much more efficient way of device searching. It uses the
> 1-wire read-rom operation which allows the direct reading of the slave
> address. BUT this works only with exactly one slave on the bus.
Although idea may sound resonable, kernel is shipped with only one
compiled option, and it is quite uncommon to recompile them.
So this option will unlikely to be enabled. I would recommend to add
either a module parameter to forbid multiple slave devices and use fast
search, or use fast search when only one device exists and switch to
common search when it fails (if it is possible to detect that there are
multiple devices on the bus using fast search)
--
Evgeniy Polyakov
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] w1: add fast search for single slave bus
2011-11-28 20:06 [PATCH] w1: add fast search for single slave bus Hubert Feurstein
2011-11-28 20:24 ` Evgeniy Polyakov
@ 2011-12-03 14:46 ` Jean-François Dagenais
2011-12-04 16:46 ` [PATCH v2] " Hubert Feurstein
1 sibling, 1 reply; 7+ messages in thread
From: Jean-François Dagenais @ 2011-12-03 14:46 UTC (permalink / raw)
To: Hubert Feurstein; +Cc: Evgeniy Polyakov, linux-kernel
On 2011-11-28, at 15:06, Hubert Feurstein wrote:
> This enables a much more efficient way of device searching. It uses the
> 1-wire read-rom operation which allows the direct reading of the slave
> address. BUT this works only with exactly one slave on the bus.
>
> Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
> ---
> drivers/w1/Kconfig | 8 ++++++++
> drivers/w1/w1.c | 11 +++++++++++
> 2 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig
> index fd2c7bd..e5006bc 100644
> --- a/drivers/w1/Kconfig
> +++ b/drivers/w1/Kconfig
> @@ -25,6 +25,14 @@ config W1_CON
> 2. Userspace commands. Includes read/write and search/alarm search commands.
> 3. Replies to userspace commands.
>
> +config W1_FAST_SEARCH
> + bool "Fast search (single slave bus only!)"
> + ---help---
> + This enables a much more efficient way of device searching. It uses the
> + 1-wire read-rom operation which allows the direct reading of the slave
> + address. BUT this works only with exactly one slave on the bus.
> + If unsure, say 'N'.
> +
Not needed I think, see below...
> source drivers/w1/masters/Kconfig
> source drivers/w1/slaves/Kconfig
>
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index c374978..7c648ec 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -892,6 +892,17 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
> break;
> }
>
> +#ifdef CONFIG_W1_FAST_SEARCH
> + if (dev->max_slave_count == 1) {
> + w1_write_8(dev, W1_READ_ROM);
> +
> + if (w1_read_block(dev, (u8 *)&rn, 8) == 8 && rn)
> + cb(dev, rn);
> +
> + break;
> + }
> +#endif
> +
I would drop the CONFIG item and just add this "if" block to the search function
unconditionnaly. Unless I am missing something, it wouldn't hurt multi-slave setups...
> /* Start the search */
> w1_write_8(dev, search_type);
> for (i = 0; i < 64; ++i) {
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] w1: add fast search for single slave bus
2011-12-03 14:46 ` Jean-François Dagenais
@ 2011-12-04 16:46 ` Hubert Feurstein
2011-12-05 12:29 ` Evgeniy Polyakov
0 siblings, 1 reply; 7+ messages in thread
From: Hubert Feurstein @ 2011-12-04 16:46 UTC (permalink / raw)
To: zbr, jeff.dagenais; +Cc: linux-kernel, Hubert Feurstein
This enables a much more efficient way of device searching. It uses the
1-wire read-rom operation which allows the direct reading of the slave
address. BUT this works only with exactly one slave on the bus.
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
---
v2: remove config option
drivers/w1/w1.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index c374978..9761950 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -892,6 +892,16 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
break;
}
+ /* Do fast search on single slave bus */
+ if (dev->max_slave_count == 1) {
+ w1_write_8(dev, W1_READ_ROM);
+
+ if (w1_read_block(dev, (u8 *)&rn, 8) == 8 && rn)
+ cb(dev, rn);
+
+ break;
+ }
+
/* Start the search */
w1_write_8(dev, search_type);
for (i = 0; i < 64; ++i) {
--
1.7.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] w1: add fast search for single slave bus
2011-12-04 16:46 ` [PATCH v2] " Hubert Feurstein
@ 2011-12-05 12:29 ` Evgeniy Polyakov
2011-12-10 0:00 ` Greg KH
0 siblings, 1 reply; 7+ messages in thread
From: Evgeniy Polyakov @ 2011-12-05 12:29 UTC (permalink / raw)
To: Hubert Feurstein; +Cc: jeff.dagenais, linux-kernel, greg
Hi
On Sun, Dec 04, 2011 at 05:46:50PM +0100, Hubert Feurstein (h.feurstein@gmail.com) wrote:
> This enables a much more efficient way of device searching. It uses the
> 1-wire read-rom operation which allows the direct reading of the slave
> address. BUT this works only with exactly one slave on the bus.
Looks good to me, thank you!
Greg, please pull it into your tree
> Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
--
Evgeniy Polyakov
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] w1: add fast search for single slave bus
2011-12-05 12:29 ` Evgeniy Polyakov
@ 2011-12-10 0:00 ` Greg KH
2011-12-10 1:36 ` Evgeniy Polyakov
0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2011-12-10 0:00 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: Hubert Feurstein, jeff.dagenais, linux-kernel
On Mon, Dec 05, 2011 at 03:29:31PM +0300, Evgeniy Polyakov wrote:
> Hi
>
> On Sun, Dec 04, 2011 at 05:46:50PM +0100, Hubert Feurstein (h.feurstein@gmail.com) wrote:
> > This enables a much more efficient way of device searching. It uses the
> > 1-wire read-rom operation which allows the direct reading of the slave
> > address. BUT this works only with exactly one slave on the bus.
>
> Looks good to me, thank you!
> Greg, please pull it into your tree
Um, pull what? Can someone please send me the whole patch, as I can't
seem to find it anywhere, sorry.
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] w1: add fast search for single slave bus
2011-12-10 0:00 ` Greg KH
@ 2011-12-10 1:36 ` Evgeniy Polyakov
0 siblings, 0 replies; 7+ messages in thread
From: Evgeniy Polyakov @ 2011-12-10 1:36 UTC (permalink / raw)
To: Greg KH; +Cc: Hubert Feurstein, jeff.dagenais, linux-kernel
On Fri, Dec 09, 2011 at 04:00:54PM -0800, Greg KH (greg@kroah.com) wrote:
> Um, pull what? Can someone please send me the whole patch, as I can't
> seem to find it anywhere, sorry.
Forwarded
--
Evgeniy Polyakov
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-12-10 1:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-28 20:06 [PATCH] w1: add fast search for single slave bus Hubert Feurstein
2011-11-28 20:24 ` Evgeniy Polyakov
2011-12-03 14:46 ` Jean-François Dagenais
2011-12-04 16:46 ` [PATCH v2] " Hubert Feurstein
2011-12-05 12:29 ` Evgeniy Polyakov
2011-12-10 0:00 ` Greg KH
2011-12-10 1:36 ` Evgeniy Polyakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox