diff mbox series

[v2,1/1] dt-bindings: misc: add support for both property names cmd-gpios and cmd-gpio

Message ID 20201015044443.1828-2-thunder.leizhen@huawei.com (mailing list archive)
State New, archived
Headers show
Series fix all errors except one reported by dt_binding_check | expand

Commit Message

Zhen Lei Oct. 15, 2020, 4:44 a.m. UTC
The definition "gpio_suffixes[] = { "gpios", "gpio" }" shows that both
property names "cmd-gpios" and "cmd-gpio" are supported. But currently
only "cmd-gpios" is allowed in this yaml, and the name used in
mmp2-olpc-xo-1-75.dts is cmd-gpio. As a result, the following errors is
reported.

slave: 'cmd-gpios' is a required property
slave: 'cmd-gpio' does not match any of the regexes: 'pinctrl-[0-9]+'

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Geert Uytterhoeven Oct. 15, 2020, 7:01 a.m. UTC | #1
Hi Zhen,

Thanks for your patch!

On Thu, Oct 15, 2020 at 6:52 AM Zhen Lei <thunder.leizhen@huawei.com> wrote:
> The definition "gpio_suffixes[] = { "gpios", "gpio" }" shows that both
> property names "cmd-gpios" and "cmd-gpio" are supported. But currently
> only "cmd-gpios" is allowed in this yaml, and the name used in
> mmp2-olpc-xo-1-75.dts is cmd-gpio. As a result, the following errors is
> reported.
>
> slave: 'cmd-gpios' is a required property
> slave: 'cmd-gpio' does not match any of the regexes: 'pinctrl-[0-9]+'
>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml b/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml
> index b3c45c046ba5e37..dd549380a085709 100644
> --- a/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml
> +++ b/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml
> @@ -24,15 +24,21 @@ properties:
>    compatible:
>      const: olpc,xo1.75-ec
>
> -  cmd-gpios:
> +  spi-cpha: true
> +
> +patternProperties:
> +  "^cmd-gpio[s]?$":
>      description: GPIO uspecifier of the CMD pin
>      maxItems: 1

In general, the *-gpio form is deprecated.  So why complicate the DT
bindings by adding support for deprecated properties?

  1. Explicitly allowing deprecated properties means new users may be
     added,
  2. Once all in-tree DTS files are converted, the warnings will be gone
     anyway,
  3. Out-of-tree DTB will still work, as it's very unlikely support for
     the "gpio" suffix can/will be dropped anytime soon,
  4. If anyone runs the validator on out-of-tree DTS files, the most
     probable intention is to fix any detected issues anyway, and the
     files can be updated, too,
  5. If any out-of-tree code or tooling relies on the *-gpio form, it
     may already be broken.

> -  spi-cpha: true
> -
>  required:
>    - compatible
> -  - cmd-gpios
> +
> +oneOf:
> +  - required:
> +      - cmd-gpio
> +  - required:
> +      - cmd-gpios
>
>  additionalProperties: false

Gr{oetje,eeting}s,

                        Geert
Zhen Lei Oct. 15, 2020, 7:59 a.m. UTC | #2
On 2020/10/15 15:01, Geert Uytterhoeven wrote:
> Hi Zhen,
> 
> Thanks for your patch!
> 
> On Thu, Oct 15, 2020 at 6:52 AM Zhen Lei <thunder.leizhen@huawei.com> wrote:
>> The definition "gpio_suffixes[] = { "gpios", "gpio" }" shows that both
>> property names "cmd-gpios" and "cmd-gpio" are supported. But currently
>> only "cmd-gpios" is allowed in this yaml, and the name used in
>> mmp2-olpc-xo-1-75.dts is cmd-gpio. As a result, the following errors is
>> reported.
>>
>> slave: 'cmd-gpios' is a required property
>> slave: 'cmd-gpio' does not match any of the regexes: 'pinctrl-[0-9]+'
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> ---
>>  Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml | 14 ++++++++++----
>>  1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml b/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml
>> index b3c45c046ba5e37..dd549380a085709 100644
>> --- a/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml
>> +++ b/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml
>> @@ -24,15 +24,21 @@ properties:
>>    compatible:
>>      const: olpc,xo1.75-ec
>>
>> -  cmd-gpios:
>> +  spi-cpha: true
>> +
>> +patternProperties:
>> +  "^cmd-gpio[s]?$":
>>      description: GPIO uspecifier of the CMD pin
>>      maxItems: 1
> 
> In general, the *-gpio form is deprecated.  So why complicate the DT
> bindings by adding support for deprecated properties?

I just don't know this information. So this patch can be ignored.

> 
>   1. Explicitly allowing deprecated properties means new users may be
>      added,
>   2. Once all in-tree DTS files are converted, the warnings will be gone
>      anyway,
>   3. Out-of-tree DTB will still work, as it's very unlikely support for
>      the "gpio" suffix can/will be dropped anytime soon,
>   4. If anyone runs the validator on out-of-tree DTS files, the most
>      probable intention is to fix any detected issues anyway, and the
>      files can be updated, too,
>   5. If any out-of-tree code or tooling relies on the *-gpio form, it
>      may already be broken.
> 
>> -  spi-cpha: true
>> -
>>  required:
>>    - compatible
>> -  - cmd-gpios
>> +
>> +oneOf:
>> +  - required:
>> +      - cmd-gpio
>> +  - required:
>> +      - cmd-gpios
>>
>>  additionalProperties: false
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml b/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml
index b3c45c046ba5e37..dd549380a085709 100644
--- a/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml
+++ b/Documentation/devicetree/bindings/misc/olpc,xo1.75-ec.yaml
@@ -24,15 +24,21 @@  properties:
   compatible:
     const: olpc,xo1.75-ec
 
-  cmd-gpios:
+  spi-cpha: true
+
+patternProperties:
+  "^cmd-gpio[s]?$":
     description: GPIO uspecifier of the CMD pin
     maxItems: 1
 
-  spi-cpha: true
-
 required:
   - compatible
-  - cmd-gpios
+
+oneOf:
+  - required:
+      - cmd-gpio
+  - required:
+      - cmd-gpios
 
 additionalProperties: false