Re: [PATCH 2/2] checks: Relax SPI slave checks

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



On Mon, Sep 28, 2020 at 03:19:42PM -0500, Rob Herring wrote:
> SPI slaves only have a single child node and therefore don't need
> '#address-cells' nor '#size-cells', so let's skip the check for those when
> 'spi-slave' is present.

I really don't like this idea.  Yes, you can work out what's going on
unambiguously because there's only one child, but that requires at
least some familiarity with SPI.  I think general consistency trumps
minimality here, and we should encourage SPI nodes to have the correct
-cells properties, even if they're not strictly essential.

> 
> Cc: Kumar Gala <kumar.gala@xxxxxxxxxx>
> Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> ---
>  checks.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/checks.c b/checks.c
> index 17cb6890d45a..c923295c6e40 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -1102,13 +1102,12 @@ static void check_spi_bus_bridge(struct check *c, struct dt_info *dti, struct no
>  	if (node->bus != &spi_bus || !node->children)
>  		return;
>  
> -	if (get_property(node, "spi-slave"))
> -		spi_addr_cells = 0;
> -	if (node_addr_cells(node) != spi_addr_cells)
> -		FAIL(c, dti, node, "incorrect #address-cells for SPI bus");
> -	if (node_size_cells(node) != 0)
> -		FAIL(c, dti, node, "incorrect #size-cells for SPI bus");
> -
> +	if (!get_property(node, "spi-slave")) {
> +		if (node_addr_cells(node) != spi_addr_cells)
> +			FAIL(c, dti, node, "incorrect #address-cells for SPI bus");
> +		if (node_size_cells(node) != 0)
> +			FAIL(c, dti, node, "incorrect #size-cells for SPI bus");
> +	}
>  }
>  WARNING(spi_bus_bridge, check_spi_bus_bridge, NULL, &addr_size_cells);
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[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