devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* All device tree bindings need maintainer ack or just the 'interesting' ones.
@ 2013-09-14 12:07 Jonathan Cameron
       [not found] ` <52345182.1080609-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:07 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
	Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell, Lee Jones

Hi All,

I'm getting a lot of IIO related device tree bindings at the moment.
Most are pretty trivial e.g.

http://marc.info/?l=linux-iio&m=137881790217809&w=2

I know you are probably still working out how the device tree maintainership
is going to work in the long run, but in the meantime do you want me to hold
these on an Ack from one of the maintainers and/or to ensure that they are all posted
to devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org?

Really the question is do you want to be completely treated like any other subsystem,
where, if a driver touches it, in how ever trivial a fashion, the assumption is it
would be unwise to not attempt to get an Ack from the relevant maintainer.

There are plenty of more 'interesting' IIO binding questions out there and obviously
those need the input from the list and maintainers!

In the meantime, we'll send everything to devicetree-u79uwXL29TaiAVqoAR/hOA@public.gmane.org

Jonathan
--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
       [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>
  0 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2013-09-16 16:17 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell, Lee Jones

On 09/14/2013 07:07 AM, Jonathan Cameron wrote:
> Hi All,
> 
> I'm getting a lot of IIO related device tree bindings at the moment.
> Most are pretty trivial e.g.
> 
> http://marc.info/?l=linux-iio&m=137881790217809&w=2

Looks reasonable. My only comment is '-' is preferred over '_'.

> I know you are probably still working out how the device tree maintainership
> is going to work in the long run, but in the meantime do you want me to hold
> these on an Ack from one of the maintainers and/or to ensure that they are all posted
> to devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org?

I think if it is something self-contained to a node using existing
binding definitions and typically just a new compatible string like the
above case, then they don't need an ack. The main requirement in this
case is that compatible strings and other properties are documented. For
new or changes to common bindings, then they should be acked. If in
doubt, you can always require an ack on a case by case basis.

> Really the question is do you want to be completely treated like any other subsystem,
> where, if a driver touches it, in how ever trivial a fashion, the assumption is it
> would be unwise to not attempt to get an Ack from the relevant maintainer.
> 
> There are plenty of more 'interesting' IIO binding questions out there and obviously
> those need the input from the list and maintainers!
> 
> In the meantime, we'll send everything to devicetree-u79uwXL29TaiAVqoAR/hOA@public.gmane.org

That should always be the case whether we require an ack or not.

Rob

--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
       [not found]     ` <52372F2B.3030504-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-09-17  8:10       ` Lee Jones
  2013-09-17 11:24         ` Mark Rutland
  0 siblings, 1 reply; 12+ messages in thread
From: Lee Jones @ 2013-09-17  8:10 UTC (permalink / raw)
  To: Rob Herring
  Cc: Jonathan Cameron,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell

> > 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.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
  2013-09-17  8:10       ` Lee Jones
@ 2013-09-17 11:24         ` Mark Rutland
       [not found]           ` <20130917112433.GB26737-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Rutland @ 2013-09-17 11:24 UTC (permalink / raw)
  To: Lee Jones
  Cc: Rob Herring, Jonathan Cameron,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell

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.

Thanks,
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
       [not found]           ` <20130917112433.GB26737-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
@ 2013-09-17 12:07             ` Lee Jones
  2013-09-17 13:30               ` Mark Rutland
  0 siblings, 1 reply; 12+ messages in thread
From: Lee Jones @ 2013-09-17 12:07 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Rob Herring, Jonathan Cameron,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell

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.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
  2013-09-17 12:07             ` Lee Jones
@ 2013-09-17 13:30               ` Mark Rutland
       [not found]                 ` <20130917133025.GD26737-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Rutland @ 2013-09-17 13:30 UTC (permalink / raw)
  To: Lee Jones
  Cc: Rob Herring, Jonathan Cameron,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell

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, 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.

I don't see how the "st,lsm303dlh_magn" string could be getting to
userspace already such that it could be relying on it.

Am I missing something?

Thanks,
Mark.

> 
> -- 
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
> 
--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
       [not found]                 ` <20130917133025.GD26737-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
@ 2013-09-17 13:48                   ` Lee Jones
  2013-09-18 13:58                     ` Mark Rutland
  0 siblings, 1 reply; 12+ messages in thread
