Re: [PATCH v2] spi: omap2-mcspi: Add support for GPIO chipselects

From: Mark Brown
Date: Wed Apr 29 2015 - 06:47:48 EST


On Tue, Apr 28, 2015 at 06:06:43PM -0500, Michael Welling wrote:
> On Tue, Apr 28, 2015 at 03:34:25PM +0100, Mark Brown wrote:

> > > if (gpio_is_valid(spi->cs_gpio)) {
> > > if (cs_active)
> > > gpio_set_value(spi->cs_gpio, spi->mode & SPI_CS_HIGH);
> > > else
> > > gpio_set_value(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
> > > }

> > That's good but please have braces around the inner if for clarity.

> I try to follow the CodingStyle documentation and it says differently:
> http://lxr.free-electrons.com/source/Documentation/CodingStyle#L156

That's for free standing if statements, the reason I'm asking for braces
at both levels here is that you've got a nested if - it's similar to
having braces on both branches of an if, being consistent within the
same statement.

> I have also been looking at ways of allowing more GPIO chipselects than
> DMA channels. Currently this driver is limited to one chipselect per
> DMA channel.

> Do you have any ideas on how to accomplish this?

Just use a single channel for the controller rather than allocating them
per device? It's not like the controller is going to be able to
interact with multiple devics simultaneously.

Attachment: signature.asc
Description: Digital signature