Re: [PATCH 1/3] dt-bindings: hsi: hsi-client: convert to YAML

From: Krzysztof Kozlowski
Date: Tue Mar 26 2024 - 08:56:36 EST


On 26/03/2024 13:45, Sebastian Reichel wrote:
>
>> but more importantly: some properties are now excluding each
>> other.
>
> I think that requirement was already there.

Right.


..

>>> +
>>> +allOf:
>>> + - if:
>>> + required:
>>> + - hsi-mode
>>> + then:
>>> + properties:
>>> + hsi-rx-mode: false
>>> + hsi-tx-mode: false
>>
>> I don't understand what you are trying to achieve here and with anyOf.
>> It looks like just oneOf. OTOH, old binding did not exclude these
>> properties.
>
> So the anyOf ensures, that either hsi-mode or hsi-rx-mode +
> hsi-tx-mode are specified. Those properties were previously

Not entirely. anyOf should succeed also when none of them are present,
which is not what you want in such case.

> listed as required and they are indeed mandatory by the Linux
> kernel implementation.
>
> The old binding also has this:
>
> hsi-mode: May be used ***instead*** hsi-rx-mode and hsi-tx-mode
>
> So it's either hsi-rx-mode + hsi-tx-mode OR hsi-mode, but not
> all properties at the same time. That's what the allOf ensures:
> if hsi-mode is specified, then hsi-rx-mode and hsi-tx-mode may
> not be specified.

Then wouldn't this work for you:
https://elixir.bootlin.com/linux/v5.17-rc2/source/Documentation/devicetree/bindings/reserved-memory/reserved-memory.yaml#L91
?

But if you really want them to be optional but excluding, then simpler
syntax is:
https://lore.kernel.org/all/20230118163208.GA117919-robh@xxxxxxxxxx/

Best regards,
Krzysztof