From: "Jean-François Dagenais" <jeff.dagenais@gmail.com>
To: Hubert Feurstein <h.feurstein@gmail.com>
Cc: Evgeniy Polyakov <zbr@ioremap.net>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] w1: add fast search for single slave bus
Date: Sat, 3 Dec 2011 09:46:29 -0500 [thread overview]
Message-ID: <258EF057-8FF6-4432-A9E5-77F87607C45F@gmail.com> (raw)
In-Reply-To: <1322510807-3247-1-git-send-email-h.feurstein@gmail.com>
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/
next prev parent reply other threads:[~2011-12-03 14:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-28 20:06 Hubert Feurstein
2011-11-28 20:24 ` Evgeniy Polyakov
2011-12-03 14:46 ` Jean-François Dagenais [this message]
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
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=258EF057-8FF6-4432-A9E5-77F87607C45F@gmail.com \
--to=jeff.dagenais@gmail.com \
--cc=h.feurstein@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zbr@ioremap.net \
/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®