From: Matthew Frost <artusemrys@sbcglobal.net>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Paul Sokolovsky <pmiscml@gmail.com>,
Jiri Slaby <jirislaby@gmail.com>,
linux-kernel@vger.kernel.org, Adrian Bunk <bunk@stusta.de>,
Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Subject: Re: Where did find_bus() go in 2.6.18?
Date: Tue, 21 Nov 2006 12:29:15 -0600 [thread overview]
Message-ID: <4563457B.2070806@sbcglobal.net> (raw)
In-Reply-To: <1164011675.31358.566.camel@laptopd505.fenrus.org>
Arjan van de Ven wrote:
> On Mon, 2006-11-20 at 02:13 +0200, Paul Sokolovsky wrote:
>> Hello Jiri,
>>
>> Monday, November 20, 2006, 1:45:51 AM, you wrote:
>>
>>> Paul Sokolovsky wrote:
>>>> But alas, the commit message is not as good as some others are, and
>>>> doesn't mention what should be used instead. So, if find_bus() is
>>>> "unused", what should be used instead?
>>> You should probably mention what for?
>> Indeed, I'm sorry! Looking at find_bus()'s docstring:
>>
>> /**
>> * find_bus - locate bus by name.
>> * @name: name of bus.
>>
>> So well, I'd like to know exactly that - what function should be
>> used instead of find_bus() to locate bus by name.
>
> I think the question more was "what do you need to look up a bus by name
> for in the kernel"? Like.. what are you trying to achieve? What module
> is this for? (does it have a homepage where people can download the
> source etc so that they can give you a more informed answer)....
>
>
Arjan has a great point, and it's been mentioned elsewhere in this thread, too.
Maybe I can help get us there. Since you've already started to explain
(ignoring your non-sequitur on the development process):
----
Ok, so the situation is following: we have a kind of multi-layered
driver here. Lowest level is a w1_slave bus driver, talking to a
specific chip and providing low-level API for accessing data in terms
of this chip (or chip class) notions. Above it, we have higher-level
driver which interprets data from the low-level one, converting it to
a standard device-independent form, plus possibly does some other
minor things, like providing feedback indication on these data.
(Forgot to say that this is battery driver.)
So, just in case if some reader of this has quick suggestion of
merging these drivers into one, thanks, but they do different things,
and we want to keep them nicely decoupled. But now issue of how these
drivers talk between themselves raises, and that's exactly the grief
point.
High-level driver used to find w1 bus by name, then enumerate
devices on the bus, to find compatible device on it, then hooks into
that device and its driver.
So, you see the issue: we cannot enumerate devices on w1 bus. (And
yes, w1_bus_type is not exported).
Sure, the source is up:
http://handhelds.org/cgi-bin/cvsweb.cgi/linux/kernel26/drivers/misc/h2200_battery.c?rev=1.20&content-type=text/x-cvsweb-markup
----
So you have nested drivers. The bottom driver (w1/slaves/w1_ds2760.c) talks to
the hardware, and the top driver (misc/h2200_battery.c) interprets the output.
You're dealing with a Dallas 1-Wire Bus protocol to talk to your battery
management chip, which is a DS2760 High-Precision Li+ Battery Monitor. You're
telling us that h2200_battery uses find_bus() to locate the w1 bus and then the
devices on that bus, so that it can use w1_ds2760 to read the chip. So what is
hanging you up here is that your top-level driver can't find the bus that the
chip is on; once it can, everything should work?
The specific code:
void
h2200_battery_probe_work(void *data)
{
struct bus_type *bus;
/* Get the battery w1 slave device. */
bus = find_bus("w1");
if (bus)
ds2760_dev = bus_find_device(bus, NULL, NULL,
h2200_battery_match_callback);
if (!ds2760_dev) {
/* No DS2760 device found; try again later. */
queue_delayed_work(probe_q, &probe_work, HZ * 5);
return;
}
}
What we need to do is help you find a better way to locate and identify a w1 device.
(cc: E. Polyakov for the w1 expertise)
Matt
next prev parent reply other threads:[~2006-11-21 18:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-19 22:34 Where did find_bus() go in 2.6.18? Paul Sokolovsky
2006-11-19 23:45 ` Jiri Slaby
2006-11-20 0:12 ` Greg KH
2006-11-20 14:13 ` Re[2]: " Paul Sokolovsky
2006-11-20 17:35 ` Adrian Bunk
2006-11-21 15:08 ` Re[2]: " Paul Sokolovsky
2006-11-21 15:16 ` Arjan van de Ven
2006-11-21 18:04 ` Adrian Bunk
2006-11-21 7:54 ` Greg KH
2006-11-22 8:36 ` Re[2]: " Paul Sokolovsky
2006-11-21 19:02 ` Dmitry Torokhov
2006-11-20 0:13 ` Paul Sokolovsky
2006-11-20 8:34 ` Arjan van de Ven
2006-11-21 18:29 ` Matthew Frost [this message]
2006-11-21 19:01 ` Evgeniy Polyakov
2006-11-21 19:41 ` Re[2]: " Paul Sokolovsky
2006-11-21 20:34 ` Matthew Frost
2006-11-20 9:35 ` pHilipp Zabel
-- strict thread matches above, loose matches on Subject: below --
2006-11-21 14:15 Al Boldi
2006-11-21 14:32 ` Arjan van de Ven
2006-11-22 14:18 ` Al Boldi
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=4563457B.2070806@sbcglobal.net \
--to=artusemrys@sbcglobal.net \
--cc=arjan@infradead.org \
--cc=bunk@stusta.de \
--cc=jirislaby@gmail.com \
--cc=johnpol@2ka.mipt.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=pmiscml@gmail.com \
/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