lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <39b68e91-93cc-ad74-d064-a29ff01d60a6@linaro.org>
Date:   Tue, 19 Apr 2022 08:44:48 +0200
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     Rob Herring <robh@...nel.org>
Cc:     Andy Gross <agross@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org
Subject: Re: [PATCH v2 1/2] regulator: dt-bindings: qcom,rpmh: document
 supplies per variant

On 14/04/2022 17:51, Rob Herring wrote:
> On Tue, Apr 12, 2022 at 09:31:22AM +0200, Krzysztof Kozlowski wrote:
>> The RPMH regulator binding covers several devices with different
>> regulator supplies, so it uses patterns matching broad range of these
>> supplies.  This works fine but is not specific and might miss actual
>> mistakes when a wrong supply property is used for given variant.
>>
>> Describe the supplies depending on the compatible, using a defs-allOf
>> method.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
>> ---
>>  .../regulator/qcom,rpmh-regulator.yaml        | 290 +++++++++++++++++-
>>  1 file changed, 276 insertions(+), 14 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.yaml
>> index 842ccef691b8..773536fe37c7 100644
>> --- a/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.yaml
>> +++ b/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.yaml
>> @@ -95,35 +95,297 @@ properties:
>>    vdd-rgb-supply:
>>      description: Input supply phandle of rgb.
>>  
>> -  vin-lvs-1-2-supply:
>> -    description: Input supply phandle of one or more regulators.
>> -
>> -  vdd-bob-supply:
>> -    description: BOB regulator parent supply phandle.
>> -
>>    bob:
>>      type: object
>>      $ref: "regulator.yaml#"
>>      description: BOB regulator node.
>>  
>>  patternProperties:
>> -  "^vdd-s([0-9]+)-supply$":
>> -    description: Input supply phandle(s) of one or more regulators.
>> -
>> -  "^vdd-(l[0-9]+[-]){1,5}supply$":
>> -    description: Input supply phandle(s) of one or more regulators.
>> -
>>    "^(smps|ldo|lvs)[0-9]+$":
>>      type: object
>>      $ref: "regulator.yaml#"
>>      description: smps/ldo regulator nodes(s).
>>  
>> -additionalProperties: false
>> -
>>  required:
>>    - compatible
>>    - qcom,pmic-id
>>  
>> +allOf:
>> +  - $ref: "#/$defs/pm6150"
>> +  - $ref: "#/$defs/pm6150l"
>> +  - $ref: "#/$defs/pm7325"
>> +  - $ref: "#/$defs/pm8005"
>> +  - $ref: "#/$defs/pm8009"
>> +  - $ref: "#/$defs/pm8150"
>> +  - $ref: "#/$defs/pm8150l"
>> +  - $ref: "#/$defs/pm8350"
>> +  - $ref: "#/$defs/pm8350c"
>> +  - $ref: "#/$defs/pm8450"
>> +  - $ref: "#/$defs/pm8998"
>> +  - $ref: "#/$defs/pmg1110"
>> +  - $ref: "#/$defs/pmi8998"
>> +  - $ref: "#/$defs/pmr735a"
>> +  - $ref: "#/$defs/pmx55"
>> +  - $ref: "#/$defs/pmx65"
>> +
>> +unevaluatedProperties: false
>> +
>> +$defs:
> 
> I'm not following on why you need $defs here rather than putting the 
> if/then schemas under the 'allOf'. $defs should primarily only be used 
> where it saves duplicating a schema 2 or more times. That could be the 
> case here if there's a case that's a subset of another case.

The allOf+defs is a workaround for schema behavior. The entire approach
if defining properties in "if:then:" works only with
unevaluatedProperties, not with additionalProperties. However
unevaluatedProperties require to reference other schema, which I do not
do here. I don't have other schema.

allOf+def has references tricking schema to accept unevaluatedProperties.


Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