lkml.org 
[lkml]   [2014]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH/RFC] spi: core: Fix logic mismatch in spi_master.set_cs()
On Tue, Jan 14, 2014 at 12:36:51PM +0100, Geert Uytterhoeven wrote:

> {
> - if (spi->mode & SPI_CS_HIGH)
> - enable = !enable;
> -
> - if (spi->cs_gpio >= 0)
> + if (spi->cs_gpio >= 0) {
> + if (spi->mode & SPI_CS_HIGH)
> + enable = !enable;
> gpio_set_value(spi->cs_gpio, !enable);
> - else if (spi->master->set_cs)
> - spi->master->set_cs(spi, !enable);
> + } else if (spi->master->set_cs)
> + spi->master->set_cs(spi, enable);
> }

Coding style, braces on all branches of an if statement.

This also pushes the handling of CS_HIGH back out into the driver which
doesn't seem like it's helping anything. Flipping the sense of enable
when calling set_cs() is probably OK though.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-01-14 14:21    [W:0.036 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site