mbox series

[0/2] dt-bindings:iio:yaml conversions with xor condition

Message ID 20210401140956.224084-1-jic23@kernel.org
Headers show
Series dt-bindings:iio:yaml conversions with xor condition | expand

Message

Jonathan Cameron April 1, 2021, 2:09 p.m. UTC
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