public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Peter Hüwe" <PeterHuewe@gmx.de>
To: tpmdd-devel@lists.sourceforge.net
Cc: Mathias LEBLANC <Mathias.LEBLANC@st.com>,
	"Jean-Luc BLANC" <jean-luc.blanc@st.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Rajiv Andrade <mail@srajiv.net>, Sirrix AG <tpmdd@sirrix.com>
Subject: Re: [tpmdd-devel] [PATCH 1/1] TPM: STMicroelectronics st33 driver SPI
Date: Thu, 16 May 2013 21:03:11 +0200	[thread overview]
Message-ID: <201305162103.11996.PeterHuewe@gmx.de> (raw)
In-Reply-To: <35286B1AE75A7C47BFF0870081A31B4B45A8A84AF6@SAFEX1MAIL4.st.com>

Hi Matthias:

> Regarding the while loop, I don't see how can I check the number of dummy
> byte differently?


Checking the number of dummy bytes is fine -
in line #144 you check it with a while loop which looks fine
in line #198 you check it with a for loop with an empty body, which in my 
opinion looks less nice than the while in #144.

So simply replace the second instance in #198 and I'm happy with that part ;)

Maybe also have a look at memchr_inv

/**
 * memchr_inv - Find an unmatching character in an area of memory.
 * @start: The memory area
 * @c: Find a character other than c
 * @bytes: The size of the area.
 *
 * returns the address of the first character other than @c, or %NULL
 * if the whole buffer contains just @c.
 */
void *memchr_inv(const void *start, int c, size_t bytes)



so #198 would look something like: 
nbr_dummy_bytes = memchr_inv (xfer.rx_buf+nbr_dummy_bytes, 
					0,
					 total_length-nbr_dummy_bytes) - xfer.rx_buf;

But I'm not sure whether that's more readable, maybe give it a try.
 I'm also fine with the while loop.


Peter







  reply	other threads:[~2013-05-16 18:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15 13:53 [PATCH 1/1] TPM: STMicroelectronics st33 driver SPI Matthias Leblanc
2013-05-15 22:29 ` [tpmdd-devel] " Peter Hüwe
2013-05-16  8:45   ` Mathias LEBLANC
2013-05-16 19:03     ` Peter Hüwe [this message]
2013-05-17 12:26       ` Mathias LEBLANC
  -- strict thread matches above, loose matches on Subject: below --
2013-05-07 10:16 Matthias Leblanc
     [not found] ` <-7985513476024686594@unknownmsgid>
2013-05-10 15:06   ` [tpmdd-devel] " Kent Yoder
2013-05-13 15:30     ` Mathias LEBLANC
2013-05-13 15:56       ` Kent Yoder
2013-04-22  8:50 Mathias Leblanc
2013-04-22 15:26 ` [tpmdd-devel] " Kent Yoder
2013-04-22 16:32   ` Mathias LEBLANC
2013-04-22 18:31     ` Kent Yoder
2013-04-25 15:40       ` Mathias LEBLANC
2013-04-26 14:29         ` Kent Yoder
2013-04-28  1:16 ` Peter Hüwe
2013-04-29 14:15   ` Kent Yoder
2013-04-12  8:44 Matthias Leblanc
2013-04-17 21:31 ` [tpmdd-devel] " Kent Yoder
2013-04-19 16:06   ` Mathias LEBLANC
2013-04-09 14:42 Matthias Leblanc
2013-04-10 20:32 ` [tpmdd-devel] " Peter Hüwe
2013-04-11  8:58   ` Mathias LEBLANC
2013-04-11 21:44     ` Peter Hüwe
2013-03-25 15:08 Matthias Leblanc
2013-03-25 16:44 ` [tpmdd-devel] " Kent Yoder
2013-03-25 16:48   ` Mathias LEBLANC

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=201305162103.11996.PeterHuewe@gmx.de \
    --to=peterhuewe@gmx.de \
    --cc=Mathias.LEBLANC@st.com \
    --cc=jean-luc.blanc@st.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@srajiv.net \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@sirrix.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox