Re: [PATCH v4 1/2] dt-bindings: serial: samsung: avoid duplicating permitted clock-names

From: Rob Herring
Date: Mon Jul 22 2024 - 19:23:57 EST


On Fri, Jul 12, 2024 at 03:51:17PM +0100, André Draszik wrote:
> This binding currently duplicates the permitted clock-names in various
> places, and when adding more compatibles, clock-names will have to be
> duplicated even more.
>
> The reason is:
> 1) subschemas (-if: ...), still have to match the top-level:
> pattern: '^clk_uart_baud[0-3]$'
> 2) there is one compatible that doesn't follow sequential numbering for
> the clock names (samsung,s3c6400-uart)
> 3) when limiting the number of clock-names, we also want to enforce
> sequential names
> Because of 1) and 2), the patterns can not simply be changed to
> constant strings, and later overridden in a different subschema (for
> samsung,s3c6400-uart only).
>
> Since we can't populate the top-level clock-names based on the
> compatible, and because when limiting the number of items we generally
> want sequential numbers and not a pattern, move the permitted strings
> into a subschema of its own and populate it based on the compatible:
> * 'uart clk_uart_baud2 clk_uart_baud3' for the one outlier
> * 'uart clk_uart_baud0..3' for everything else
>
> This way we can avoid having to duplicate the permitted names
> everywhere.
>
> While at it, add blank lines as per the universal style, which is to
> have blank lines between properties, except where they are booleans.
>
> Also add another example using a compatible that uses the default
> clock-names scheme, as opposed to the existing example that uses
> samsung,s3c6400-uart's non-default clock-names. This allows testing
> both versions of the clock-names property when running
> dt_binding_check.
>
> Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
> ---
> .../devicetree/bindings/serial/samsung_uart.yaml | 63 +++++++++++++++++-----
> 1 file changed, 50 insertions(+), 13 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/serial/samsung_uart.yaml b/Documentation/devicetree/bindings/serial/samsung_uart.yaml
> index 0f0131026911..cfa1c0de946f 100644
> --- a/Documentation/devicetree/bindings/serial/samsung_uart.yaml
> +++ b/Documentation/devicetree/bindings/serial/samsung_uart.yaml
> @@ -58,12 +58,7 @@ properties:
> clock-names:
> description: N = 0 is allowed for SoCs without internal baud clock mux.

The description doesn't really make sense on its own. I'd drop it.

With that,

Reviewed-by: Rob Herring (Arm) <robh@xxxxxxxxxx>

> minItems: 2
> - items:
> - - const: uart
> - - pattern: '^clk_uart_baud[0-3]$'
> - - pattern: '^clk_uart_baud[0-3]$'
> - - pattern: '^clk_uart_baud[0-3]$'
> - - pattern: '^clk_uart_baud[0-3]$'
> + maxItems: 5