Skip to content

Commit

Permalink
spi/bitbang: avoid needless loop flow manipulations
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Guennadi Liakhovetski authored and Grant Likely committed Nov 14, 2012
1 parent 77b6706 commit b82b576
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions drivers/spi/spi-bitbang.c
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit b82b576

Please sign in to comment.