linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] dt-bindings:iio:yaml conversions with xor condition
@ 2021-04-01 14:09 Jonathan Cameron
  2021-04-01 14:09 ` [PATCH 1/2] dt-bindings:iio:dac:ad5755: txt to yaml format conversion Jonathan Cameron
  2021-04-01 14:09 ` [PATCH 2/2] dt-bindings:iio:dac:ti,dac082s085 yaml conversion Jonathan Cameron
  0 siblings, 2 replies; 6+ messages in thread
From: Jonathan Cameron @ 2021-04-01 14:09 UTC (permalink / raw)
  To: linux-iio, Rob Herring; +Cc: devicetree, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

These two binding conversions are left from last year because I couldn't
figure out how to do the XOR between spi-cpha and spi-cpol without
using a $ref.  Rob suggested it should work by lifting the $ref block
and putting it inline but that ran into a restriction the dt-schema that
a oneOf is not allowed directly under an allOf.

Line 34 of schema/base.yaml
  allOf:
    items:
      propertyNames:
        enum:
          - $ref
          - if
          - then
          - else
  anyOf: true

I was just about to send a pull request to relax that constraint when I
realized that a top level oneOf was sufficient for this XoR condition
because it rules out more than one of the options being true at the same
time.  Hence the simplified version given here constrains things correctly.

oneOf:
  - required:
      - spi-cpha
  - required:
      - spi-cpol

We don't need to also specify
not:
  required: [spi-cpha, spi-cpol]
as done in earlier versions of these bindings.

One other minor change in patch 2 to make Should -> Must to avoid
confusion.

Jonathan Cameron (2):
  dt-bindings:iio:dac:ad5755: txt to yaml format conversion.
  dt-bindings:iio:dac:ti,dac082s085 yaml conversion

 .../devicetree/bindings/iio/dac/ad5755.txt    | 124 -------------
 .../bindings/iio/dac/adi,ad5755.yaml          | 171 ++++++++++++++++++
 .../bindings/iio/dac/ti,dac082s085.yaml       |  72 ++++++++
 .../bindings/iio/dac/ti-dac082s085.txt        |  34 ----
 4 files changed, 243 insertions(+), 158 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/iio/dac/ad5755.txt
 create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad5755.yaml
 create mode 100644 Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml
 delete mode 100644 Documentation/devicetree/bindings/iio/dac/ti-dac082s085.txt

-- 
2.31.1


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

end of thread, other threads:[~2021-04-24 17:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 14:09 [PATCH 0/2] dt-bindings:iio:yaml conversions with xor condition Jonathan Cameron
2021-04-01 14:09 ` [PATCH 1/2] dt-bindings:iio:dac:ad5755: txt to yaml format conversion Jonathan Cameron
2021-04-09 14:30   ` Rob Herring
2021-04-01 14:09 ` [PATCH 2/2] dt-bindings:iio:dac:ti,dac082s085 yaml conversion Jonathan Cameron
2021-04-09 14:31   ` Rob Herring
2021-04-24 17:23     ` Jonathan Cameron

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