linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: "Sa, Nuno" <Nuno.Sa@analog.com>
Cc: "lars@metafoo.de" <lars@metafoo.de>,
	"jic23@kernel.org" <jic23@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"knaack.h@gmx.de" <knaack.h@gmx.de>
Subject: Re: [PATCH v3 2/2] dt-bindings: iio: Add ltc2983 documentation
Date: Thu, 10 Oct 2019 15:03:38 -0500	[thread overview]
Message-ID: <20191010200338.GA23834@bogus> (raw)
In-Reply-To: <4cf4ca811fcc96dec3f07b96165b2ca457b04351.camel@analog.com>

On Tue, Oct 08, 2019 at 10:22:04AM +0000, Sa, Nuno wrote:
> Hi Rob,
> 
> Somethings that I would like to clarify before sending a v4 since I'm
> having errors and I'm not really sure about the fix I'm using.
> 
> On Tue, 2019-10-08 at 07:45 +0000, Sa, Nuno wrote:
> > 
> > On Mon, 2019-10-07 at 12:46 -0500, Rob Herring wrote:
> > > On Mon, Oct 7, 2019 at 11:17 AM Sa, Nuno <Nuno.Sa@analog.com>
> > > wrote:
> > > > On Mon, 2019-10-07 at 09:45 -0500, Rob Herring wrote:
> > > > > On Fri, Oct 4, 2019 at 8:55 AM Nuno Sá <nuno.sa@analog.com>
> > > > > wrote:
> > > > > > Document the LTC2983 temperature sensor devicetree bindings.
> > > > > > 
> > > > > > Signed-off-by: Nuno Sá <nuno.sa@analog.com>


> > > > > > +          Represents a thermocouple sensor which is
> > > > > > connected
> > > > > > to
> > > > > > one of the device
> > > > > > +          channels.
> > > > > > +
> > > > > > +        properties:
> > > > > > +          adi,sensor-type:
> > > > > > +            description: |
> > > > > > +              Identifies the type of thermocouple connected
> > > > > > to
> > > > > > the
> > > > > > device.
> > > > > > +              1 - Type J Thermocouple
> > > > > > +              2 - Type K Thermocouple
> > > > > > +              3 - Type E Thermocouple
> > > > > > +              4 - Type N Thermocouple
> > > > > > +              5 - Type R Thermocouple
> > > > > > +              6 - Type S Thermocouple
> > > > > > +              7 - Type T Thermocouple
> > > > > > +              8 - Type B Thermocouple
> > > > > > +              9 - Custom Thermocouple
> > > > > > +            allOf:
> > > > > > +              - $ref:
> > > > > > /schemas/types.yaml#/definitions/uint32
> > > > > 
> > > > > You can move the type definition under ".*@([1-9]|1[0-9]|20)$"
> > > > > and
> > > > > then just have the min/max here.
> > > > 
> > > > And how could I add meaning to the values. Could I add all in the
> > > > "parent" node?
> > > 
> > > No, they have to be at the correct level. You can keep the
> > > descriptions here. Just do:
> > > 
> > > adi,sensor-type:
> > >  description: ...
> > >  $ref: /schemas/types.yaml#/definitions/uint32
> > > 
> > > under ".*@([1-9]|1[0-9]|20)$" and drop the 'allOf: [ $ref: ...]'
> > > part.
> > > 
> 
> So, Im doing like:
> 
> ".*@([1-9]|1[0-9]|20)$":
>   type: object
> 
>   properties:
>     reg:
>       description: ...
>       minimum: 1
>       maximum: 20
>    
>     adi,sensor-type:
>       description: ...
>       $ref: /schemas/types.yaml#/definitions/uint32
>   
>   required:
>     - reg
>     - adi,sensor-type
> 
> Then in:
> 
> "^thermocouple@":
>   type: object
>   description: ...
>   
>   properties:
>     adi,sensor-type:
>       description: ...
>       minimum: 1
>       maximum: 9
>    
> This gives me that adi,sensor-type is not a valid schema. Adding allOf
> before min/max fixes it. The same error comes in:

Forget what I said, you're going to need to keep '$ref: 
/schemas/types.yaml#/definitions/uint32' here.

The problem is the meta-schema enforces that a vendor specific property 
(one with a comma) have a type defined and there's not really any way to 
say it already does elsewhere. I don't want to loosen that up globally 
either.

> 
> "^diode@":
> type: object
>   description: ...
>   
>   properties:
>     adi,sensor-type:
>       description: ...
>       const: 28 #adding allOf here also fixes it...

I need to fix the meta-schema to check what's under 'allOf'. :)

> 
> One last issue that I was not seeing before is with the reg property.
> If you recall, you also suggested to have it under ".*@([1-9]|1[0-
> 9]|20)$": and then add the 'minimum: 2' where needed. Doing that now
> also gives me invalid schema:
> 
> "^rtd@":
> type: object
>   description: ...
> 
>   properties:
>     reg:
>       minimum: 2
> 
> Changing to
>     reg:
>       items:
>         minimum: 2
> 
> fixes it but it feels that the first one should work?

The problem is we require both minimum and maximum to be defined. So 
really the second one should fail too. Or we should loosen this 
requirement.

Rob

  reply	other threads:[~2019-10-10 20:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04 13:55 [PATCH v3 1/2] iio: temperature: Add support for LTC2983 Nuno Sá
2019-10-04 13:55 ` [PATCH v3 2/2] dt-bindings: iio: Add ltc2983 documentation Nuno Sá
2019-10-06 10:29   ` Jonathan Cameron
2019-10-07 14:45   ` Rob Herring
2019-10-07 16:17     ` Sa, Nuno
2019-10-07 17:46       ` Rob Herring
2019-10-08  7:45         ` Sa, Nuno
2019-10-08 10:22           ` Sa, Nuno
2019-10-10 20:03             ` Rob Herring [this message]
2019-10-12 10:41       ` Jonathan Cameron
2019-10-06 10:37 ` [PATCH v3 1/2] iio: temperature: Add support for LTC2983 Jonathan Cameron
2019-10-07  9:10   ` Sa, Nuno
2019-10-07 11:52     ` Jonathan Cameron
2019-10-07 12:33       ` Sa, Nuno
2019-10-08 10:55 ` Sa, Nuno

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=20191010200338.GA23834@bogus \
    --to=robh@kernel.org \
    --cc=Nuno.Sa@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pmeerw@pmeerw.net \
    /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).