From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Likely Subject: Re: [PATCH 1/3] spi: bitbang: avoid needless loop flow manipulations Date: Fri, 25 May 2012 17:09:50 -0600 Message-ID: <20120525230951.07A3B3E0B19@localhost> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, Linus Walleij , Magnus Damm To: Guennadi Liakhovetski Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org On Mon, 21 May 2012 13:25:13 +0200 (CEST), Guennadi Liakhovetski wrote: > 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 Queued for v3.6. g. > --- > 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 aef59b1..f5ae6e9 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; > -- > 1.7.2.5 > -- Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/