From: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
To: Jonathan Cameron
<jic23-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
Cc: "grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Pawel Moll <Pawel.Moll-5wv7dgnIgG8@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
Ian Campbell
<ian.campbell-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>,
Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org"
<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
Subject: Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
Date: Tue, 8 Oct 2013 09:47:48 +0100 [thread overview]
Message-ID: <20131008084748.GB28972@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <523DB3E6.3040804-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
On Sat, Sep 21, 2013 at 03:57:42PM +0100, Jonathan Cameron wrote:
> On 09/18/13 16:11, Grant Likely wrote:
> > On Wed, 18 Sep 2013 14:58:04 +0100, Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org> wrote:
> >> On Tue, Sep 17, 2013 at 02:48:41PM +0100, Lee Jones wrote:
> >>> On Tue, 17 Sep 2013, Mark Rutland wrote:
> >>>
> >>>> On Tue, Sep 17, 2013 at 01:07:30PM +0100, Lee Jones wrote:
> >>>>> On Tue, 17 Sep 2013, Mark Rutland wrote:
> >>>>>
> >>>>>> On Tue, Sep 17, 2013 at 09:10:03AM +0100, Lee Jones wrote:
> >>>>>>>>> http://marc.info/?l=linux-iio&m=137881790217809&w=2
> >>>>>>>> Looks reasonable. My only comment is '-' is preferred over '_'.
> >>>>>>> Ah, in the node name you mean. Yes, I can change that.
> >>>>>>>
> >>>>>>> The compatible string has to stay the same however, as it has to match
> >>>>>>> the device name which can't be changed due to possible userspace
> >>>>>>> breakage.
> >>>>>> I'm not sure I follow why the compatible string must be identical to the
> >>>>>> name appearing to userspace.
> >>>>> It doesn't. It has to be identical to the device name, which I'm
> >>>>> guessing is used when populating sysfs.
> >>>> I still don't understand why the device name must be identical to the
> >>>> compatible string.
> >>>>
> >>>> The string "st,lsm303dlh_magn" (with the "st," prefix) appears nowhere
> >>>> in v3.12-rc1
> >>> You're looking at an old patchset. We found out that the Snowball
> >>> schematic was actually incorrect and we have a LSM303DLHC.
> >>>
> >>> git grep -i lsm303dlhc_magn v3.12-rc1
> >>> drivers/iio/magnetometer/st_magn.h:
> >>> #define LSM303DLHC_MAGN_DEV_NAME "lsm303dlhc_magn"
> >>>
> >>>> and the compatible string in the dt doesn't seem to get
> >>>> assigned to the device in the i2c core or in
> >>>> drivers/iio/magnetometer/st_magn_i2c.c.
> >>> It does:
> >>> drivers/i2c/busses/*.c: of_i2c_register_devices();
> >>> drivers/of/of_i2c.c: |-> of_modalias_node();
> >>> |-> i2c_new_device();
> >> Ah, I see.
> >>
> >> I thought the return of of_modalias_node was only used to *guess* the
> >> module which might need to be loaded, rather than also being exposed to
> >> userspace as the device name.
> >>
> >> We've got a leak of Linux implementation details into the dt here, and I
> >> don't like it. Thanks to the combination of of_i2c_register device's use
> >> of of_modalias_node, and i2c_device_match using the id table after
> >> failing to use dt, any driver with a i2c_device_id name implicitly
> >> defines a dt binding for "${ARBITRARY_PREFIX},name". The same is true
> >> for SPI drivers using spi_device_id. This turns what looks like a Linux
> >> internal value into an ABI facing bootloader software.
> >>
> >> Judging by a quick and dirty grep [1], as of v3.12-rc1 there are ~930
> >> suffixes which *may* be accepted with an arbitrary prefix as an I2C
> >> compatible string, of which ~750 do not appear in
> >> Documentation/devicetree. For SPI there are just over 400, of which just
> >> under 400 aren't documented. Both these counts include drivers that may
> >> never be built for DT platforms, as I've not filtered the results.
> >>
> >> Some drivers have an of_match_table (e.g. i2c-hid has a single
> >> "hid-over-i2c" entry), but if the I2C core fails to match in the
> >> of_match_table it'll still carry on and match the stripped compatible
> >> against the i2c_device_id table (where it'll happily match
> >> "${VENDOR},hid"). I think if a driver has an of_match_table and we fail
> >> to match with of_match_device we should fail rather than falling back to
> >> the id table.
> >>
> >> In the i2c-hid case, I can't see how the "hid-over-i2c" variant can ever
> >> work -- of_i2c_register_devices will skip over devices where the
> >> compatible string doesn't contain a ','. So our documented compatible
> >> string isn't usable, while an undocumented one is...
> > I do appologies for the i2c of_modalias_node mess. At the time is was a
> > quick hack to make it each to bind nodes to i2c devices without changing
> > the drivers. At the time there wasn't much support for device tree. Now
> > it is just painfull.
> My understanding from this discussion is that we don't really have a way to
> back out the existing naming (with _ instead of the preferred -) from
> these bindings without breaking existing ABI.
>
> Hence, shall I apply the patches that at least document that the ABI we are
> stuck with? (e.g. http://www.spinics.net/lists/devicetree/msg04808.html
> [PATCH 07/20] Documentation: dt: iio: Add binding for LPS001WP )
It does seem like that's the only thing we can do here. Yes please.
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2013-10-08 8:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-14 12:07 All device tree bindings need maintainer ack or just the 'interesting' ones Jonathan Cameron
[not found] ` <52345182.1080609-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-09-16 16:17 ` Rob Herring
[not found] ` <52372F2B.3030504-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-17 8:10 ` Lee Jones
2013-09-17 11:24 ` Mark Rutland
[not found] ` <20130917112433.GB26737-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2013-09-17 12:07 ` Lee Jones
2013-09-17 13:30 ` Mark Rutland
[not found] ` <20130917133025.GD26737-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2013-09-17 13:48 ` Lee Jones
2013-09-18 13:58 ` Mark Rutland
[not found] ` <20130918135803.GG26737-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2013-09-18 15:05 ` Mark Brown
2013-09-18 15:11 ` Grant Likely
[not found] ` <20130918151119.59DB1C42CDF-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-09-21 14:57 ` Jonathan Cameron
[not found] ` <523DB3E6.3040804-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
2013-10-08 8:47 ` Mark Rutland [this message]
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=20131008084748.GB28972@e106331-lin.cambridge.arm.com \
--to=mark.rutland-5wv7dgnigg8@public.gmane.org \
--cc=Pawel.Moll-5wv7dgnIgG8@public.gmane.org \
--cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=ian.campbell-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org \
--cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=jic23-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org \
--cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
/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).