From: Andy Green <andy.green@linaro.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: stern@rowland.harvard.edu, linux-omap@vger.kernel.org,
keshava_mgowda@ti.com, linux-usb@vger.kernel.org, balbi@ti.com,
rogerq@ti.com
Subject: Re: [RFC PATCH 1/5] drivers : introduce device_path api
Date: Tue, 27 Nov 2012 07:47:58 +0800 [thread overview]
Message-ID: <50B3FFAE.9070401@linaro.org> (raw)
In-Reply-To: <20121126192206.GB11239@kroah.com>
On 11/27/2012 03:22 AM, the mail apparently from Greg KH included:
> On Mon, Nov 26, 2012 at 12:45:34PM +0000, Andy Green wrote:
>> This adds a small optional API into drivers/base which deals with generating,
>> matching and registration of wildcard device paths.
>>
>> >From a struct device * you can generate a string like
>>
>> /platform/usbhs_omap/ehci-omap.0/usb1/1-1
>>
>> which enapsulates the path of the device's connection to the board.
>>
>> These can be used to match up other assets, for example struct regulators,
>> that have been registed elsewhere with a device instance that is probed
>> asynchronously from the other board assets.
>>
>> If your device is on a bus, as it probably is, the device path will feature
>> redundant bus indexes that do not contain information about the connectivity.
>
> Huh? A bus "index" does show the connectivity, well, one type of
> connectivity, but perhaps it's not the one _you_ happen to want at the
> moment. Which is fine, but I don't see why you want to try to figure
> this out using the device path in the first place, surely you have some
> other way that the hardware can describe itself to the kernel as to
> where it needs to be hooked up to?
The bus index is like a counter, it shows logical connectivity inside
Linux that isn't repeatable and doesn't reflect hardware routing
information directly.
>> For example if more than one driver can generate devices on the same bus,
>> then the ordering of device probing will change the path, despite the
>> connectivity remains the same.
>
> That's an expected thing, I don't see the issue here.
Alan brought up in a thread here the last days, "wouldn't it be nice if
we could arbitrarily bind regulators to asynchronously probed objects",
and after discussion proposed this wildcard matching scheme to mask
these generated bus numbers.
>> For that reason, to get a deterministic path for matching, wildcards are
>> allowed. If your target device has the path
>
> Wait, no, why would you want a deterministic path and have that
> hard-coded into the kernel here? You can't rely on that any more than
> userspace can, so let's not start making the mistake that lots of
> userspace programmers originally did when they started using sysfs
> please. We have learned from our past mistakes.
I guess that is a fair point. I was going to say that it's no different
than using any kernel API in code, which history proves is very mutable;
people deal with it by changing the usages as they change the API
definition. But it's complicated a bit by DTs meant to be more stable
and these paths would turn up in the DT.
In "platform" case though, a heuristic that leaving off the initial /
and allowing matches anywhere along the path then to the end would get
around it.
>> /platform/usbhs_omap/ehci-omap.0/usb1/1-1
>>
>> generated, in the asset you wish to match with it you can instead use
>>
>> /platform/usbhs_omap/ehci-omap.0/usb*/*-1
>>
>> in order to only leave the useful, invariant parts of the path to match
>> against.
>>
>> To avoid having to adapt every kind of "search by string" api to also use
>> the wildcards, the api takes the approach you can register your wildcard,
>> and if a matching path is generated for a device, the wildcard itself is
>> handed back as the device path instead.
>>
>> So if your board code or a (not yet done) DT binding registers this wildcard
>>
>> /platform/usbhs_omap/ehci-omap.0/usb*
>
> Device tree lists sysfs paths in it's descriptions? That's news to me.
It does not say that...
>> and the usb hub driver asks to generate its device path
>>
>> device_path_generate(dev, name, sizeof name);
>>
>> that is actually
>>
>> /platform/usbhs_omap/ehci-omap.0/usb1
>>
>> then what will be returned is
>>
>> /platform/usbhs_omap/ehci-omap.0/usb*
>>
>> providing the same literal string for ehci-omap.0 hub no matter how many\
>> usb buses have been registered before.
>>
>> This wildcard string can then be matched to regulators or other string-
>> searchable assets intended for the device on that hardware path.
>
> Ah, here's the root of your problem, right? You need a way for your
> hardware to tell the kernel that you have a regulator attached to a
> specific device? Using the device path and hard-coding it into the
> kernel is not the proper way to solve this, sorry. Use some other
> unique way to describe the hardware, surely the hardware designers
> couldn't have been that foolish not to provide this [1]?
>
> thanks,
>
> greg k-h
>
> [1] Yeah, I know I'm being hopeful here, and probably wrong, but then
> you need to push back. We are not helpless here.
Specific hardware information is something that's kept hidden away and
private in the driver for good reasons.
We could add elective, additional information at the driver for every
physical interface it represented and match that way. But I am not sure
the effort involved is repaid by the relatively few instances that need
what is basically asynchronously probed platform_data.
-Andy
--
Andy Green | TI Landing Team Leader
Linaro.org │ Open source software for ARM SoCs | Follow Linaro
http://facebook.com/pages/Linaro/155974581091106 -
http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-11-26 23:48 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-26 12:45 [RFC PATCH 0/5] Device Paths introduced and applied to generic hub and panda Andy Green
2012-11-26 12:45 ` [RFC PATCH 1/5] drivers : introduce device_path api Andy Green
2012-11-26 19:12 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1211261348310.2168-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-26 23:26 ` Andy Green
[not found] ` <20121126124534.18106.44137.stgit-Ak/hGR4SqtBG2qbu2SEcwgC/G2K4zDHf@public.gmane.org>
2012-11-26 19:16 ` Greg KH
[not found] ` <20121126191612.GA11239-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-11-26 23:28 ` Andy Green
2012-11-26 19:22 ` Greg KH
2012-11-26 19:27 ` Greg KH
2012-11-26 21:07 ` Alan Stern
2012-11-26 22:50 ` Greg KH
[not found] ` <Pine.LNX.4.44L0.1211261555400.2168-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-27 0:02 ` Andy Green
[not found] ` <50B40320.2020206-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-27 16:37 ` Alan Stern
2012-11-27 17:44 ` Andy Green
[not found] ` <50B4FBE9.5080301-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-27 18:09 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1211271253230.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-27 19:22 ` Andy Green
2012-11-27 20:10 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1211271446430.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-28 2:30 ` Andy Green
[not found] ` <50B51313.2060003-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-28 11:13 ` Roger Quadros
2012-11-28 11:47 ` Andy Green
2012-11-28 12:45 ` Roger Quadros
2012-11-28 16:43 ` Alan Stern
2012-11-29 2:05 ` Ming Lei
2012-11-29 17:05 ` Alan Stern
2012-11-27 3:41 ` Ming Lei
2012-11-27 16:30 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1211271119380.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-27 17:02 ` Greg KH
2012-12-01 7:49 ` Jassi Brar
2012-12-01 8:37 ` Andy Green
[not found] ` <50B9C1B0.3080605-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-12-01 18:08 ` Jassi Brar
[not found] ` <CABb+yY3TC3z+jRU91KGX+FKLtJ3ZXUp55-wM_KjxiYuVZ+LL+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-05 14:09 ` Roger Quadros
[not found] ` <50BF55B3.1030205-l0cyMroinI0@public.gmane.org>
2012-12-06 14:34 ` Jassi Brar
2012-12-10 9:48 ` Roger Quadros
[not found] ` <50C5B003.9060904-l0cyMroinI0@public.gmane.org>
2012-12-10 14:36 ` Felipe Balbi
2012-12-11 9:12 ` Jassi Brar
[not found] ` <CABb+yY3u2QB0JqXrznDGHXqH3crkYk54whC0GTwkBHqjdEzhbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-11 10:01 ` Roger Quadros
[not found] ` <50C70495.40500-l0cyMroinI0@public.gmane.org>
2012-12-11 10:09 ` Felipe Balbi
2012-11-27 17:22 ` Ming Lei
2012-11-27 17:55 ` Andy Green
[not found] ` <50B4FE7D.9030505-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-27 23:06 ` Ming Lei
2012-11-28 1:16 ` Ming Lei
2012-11-26 23:47 ` Andy Green [this message]
[not found] ` <20121126123427.18106.4112.stgit-Ak/hGR4SqtBG2qbu2SEcwgC/G2K4zDHf@public.gmane.org>
2012-11-26 12:45 ` [RFC PATCH 2/5] usb: omap ehci: remove all regulator control from ehci omap Andy Green
2012-11-26 12:45 ` [RFC PATCH 3/5] usb: hub: add device_path regulator control to generic hub Andy Green
2012-11-26 19:23 ` Greg KH
2012-11-26 12:45 ` [RFC PATCH 4/5] omap4: panda: add smsc95xx regulator and reset dependent on root hub Andy Green
2012-11-26 16:20 ` Roger Quadros
2012-11-27 0:17 ` Andy Green
2012-11-26 12:45 ` [RFC PATCH 5/5] config omap2plus add ehci bits Andy Green
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=50B3FFAE.9070401@linaro.org \
--to=andy.green@linaro.org \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=keshava_mgowda@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rogerq@ti.com \
--cc=stern@rowland.harvard.edu \
/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;
as well as URLs for NNTP newsgroup(s).