Skip to contentSkip to conversation

iio: ad5770r: make devicetree property reading consistent

PATCH Superseded Nuno Sá 4 participants 14 messages Aug 11, 2021 – Aug 16, 2021 1 message not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nuno Sá

author maintainer
#0 lore raw

PATCH 1/1 iio: ad5770r: make devicetree property reading consistent

The bindings file for this driver is defining the property as 'reg' but the driver was reading it with the 'num' name. This patches makes the driver consistent with what is defined in the bindings.

---
 drivers/iio/dac/ad5770r.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5770r.c +1 -1
index 8107f7bbbe3c..7e2fd32e993a 100644
@@ -522,7 +522,7 @@ static int ad5770r_channel_config(struct ad5770r_state *st)
 		return -EINVAL;
 
 	device_for_each_child_node(&st->spi->dev, child) {
-		ret = fwnode_property_read_u32(child, "num", &num);
+		ret = fwnode_property_read_u32(child, "reg", &num);
 		if (ret)
 			goto err_child_out;
 		if (num >= AD5770R_MAX_CHANNELS) {
Signature · 1 line
2.32.0
#1 lore raw
Quoted 3 lines · Nuno Sá

The bindings file for this driver is defining the property as 'reg' but the driver was reading it with the 'num' name. This patches makes the

"This patches makes the..." --> "Make the..."

Quoted 1 line

driver consistent with what is defined in the bindings.

While it seems okay, it may be now a chicken-egg issue (somebody created a DT with "num" property).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#2 lore raw
Quoted 15 lines

From: Andy Shevchenko <[email protected]>
Sent: Wednesday, August 11, 2021 6:04 PM
To: Sa, Nuno <[email protected]>
Cc: linux-iio <[email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property reading consistent

Quoted 3 lines · Nuno Sá

The bindings file for this driver is defining the property as 'reg' but the driver was reading it with the 'num' name. This patches makes

Quoted 9 lines

the

"This patches makes the..." --> "Make the..."

Quoted 1 line

driver consistent with what is defined in the bindings.

While it seems okay, it may be now a chicken-egg issue (somebody created a DT with "num" property).

Arghh, I see. Well, maybe let's go the other way around and change the bindings doc to 'num'?

- Nuno Sá

A message that is not in the archive (sent off-list or not yet received): CAHp75VeZLKN0C_+PopKfYtPMqEzGLd4paSKYnrHr1B2Y1Nk9=w@mail.gmail.com

author maintainer
#4 lore raw
Quoted 54 lines

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Thursday, August 12, 2021 9:06 AM
To: Sa, Nuno <[email protected]>
Cc: linux-iio <[email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property reading consistent

On Thursday, August 12, 2021, Sa, Nuno <[email protected] <mailto:[email protected]> > wrote:

> From: Andy Shevchenko <[email protected]
<mailto:[email protected]> >

	> Sent: Wednesday, August 11, 2021 6:04 PM
	> To: Sa, Nuno <[email protected]
<mailto:[email protected]> >
	> Cc: linux-iio <[email protected] <mailto:linux-
[email protected]> >; Jonathan Cameron
	> <[email protected] <mailto:[email protected]> >; Hennerich,

Michael
> <[email protected]
<mailto:[email protected]> >; Lars-Peter Clausen
> <[email protected] <mailto:[email protected]> >
> Subject: Re: [PATCH] iio: ad5770r: make devicetree property
reading

	> consistent
	>
	> On Wed, Aug 11, 2021 at 10:46 AM Nuno Sá
<[email protected] <mailto:[email protected]> >
	> wrote:
	> >
	> > The bindings file for this driver is defining the property as
'reg' but
	> > the driver was reading it with the 'num' name. This patches
makes
	> the
	>
	> "This patches makes the..." --> "Make the..."
	>
	> > driver consistent with what is defined in the bindings.
	>
	> While it seems okay, it may be now a chicken-egg issue

(somebody
> created a DT with "num" property). >

Quoted 6 lines

Arghh, I see. Well, maybe let's go the other way around and
change the
bindings doc to 'num'?

Not sure, like I said it’s a chicken-egg issue. Consult with Rob perhaps?

Hi Rob,

Could you give your input on this one?

Thanks!
- Nuno Sá

#5 lore raw
Quoted 60 lines · Nuno
Quoted 60 lines

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Thursday, August 12, 2021 9:06 AM
To: Sa, Nuno <[email protected]>
Cc: linux-iio <[email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property reading consistent

On Thursday, August 12, 2021, Sa, Nuno <[email protected] <mailto:[email protected]> > wrote:

> From: Andy Shevchenko <[email protected]
<mailto:[email protected]> >
> Sent: Wednesday, August 11, 2021 6:04 PM
> To: Sa, Nuno <[email protected]
<mailto:[email protected]> >
> Cc: linux-iio <[email protected] <mailto:linux-
[email protected]> >; Jonathan Cameron

      > <[email protected] <mailto:[email protected]> >; Hennerich,

Michael
> <[email protected]
<mailto:[email protected]> >; Lars-Peter Clausen
> <[email protected] <mailto:[email protected]> >
> Subject: Re: [PATCH] iio: ad5770r: make devicetree property
reading

      > consistent
      >
      > On Wed, Aug 11, 2021 at 10:46 AM Nuno Sá

<[email protected] <mailto:[email protected]> >
> wrote:
> >
> > The bindings file for this driver is defining the property as
'reg' but
> > the driver was reading it with the 'num' name. This patches
makes

      > the
      >
      > "This patches makes the..." --> "Make the..."
      >
      > > driver consistent with what is defined in the bindings.
      >
      > While it seems okay, it may be now a chicken-egg issue

(somebody
> created a DT with "num" property). >

Arghh, I see. Well, maybe let's go the other way around and
change the
bindings doc to 'num'?

Quoted 5 lines
Quoted 1 line

Not sure, like I said it’s a chicken-egg issue. Consult with Rob perhaps?

Hi Rob,

Could you give your input on this one?

There's no context, but I'm assuming this is in channel nodes. Keep the binding 'reg' and make the driver support both if needed. Considering the author of the binding also changed the binding from num to reg shortly after adding the binding, I don't think 'num' support is needed. If someone used 'num' and didn't run validation, well, that's their problem.

Rob

author maintainer
#6 lore raw
Quoted 76 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Thursday, August 12, 2021 5:11 PM
To: Sa, Nuno <[email protected]>
Cc: Andy Shevchenko <[email protected]>; linux-iio <[email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property reading consistent

Quoted 12 lines · Nuno
Quoted 12 lines

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Thursday, August 12, 2021 9:06 AM
To: Sa, Nuno <[email protected]>
Cc: linux-iio <[email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property

reading

Quoted 48 lines
Quoted 48 lines

consistent

On Thursday, August 12, 2021, Sa, Nuno <[email protected] <mailto:[email protected]> > wrote:

> From: Andy Shevchenko <[email protected]
<mailto:[email protected]> >
> Sent: Wednesday, August 11, 2021 6:04 PM
> To: Sa, Nuno <[email protected]
<mailto:[email protected]> >
> Cc: linux-iio <[email protected] <mailto:linux-
[email protected]> >; Jonathan Cameron

      > <[email protected] <mailto:[email protected]> >; Hennerich,

Michael
> <[email protected]
<mailto:[email protected]> >; Lars-Peter Clausen
> <[email protected] <mailto:[email protected]> >
> Subject: Re: [PATCH] iio: ad5770r: make devicetree property
reading

      > consistent
      >
      > On Wed, Aug 11, 2021 at 10:46 AM Nuno Sá

<[email protected] <mailto:[email protected]> >
> wrote:
> >
> > The bindings file for this driver is defining the property as
'reg' but
> > the driver was reading it with the 'num' name. This patches
makes

      > the
      >
      > "This patches makes the..." --> "Make the..."
      >
      > > driver consistent with what is defined in the bindings.
      >
      > While it seems okay, it may be now a chicken-egg issue

(somebody
> created a DT with "num" property). >

Arghh, I see. Well, maybe let's go the other way around and
change the
bindings doc to 'num'?

Quoted 8 lines
Quoted 1 line
Quoted 1 line

Not sure, like I said it’s a chicken-egg issue. Consult with Rob

perhaps?

Quoted 4 lines

Hi Rob,

Could you give your input on this one?

There's no context, but I'm assuming this is in channel nodes. Keep

Sorry about that. Your assumption is correct, the binding is for a channel node [1]. The driver just get's it as 'num' [2] which is not consistent. Naively, I just though changing the driver to use reg would be enough but Andy nicely raised the question of someone being already relying on 'num'...

Quoted 6 lines

the binding 'reg' and make the driver support both if needed. Considering the author of the binding also changed the binding from num to reg shortly after adding the binding, I don't think 'num' support is needed. If someone used 'num' and didn't run validation, well, that's their problem.

So I guess the solution here is just to change the driver to support both reg and num.

[1]: https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml#L67
[2]: https://elixir.bootlin.com/linux/latest/source/drivers/iio/dac/ad5770r.c#L525

- Nuno Sá

Reviewed-by
#7 lore raw
Quoted 4 lines · Nuno
Quoted 4 lines

From: Rob Herring <[email protected]>
Sent: Thursday, August 12, 2021 5:11 PM
On Thu, Aug 12, 2021 at 3:14 AM Sa, Nuno <[email protected]> wrote:

...

Quoted 17 lines
Quoted 3 lines
Quoted 1 line

Could you give your input on this one?

There's no context, but I'm assuming this is in channel nodes. Keep

Sorry about that. Your assumption is correct, the binding is for a channel node [1]. The driver just get's it as 'num' [2] which is not consistent. Naively, I just though changing the driver to use reg would be enough but Andy nicely raised the question of someone being already relying on 'num'...

Quoted 6 lines

the binding 'reg' and make the driver support both if needed. Considering the author of the binding also changed the binding from num to reg shortly after adding the binding, I don't think 'num' support is needed. If someone used 'num' and didn't run validation, well, that's their problem.

Quoted 2 lines

So I guess the solution here is just to change the driver to support both reg and num.

As far as I got Rob's answer, if the binding never had the 'num', dropping it from the driver is what we want now (actually your original patch) and users, who are 'too much clever' :-) should have had run validation for their DTs before production.

Taking this into account, I'm fine with the patch (but update a commit message to summarize this discussion)

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#8 lore raw
Quoted 47 lines

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Friday, August 13, 2021 10:05 AM
To: Sa, Nuno <[email protected]>
Cc: Rob Herring <[email protected]>; linux-iio <linux- [email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property reading consistent

Quoted 4 lines · Nuno
Quoted 4 lines

From: Rob Herring <[email protected]>
Sent: Thursday, August 12, 2021 5:11 PM
On Thu, Aug 12, 2021 at 3:14 AM Sa, Nuno <[email protected]> wrote:

...

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Could you give your input on this one?

There's no context, but I'm assuming this is in channel nodes. Keep

Sorry about that. Your assumption is correct, the binding is for a

channel

Quoted 2 lines

node [1]. The driver just get's it as 'num' [2] which is not consistent. Naively, I just though changing the driver to use reg would be

enough

Quoted 5 lines

but Andy nicely raised the question of someone being already relying on 'num'...

Quoted 2 lines

the binding 'reg' and make the driver support both if needed. Considering the author of the binding also changed the binding

from

Quoted 2 lines
Quoted 2 lines

num to reg shortly after adding the binding, I don't think 'num' support is needed. If someone used 'num' and didn't run

validation,

Quoted 4 lines
Quoted 2 lines

well, that's their problem.

So I guess the solution here is just to change the driver to support

both

Quoted 1 line

reg and num.

Quoted 9 lines

As far as I got Rob's answer, if the binding never had the 'num', dropping it from the driver is what we want now (actually your original patch) and users, who are 'too much clever' :-) should have had run validation for their DTs before production.

Taking this into account, I'm fine with the patch (but update a commit message to summarize this discussion)

You're right...
Jonathan, do you want a v2 with an updated commit message?

- Nuno Sá

maintainer
#9 lore raw
Quoted 50 lines · Nuno
Quoted 50 lines

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Friday, August 13, 2021 10:05 AM
To: Sa, Nuno <[email protected]>
Cc: Rob Herring <[email protected]>; linux-iio <linux- [email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property reading consistent

Quoted 4 lines · Nuno
Quoted 4 lines

From: Rob Herring <[email protected]>
Sent: Thursday, August 12, 2021 5:11 PM
On Thu, Aug 12, 2021 at 3:14 AM Sa, Nuno <[email protected]> wrote:

...

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Could you give your input on this one?

There's no context, but I'm assuming this is in channel nodes. Keep

Sorry about that. Your assumption is correct, the binding is for a

channel

Quoted 2 lines

node [1]. The driver just get's it as 'num' [2] which is not consistent. Naively, I just though changing the driver to use reg would be

enough

Quoted 5 lines

but Andy nicely raised the question of someone being already relying on 'num'...

Quoted 2 lines

the binding 'reg' and make the driver support both if needed. Considering the author of the binding also changed the binding

from

Quoted 2 lines
Quoted 2 lines

num to reg shortly after adding the binding, I don't think 'num' support is needed. If someone used 'num' and didn't run

validation,

Quoted 4 lines
Quoted 2 lines

well, that's their problem.

So I guess the solution here is just to change the driver to support

both

Quoted 1 line

reg and num.

As far as I got Rob's answer, if the binding never had the 'num', dropping it from the driver is what we want now (actually your original patch) and users, who are 'too much clever' :-) should have had run validation for their DTs before production.

Quoted 7 lines
Quoted 4 lines

Taking this into account, I'm fine with the patch (but update a commit message to summarize this discussion)

You're right...
Jonathan, do you want a v2 with an updated commit message?

Please do. Also please add a fixes tag given we are treating it as a fix. If we discover someone is using the num variant then we'll just have to support both values as a fix to the fix. Not ideal, but as observed, hopefully people are validating the DTs (which basically means no one is using this in production or it would have been pointed out before).

Jonathan

Quoted 2 lines

- Nuno Sá

author maintainer
#10 lore raw
Quoted 82 lines

-----Original Message-----
From: Jonathan Cameron <[email protected]>
Sent: Saturday, August 14, 2021 6:04 PM
To: Sa, Nuno <[email protected]>
Cc: Andy Shevchenko <[email protected]>; Rob Herring <[email protected]>; linux-iio <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property reading consistent

[External]

Quoted 9 lines · Nuno
Quoted 9 lines

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Friday, August 13, 2021 10:05 AM
To: Sa, Nuno <[email protected]>
Cc: Rob Herring <[email protected]>; linux-iio <linux- [email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property

reading

Quoted 7 lines
Quoted 7 lines

consistent

Quoted 3 lines · Nuno
Quoted 3 lines

From: Rob Herring <[email protected]>
Sent: Thursday, August 12, 2021 5:11 PM
On Thu, Aug 12, 2021 at 3:14 AM Sa, Nuno

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

wrote:

...

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Could you give your input on this one?

There's no context, but I'm assuming this is in channel nodes.

Keep

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Sorry about that. Your assumption is correct, the binding is for a

channel

Quoted 1 line

node [1]. The driver just get's it as 'num' [2] which is not

consistent.

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Naively, I just though changing the driver to use reg would be

enough

Quoted 1 line

but Andy nicely raised the question of someone being already

relying

Quoted 13 lines
Quoted 13 lines
Quoted 4 lines

on 'num'...

Quoted 2 lines

the binding 'reg' and make the driver support both if needed. Considering the author of the binding also changed the binding

from

Quoted 2 lines
Quoted 2 lines

num to reg shortly after adding the binding, I don't think 'num' support is needed. If someone used 'num' and didn't run

validation,

Quoted 4 lines
Quoted 2 lines

well, that's their problem.

So I guess the solution here is just to change the driver to support

both

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

reg and num.

As far as I got Rob's answer, if the binding never had the 'num', dropping it from the driver is what we want now (actually your original patch) and users, who are 'too much clever' :-) should have had run validation for their DTs before production.

Taking this into account, I'm fine with the patch (but update a

commit

Quoted 6 lines
Quoted 3 lines

message to summarize this discussion)

You're right...
Jonathan, do you want a v2 with an updated commit message?

Quoted 7 lines

Please do. Also please add a fixes tag given we are treating it as a fix. If we discover someone is using the num variant then we'll just have to support both values as a fix to the fix. Not ideal, but as observed, hopefully people are validating the DTs (which basically means no one is using this in production or it would have been pointed out before).

Well, It seems we need to go through the support both 'num' and 'reg' route... I did some git blaming and it turns out 'num' was actually supported in the bindings [1]. After some time it was replaced by 'reg' [2] leaving the driver unchanged... I guess we have a significant window of time here where someone could deploy a *validated* devicetree using 'num'... If no objections, on v2 I will just try to get 'reg' and if not present, fallback to 'num' before erroring out.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ea52c21268e68cfdc1aabe686b154d73d8bf4d7e
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2cf3818f18b26992ff20a730df46e08e2485fd67

- Nuno Sá

#11 lore raw

On Mon, Aug 16, 2021 at 10:54 AM Sa, Nuno <[email protected]> wrote:

...

Quoted 7 lines

Well, It seems we need to go through the support both 'num' and 'reg' route... I did some git blaming and it turns out 'num' was actually supported in the bindings [1]. After some time it was replaced by 'reg' [2] leaving the driver unchanged... I guess we have a significant window of time here where someone could deploy a *validated* devicetree using 'num'... If no objections, on v2 I will just try to get 'reg' and if not present, fallback to 'num' before erroring out.

Ouch, thanks for digging this out!

So, it means the following:
1) add "num" as _obsolete_ property to DT bindings
2) add support of "reg" to the driver

Quoted 2 lines

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ea52c21268e68cfdc1aabe686b154d73d8bf4d7e
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2cf3818f18b26992ff20a730df46e08e2485fd67

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#12 lore raw
Quoted 42 lines

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Monday, August 16, 2021 10:10 AM
To: Sa, Nuno <[email protected]>
Cc: Jonathan Cameron <[email protected]>; Rob Herring <[email protected]>; linux-iio <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property reading consistent

On Mon, Aug 16, 2021 at 10:54 AM Sa, Nuno <[email protected]> wrote:

...

Quoted 1 line

Well, It seems we need to go through the support both 'num' and

'reg'

Quoted 1 line

route... I did some git blaming and it turns out 'num' was actually

supported

Quoted 1 line

in the bindings [1]. After some time it was replaced by 'reg' [2]

leaving the

Quoted 1 line

driver unchanged... I guess we have a significant window of time

here

Quoted 2 lines

where someone could deploy a *validated* devicetree using 'num'... If no objections, on v2 I will just try to get 'reg' and if not present,

fallback

Quoted 1 line

to 'num' before erroring out.

Ouch, thanks for digging this out!

So, it means the following:
1) add "num" as _obsolete_ property to DT bindings
2) add support of "reg" to the driver

Quoted 1 line

[1]:

https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/k
ernel/git/torvalds/linux.git/commit/?id=ea52c21268e68cfdc1aabe686b 154d73d8bf4d7e__;!!A3Ni8CS0y2Y!pXYlkekser2PGbqrJZWpCXQ0oxp4 OUNdOpRl03X9jRhgrj-jPaE_WB7hsAWEAA$

Quoted 8 lines
Quoted 1 line

[2]:

https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/k
ernel/git/torvalds/linux.git/commit/?id=2cf3818f18b26992ff20a730df4 6e08e2485fd67__;!!A3Ni8CS0y2Y!pXYlkekser2PGbqrJZWpCXQ0oxp4O UNdOpRl03X9jRhgrj-jPaE_WB7e_v1D4g$

--
With Best Regards,

Hi Rob,

As Andy suggested I'm trying to add the 'num' property back to the bindings with a 'deprecated: true' value for the property. I was trying to get something like (the main idea is to have either ref or num defined):

channel@0:
...
properties:
- oneof:
- reg:
...
- num:
/* not sure if it makes sense to give the same values (description and possible values)
as for 'reg' */
deprecated: true

However, I'm failing to get pass through validations. Is there a way to make this a oneOf as I'm trying to? I'm feeling that these channel nodes should have a required key where we could use oneOf

Moreover, it seems that the validation enforces the 'reg' or 'ranges' for channel nodes like this (maybe the fix [1] was actually because of this) so I wonder about my statement of anyone having "validated" devicetrees with the old 'num' property...

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2cf3818f18b26992ff20a730df46e08e2485fd67
- Nuno Sá

#13 lore raw
In reply to Sa, Nuno
Quoted 91 lines · Nuno
Quoted 83 lines

-----Original Message-----
From: Jonathan Cameron <[email protected]>
Sent: Saturday, August 14, 2021 6:04 PM
To: Sa, Nuno <[email protected]>
Cc: Andy Shevchenko <[email protected]>; Rob Herring <[email protected]>; linux-iio <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property reading consistent

[External]

Quoted 9 lines · Nuno
Quoted 9 lines

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Friday, August 13, 2021 10:05 AM
To: Sa, Nuno <[email protected]>
Cc: Rob Herring <[email protected]>; linux-iio <linux- [email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property

reading

Quoted 7 lines
Quoted 7 lines

consistent

Quoted 3 lines · Nuno
Quoted 3 lines

From: Rob Herring <[email protected]>
Sent: Thursday, August 12, 2021 5:11 PM
On Thu, Aug 12, 2021 at 3:14 AM Sa, Nuno

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

wrote:

...

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Could you give your input on this one?

There's no context, but I'm assuming this is in channel nodes.

Keep

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Sorry about that. Your assumption is correct, the binding is for a

channel

Quoted 1 line

node [1]. The driver just get's it as 'num' [2] which is not

consistent.

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Naively, I just though changing the driver to use reg would be

enough

Quoted 1 line

but Andy nicely raised the question of someone being already

relying

Quoted 13 lines
Quoted 13 lines
Quoted 4 lines

on 'num'...

Quoted 2 lines

the binding 'reg' and make the driver support both if needed. Considering the author of the binding also changed the binding

from

Quoted 2 lines
Quoted 2 lines

num to reg shortly after adding the binding, I don't think 'num' support is needed. If someone used 'num' and didn't run

validation,

Quoted 4 lines
Quoted 2 lines

well, that's their problem.

So I guess the solution here is just to change the driver to support

both

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

reg and num.

As far as I got Rob's answer, if the binding never had the 'num', dropping it from the driver is what we want now (actually your original patch) and users, who are 'too much clever' :-) should have had run validation for their DTs before production.

Taking this into account, I'm fine with the patch (but update a

commit

Quoted 6 lines
Quoted 3 lines

message to summarize this discussion)

You're right...
Jonathan, do you want a v2 with an updated commit message?

Quoted 7 lines

Please do. Also please add a fixes tag given we are treating it as a fix. If we discover someone is using the num variant then we'll just have to support both values as a fix to the fix. Not ideal, but as observed, hopefully people are validating the DTs (which basically means no one is using this in production or it would have been pointed out before).

Quoted 5 lines

Well, It seems we need to go through the support both 'num' and 'reg' route... I did some git blaming and it turns out 'num' was actually supported in the bindings [1]. After some time it was replaced by 'reg' [2] leaving the driver unchanged... I guess we have a significant window of time here where someone could deploy a *validated* devicetree using 'num'...

No there wasn't. Both commits landed in v5.7.

Quoted 2 lines

If no objections, on v2 I will just try to get 'reg' and if not present, fallback to 'num' before erroring out.

Unless a user turns up and complains, then I say drop 'num'.

Rob

author maintainer
#14 lore raw
Quoted 121 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Monday, August 16, 2021 2:19 PM
To: Sa, Nuno <[email protected]>
Cc: Jonathan Cameron <[email protected]>; Andy Shevchenko <[email protected]>; linux-iio <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property reading consistent

Quoted 8 lines · Nuno
Quoted 8 lines

-----Original Message-----
From: Jonathan Cameron <[email protected]>
Sent: Saturday, August 14, 2021 6:04 PM
To: Sa, Nuno <[email protected]>
Cc: Andy Shevchenko <[email protected]>; Rob

Herring

Quoted 4 lines
Quoted 4 lines

<[email protected]>; linux-iio <[email protected]>; Hennerich, Michael <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property

reading

Quoted 7 lines
Quoted 7 lines

consistent

[External]

On Fri, 13 Aug 2021 10:05:17 +0000
"Sa, Nuno" <[email protected]> wrote:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Friday, August 13, 2021 10:05 AM
To: Sa, Nuno <[email protected]>
Cc: Rob Herring <[email protected]>; linux-iio <linux- [email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Lars-

Peter

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

Clausen <[email protected]>
Subject: Re: [PATCH] iio: ad5770r: make devicetree property

reading

Quoted 3 lines
Quoted 3 lines

consistent

On Fri, Aug 13, 2021 at 10:47 AM Sa, Nuno

<[email protected]>

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:
Quoted 3 lines

From: Rob Herring <[email protected]>
Sent: Thursday, August 12, 2021 5:11 PM
On Thu, Aug 12, 2021 at 3:14 AM Sa, Nuno

Quoted 8 lines
Quoted 8 lines

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

wrote:

...

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Could you give your input on this one?

There's no context, but I'm assuming this is in channel

nodes.

Quoted 3 lines
Quoted 3 lines

Keep

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Sorry about that. Your assumption is correct, the binding is for

a

Quoted 10 lines
Quoted 10 lines
Quoted 2 lines
Quoted 2 lines

channel

Quoted 1 line

node [1]. The driver just get's it as 'num' [2] which is not

consistent.

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Naively, I just though changing the driver to use reg would be

enough

Quoted 1 line

but Andy nicely raised the question of someone being already

relying

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

on 'num'...

Quoted 1 line

the binding 'reg' and make the driver support both if

needed.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Considering the author of the binding also changed the

binding

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

from

Quoted 1 line
Quoted 1 line

num to reg shortly after adding the binding, I don't think

'num'

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

support is needed. If someone used 'num' and didn't run

validation,

Quoted 4 lines
Quoted 2 lines

well, that's their problem.

So I guess the solution here is just to change the driver to

support

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

both

Quoted 1 line

reg and num.

As far as I got Rob's answer, if the binding never had the 'num', dropping it from the driver is what we want now (actually your original patch) and users, who are 'too much clever' :-) should

have

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

had run validation for their DTs before production.

Taking this into account, I'm fine with the patch (but update a

commit

Quoted 2 lines
Quoted 2 lines

message to summarize this discussion)
Reviewed-by: Andy Shevchenko

<[email protected]>

Quoted 13 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

You're right...
Jonathan, do you want a v2 with an updated commit message?

Quoted 7 lines

Please do. Also please add a fixes tag given we are treating it as a fix. If we discover someone is using the num variant then we'll just have to support both values as a fix to the fix. Not ideal, but as observed, hopefully people are validating the DTs (which basically means no one is using this in production or it would have been pointed out before).

Quoted 1 line

Well, It seems we need to go through the support both 'num' and

'reg'

Quoted 1 line

route... I did some git blaming and it turns out 'num' was actually

Quoted 8 lines

supported

Quoted 1 line

in the bindings [1]. After some time it was replaced by 'reg' [2]

leaving the

Quoted 1 line

driver unchanged... I guess we have a significant window of time

here

Quoted 1 line

where someone could deploy a *validated* devicetree using 'num'...

No there wasn't. Both commits landed in v5.7.

Ahh I see. I just looked to dates without thinking in release cycles...

Quoted 6 lines
Quoted 1 line

If no objections, on v2 I will just try to get 'reg' and if not present,

fallback

Quoted 1 line

to 'num' before erroring out.

Unless a user turns up and complains, then I say drop 'num'.

Ok, thanks! That's easier for me...

- Nuno Sá