spi/bitbang: avoid needless loop flow manipulations
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Mon, 21 May 2012 11:25:13 +0000 (13:25 +0200)
committerGrant Likely <grant.likely@secretlab.ca>
Wed, 14 Nov 2012 15:38:15 +0000 (15:38 +0000)
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>
drivers/spi/spi-bitbang.c

index aef59b1..f5ae6e9 100644 (file)
@@ -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;