Re: [PATCH v2] checks: Suppress warnings on overlay fragments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, Mar 8, 2023 at 3:17 AM Qun-Wei Lin <qun-wei.lin@xxxxxxxxxxxx> wrote:
>
> The overlay fragment is a special case where some properties are not
> present in the overlay source file, but in the base file.
>
> example:
> +-----------------------------+--------------------+
> | base.dts                    | overlay.dts        |
> +-----------------------------+--------------------+
> | /dts-v1/;                   | /dts-v1/;          |
> |                             | /plugin/;          |
> | /{                          |                    |
> |   parent: test {            | &parent {          |
> |     #address-cells = <1>;   |   child@0 {        |
> |     #size-cells = <0>;      |     reg = <0x0>;   |
> |   };                        |   };               |
> | };                          | };                 |
> +-----------------------------+--------------------+
>
> It will cause the following false alarms when compiling the overlay dts.
>
> 1. /fragment@0/__overlay__: Character '_' not recommended in node name
> 2. /fragment@0/__overlay__: Relying on default #address-cells value
> 3. /fragment@0/__overlay__: Relying on default #size-cells value
> 4. /fragment@0/__overlay__:reg: property has invalid length (4 bytes)
>    (#address-cells == 2, #size-cells == 1)
>
> This workaround will fix them by skip checking for node named __overlay__.
>
> Signed-off-by: Qun-Wei Lin <qun-wei.lin@xxxxxxxxxxxx>
> ---
> V1 -> V2:
>  - Add is_overlay_node() helper
>  - Skip anything starting with "__" in check_node_name_chars_strict()
>
>  checks.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

Reviewed-by: Rob Herring <robh@xxxxxxxxxx>

Though I do wonder if as a matter of policy on overlay structure, if
we should require an overlay to have the parent node with
#address-cells/#size-cells. In the end that would be duplicated data,
but without it there's no way to parse and validate reg/ranges in an
unapplied overlay. That's just one example issue in being able to
validate overlays.

Rob




[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux