mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hubert Feurstein <h.feurstein@gmail.com>
To: zbr@ioremap.net, jeff.dagenais@gmail.com
Cc: linux-kernel@vger.kernel.org, Hubert Feurstein <h.feurstein@gmail.com>
Subject: [PATCH v2] w1: add fast search for single slave bus
Date: Sun,  4 Dec 2011 17:46:50 +0100	[thread overview]
Message-ID: <1323017210-14666-1-git-send-email-h.feurstein@gmail.com> (raw)
In-Reply-To: <258EF057-8FF6-4432-A9E5-77F87607C45F@gmail.com>

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


  reply	other threads:[~2011-12-04 16:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-28 20:06 [PATCH] " Hubert Feurstein
2011-11-28 20:24 ` Evgeniy Polyakov
2011-12-03 14:46 ` Jean-François Dagenais
2011-12-04 16:46   ` Hubert Feurstein [this message]
2011-12-05 12:29     ` [PATCH v2] " 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=1323017210-14666-1-git-send-email-h.feurstein@gmail.com \
    --to=h.feurstein@gmail.com \
    --cc=jeff.dagenais@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®