From: Lee Jones @ 2013-09-17 13:48 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Rob Herring, Jonathan Cameron,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell

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();

> I don't see how the "st,lsm303dlh_magn" string could be getting to
> userspace already such that it could be relying on it.
> 
> Am I missing something?
> 
> Thanks,
> Mark.
> 
> > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
  2013-09-17 13:48                   ` Lee Jones
@ 2013-09-18 13:58                     ` Mark Rutland
       [not found]                       ` <20130918135803.GG26737-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Rutland @ 2013-09-18 13:58 UTC (permalink / raw)
  To: Lee Jones
  Cc: Rob Herring, Jonathan Cameron,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	Wolfram Sang, Mark Brown,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org

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...

We don't appear to have any clashes yet (with "vendor-a,device" and
"vendor-b,device"), so maybe that's not an issue -- we can add
of_match_table entries as required to disambiguate, though we have to be
careful to capture all the prefixes already in use.

The current use of of_modalias_node also only allows for the first entry
in the compatible list to be used to request a compatible module.  I
think it would be better for the DT core to request modules somehow when
iterating over compatible lists, but I'm not familiar with
MODULE_DEVICE_TABLE() and friends, so maybe that's not as easy as it
sounds. That doesn't solve exporting a sensible modalias to userspace,
but it would somewhat decouple the compatible list and modaliases, and
allow for fallback entries in the compatible list to load modules if
required.

I see that some macintosh drivers have i2c_device_id values in device
tree style (e.g. "MAC,fcu"), without an of_match_table. Assuming that
"MAC,fcu" is the full string rather than "AAPL,MAC,fcu", I don't see how
those get matched to drivers. The I2C core will drop the leading "MAC,",
leaving only "fcu" in the i2c_board_info, and then that won't match any
driver modaliases. I'm probably missing something here.

Thanks,
Mark.

[1] $ git grep -hW i2c_device_id.\*= -- drivers | grep {.\*} | 
      grep -o "\"[^\"]\+\"" | grep -o "[^\"]\+" | sort -u |
      xargs -I '{}' sh -c 'git grep -q "{}" -- Documentation/devicetree ||
      echo Undocumented binding \"*,{}\"'
--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
       [not found]                       ` <20130918135803.GG26737-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
@ 2013-09-18 15:05                         ` Mark Brown
  2013-09-18 15:11                         ` Grant Likely
  1 sibling, 0 replies; 12+ messages in thread
From: Mark Brown @ 2013-09-18 15:05 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Lee Jones, Rob Herring, Jonathan Cameron,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	Wolfram Sang,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org

[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]

On Wed, Sep 18, 2013 at 02:58:04PM +0100, Mark Rutland wrote:

[Devices matching the Linux internal devices name as a compatible value]

> 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.

Personally I've always viewed this as being an attempt to be liberal in
what we accept with regard to buggy device trees rather than anything
else (and I do push back on DT bindings that don't include setting a
proper match table up).  For all practical purposes it should generally
come up with the right answer.

> We don't appear to have any clashes yet (with "vendor-a,device" and
> "vendor-b,device"), so maybe that's not an issue -- we can add
> of_match_table entries as required to disambiguate, though we have to be
> careful to capture all the prefixes already in use.

There are some chip naming clashes out there - both Wondermedia and
Wolfson use WMxxxx and there are reused numbers for example - but it's
not common and generally bus types will disambiguate).

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
       [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>
  1 sibling, 1 reply; 12+ messages in thread
From: Grant Likely @ 2013-09-18 15:11 UTC (permalink / raw)
  To: Mark Rutland, Lee Jones
  Cc: Rob Herring, Jonathan Cameron,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell, Wolfram Sang, Mark Brown,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org

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.
--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
       [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>
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Cameron @ 2013-09-21 14:57 UTC (permalink / raw)
  To: Grant Likely
  Cc: Mark Rutland, Lee Jones, Rob Herring, Jonathan Cameron,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell, Wolfram Sang, Mark Brown,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org

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 )

Jonathan


--
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: All device tree bindings need maintainer ack or just the 'interesting' ones.
       [not found]                               ` <523DB3E6.3040804-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
@ 2013-10-08  8:47                                 ` Mark Rutland
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Rutland @ 2013-10-08  8:47 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, Lee Jones,
	Rob Herring, Jonathan Cameron,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Stephen Warren, Ian Campbell, Wolfram Sang, Mark Brown,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-10-08  8:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).