From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Guennadi Liakhovetski <g.liakhovetski-Mmb7MZpHnFY@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
Linus Walleij
<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Magnus Damm <magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 1/3] spi: bitbang: avoid needless loop flow manipulations
Date: Fri, 25 May 2012 17:09:50 -0600 [thread overview]
Message-ID: <20120525230951.07A3B3E0B19@localhost> (raw)
In-Reply-To: <Pine.LNX.4.64.1205211322570.30522-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
On Mon, 21 May 2012 13:25:13 +0200 (CEST), Guennadi Liakhovetski <g.liakhovetski-Mmb7MZpHnFY@public.gmane.org> 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 <g.liakhovetski-Mmb7MZpHnFY@public.gmane.org>
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/
next prev parent reply other threads:[~2012-05-25 23:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-21 11:25 [PATCH 0/3] spi: bitbang: use core message queue Guennadi Liakhovetski
[not found] ` <Pine.LNX.4.64.1205211319520.30522-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2012-05-21 11:25 ` [PATCH 1/3] spi: bitbang: avoid needless loop flow manipulations Guennadi Liakhovetski
[not found] ` <Pine.LNX.4.64.1205211322570.30522-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2012-05-25 23:09 ` Grant Likely [this message]
2012-05-21 11:25 ` [PATCH 2/3] spi: bitbang: (cosmetic) simplify list manipulation Guennadi Liakhovetski
[not found] ` <Pine.LNX.4.64.1205211323460.30522-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2012-05-25 23:10 ` Grant Likely
2012-05-21 11:25 ` [PATCH 3/3] spi: bitbang: convert to using core message queue Guennadi Liakhovetski
[not found] ` <Pine.LNX.4.64.1205211324370.30522-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2012-05-21 11:44 ` Linus Walleij
2012-05-25 23:29 ` Grant Likely
2013-01-08 12:50 ` Linus Walleij
[not found] ` <CACRpkdYAP8L3jut_udzaTBG-gJZ3Po9E2kgY+Wttw=jksG9d7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-01-09 14:46 ` Guennadi Liakhovetski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120525230951.07A3B3E0B19@localhost \
--to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
--cc=g.liakhovetski-Mmb7MZpHnFY@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.