[PATCH] spi: setting up cs_gpio levels prior to registering spi devices

Mark Brown broonie at kernel.org
Mon Apr 6 10:36:07 PDT 2015


On Mon, Apr 06, 2015 at 05:16:32PM +0000, kernel at martin.sperl.org wrote:

> +	mutex_lock(&board_lock);
> +	list_for_each_entry(bi, &board_list, list) {
> +		sbi = &bi->board_info;
> +		if ((master->bus_num == sbi->bus_num) &&
> +		    (sbi->chip_select < master->num_chipselect) &&
> +		    gpio_is_valid(master->cs_gpios[sbi->chip_select]) &&
> +		    (sbi->mode & SPI_CS_HIGH))
> +			gpio_set_value(master->cs_gpios[sbi->chip_select], 0);

Please write a series of if statements with continues instead, the above
block is pretty much illegible with the lack of vertical space, mixture
of bracketing levels and small indent for the active statement at the
end.

As far as I can tell this code only works for GPIO chip selects?

> +static void acpi_spi_setup_gpiopins(struct spi_master *master)
> +{
> +	/* probably not needed, as there seems to be no cs_gpio
> +	 * information in the ACPI structures but left for completeness
> +	 * to get extended if needed
> +	 */
> +}

Please don't write placeholders like this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-rpi-kernel/attachments/20150406/f0efb949/attachment.sig>


More information about the linux-rpi-kernel mailing list