diff mbox series

[v3,1/3] dt-bindings: pwm: Fix node name pattern

Message ID 20220120161442.140800-2-nikita@trvn.ru
State Changes Requested, archived
Headers show
Series Clock based PWM output driver | expand

Checks

Context Check Description
robh/checkpatch warning total: 0 errors, 1 warnings, 8 lines checked
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Nikita Travkin Jan. 20, 2022, 4:14 p.m. UTC
It looks like it was intended to allow two types of node names with the
binding:

 - With unit address, e.g. pwm@1f000000
 - With a suffix, e.g. pwm-clk

However the pattern regex only correctly matches the first variant,
as well as some incorrect ones.

Fix the regex to match only two patterns shown above. (Either unit
address starting with @ and following with one or more hexademical
digit or arbitrary suffix stating with - and at least one symbol long)

Fixes: 89650a1e3b6f ("dt-bindings: pwm: Convert PWM bindings to json-schema")
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
 Documentation/devicetree/bindings/pwm/pwm.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rob Herring Jan. 20, 2022, 7:15 p.m. UTC | #1
On Thu, Jan 20, 2022 at 09:14:40PM +0500, Nikita Travkin wrote:
> It looks like it was intended to allow two types of node names with the
> binding:
> 
>  - With unit address, e.g. pwm@1f000000

Yes, but the format of the unit-address is up to the parent bus which is 
outside the scope of this binding.

>  - With a suffix, e.g. pwm-clk

No. pwm-0, pwm-1, etc. only to cover the few cases with no unit-address. 

Third is just 'pwm' as the '*' on the end means 0 or more. Though a '?' 
would have been more correct.

> 
> However the pattern regex only correctly matches the first variant,
> as well as some incorrect ones.
> 
> Fix the regex to match only two patterns shown above. (Either unit
> address starting with @ and following with one or more hexademical
> digit or arbitrary suffix stating with - and at least one symbol long)
> 
> Fixes: 89650a1e3b6f ("dt-bindings: pwm: Convert PWM bindings to json-schema")
> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
> ---
>  Documentation/devicetree/bindings/pwm/pwm.yaml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/pwm/pwm.yaml b/Documentation/devicetree/bindings/pwm/pwm.yaml
> index 3c01f85029e5..4926fe65886f 100644
> --- a/Documentation/devicetree/bindings/pwm/pwm.yaml
> +++ b/Documentation/devicetree/bindings/pwm/pwm.yaml
> @@ -13,7 +13,7 @@ select: false
>  
>  properties:
>    $nodename:
> -    pattern: "^pwm(@.*|-[0-9a-f])*$"
> +    pattern: "^pwm(@[0-9a-f]+|-.+)?$"
>  
>    "#pwm-cells":
>      description:
> -- 
> 2.30.2
> 
>
Nikita Travkin Jan. 21, 2022, 6:20 a.m. UTC | #2
Rob Herring писал(а) 21.01.2022 00:15:
> On Thu, Jan 20, 2022 at 09:14:40PM +0500, Nikita Travkin wrote:
>> It looks like it was intended to allow two types of node names with the
>> binding:
>>
>>  - With unit address, e.g. pwm@1f000000
> 
> Yes, but the format of the unit-address is up to the parent bus which is 
> outside the scope of this binding.
> 
>>  - With a suffix, e.g. pwm-clk
> 
> No. pwm-0, pwm-1, etc. only to cover the few cases with no unit-address. 
> 
> Third is just 'pwm' as the '*' on the end means 0 or more. Though a '?' 
> would have been more correct.
> 

Oh, thanks for clarifying that. My assumption was that just numbering
the nodes is not informative enough, but if it's the agreed way to do
it, I will use this format instead.

I will drop this commit and correct the bindings to use 'pwm' with
no suffix as an example. (Though I still think that having a
meaningful suffix is nicer in the DT so one could see what the
node is used for)

Thanks
Nikita

>>
>> However the pattern regex only correctly matches the first variant,
>> as well as some incorrect ones.
>>
>> Fix the regex to match only two patterns shown above. (Either unit
>> address starting with @ and following with one or more hexademical
>> digit or arbitrary suffix stating with - and at least one symbol long)
>>
>> Fixes: 89650a1e3b6f ("dt-bindings: pwm: Convert PWM bindings to json-schema")
>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>> ---
>>  Documentation/devicetree/bindings/pwm/pwm.yaml | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/pwm.yaml b/Documentation/devicetree/bindings/pwm/pwm.yaml
>> index 3c01f85029e5..4926fe65886f 100644
>> --- a/Documentation/devicetree/bindings/pwm/pwm.yaml
>> +++ b/Documentation/devicetree/bindings/pwm/pwm.yaml
>> @@ -13,7 +13,7 @@ select: false
>>
>>  properties:
>>    $nodename:
>> -    pattern: "^pwm(@.*|-[0-9a-f])*$"
>> +    pattern: "^pwm(@[0-9a-f]+|-.+)?$"
>>
>>    "#pwm-cells":
>>      description:
>> --
>> 2.30.2
>>
>>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pwm/pwm.yaml b/Documentation/devicetree/bindings/pwm/pwm.yaml
index 3c01f85029e5..4926fe65886f 100644
--- a/Documentation/devicetree/bindings/pwm/pwm.yaml
+++ b/Documentation/devicetree/bindings/pwm/pwm.yaml
@@ -13,7 +13,7 @@  select: false
 
 properties:
   $nodename:
-    pattern: "^pwm(@.*|-[0-9a-f])*$"
+    pattern: "^pwm(@[0-9a-f]+|-.+)?$"
 
   "#pwm-cells":
     description: