diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2012-05-21 13:25:13 +0200 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2012-11-14 16:38:15 +0100 |
commit | b82b576bc7ffb9785ad3248825ab20496b018e0c (patch) | |
tree | dc9ec25933ce901ed28ff29e309bc2aa5674b4f4 /drivers/spi/spi-bitbang.c | |
parent | Linux 3.7-rc5 (diff) | |
download | linux-b82b576bc7ffb9785ad3248825ab20496b018e0c.tar.xz linux-b82b576bc7ffb9785ad3248825ab20496b018e0c.zip |
spi/bitbang: avoid needless loop flow manipulations
This patch makes a loop look cleaner by replacing a "break" and a "continue"
in its body by a single "if".
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi-bitbang.c')
-rw-r--r-- | drivers/spi/spi-bitbang.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index aef59b1a15f7..f5ae6e960c7e 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -346,17 +346,14 @@ static void bitbang_work(struct work_struct *work) if (t->delay_usecs) udelay(t->delay_usecs); - if (!cs_change) - continue; - if (t->transfer_list.next == &m->transfers) - break; - - /* sometimes a short mid-message deselect of the chip - * may be needed to terminate a mode or command - */ - ndelay(nsecs); - bitbang->chipselect(spi, BITBANG_CS_INACTIVE); - ndelay(nsecs); + if (cs_change && !list_is_last(&t->transfer_list, &m->transfers)) { + /* sometimes a short mid-message deselect of the chip + * may be needed to terminate a mode or command + */ + ndelay(nsecs); + bitbang->chipselect(spi, BITBANG_CS_INACTIVE); + ndelay(nsecs); + } } m->status = status; |