public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] Introduce generic TPM support in u-boot
Date: Sun, 16 Oct 2011 11:31:54 -0400	[thread overview]
Message-ID: <201110161131.55406.vapier@gentoo.org> (raw)
In-Reply-To: <201110152309.55400.marek.vasut@gmail.com>

On Saturday 15 October 2011 17:09:55 Marek Vasut wrote:
> On Saturday, October 15, 2011 08:47:39 PM Vadim Bendebury wrote:
> > On Sat, Oct 15, 2011 at 11:08 AM, Marek Vasut wrote:
> > > On Saturday, October 15, 2011 05:38:50 AM Vadim Bendebury wrote:
> > >> --- /dev/null
> > >> +++ b/drivers/tpm/generic_lpc_tpm.c
> > > 
> > > [...]
> > > 
> > >> +
> > >> +struct lpc_tpm {
> > >> +     struct tpm_locality locality[TPM_TOTAL_LOCALITIES];
> > >> +};
> > > 
> > > Do you need such envelope ?
> > 
> > I think I do - this accurately describes the structure of the chip.
> 
> There's just one member ... it's weird?

i don't think so.  if the hardware is really that way, then a single struct 
that represents it makes sense to me.

> > >> +/* Error value returned on various TPM driver errors */
> > > 
> > > Dot missing at the end.
> > 
> > ok.
> 
> Please fix globally.

this isn't really a standard.  for single sentences/fragments, they often get 
dropped.  left up to the relevant writer what they want to do.

> > >> +/* TPM access going through macros to make tracing easier. */
> > >> +#define tpm_read(ptr) ({ \
> > >> +     u32  __ret; \
> > >> +     __ret = (sizeof(*ptr) == 1) ? readb(ptr) : readl(ptr); \
> > >> +      debug(PREFIX "Read reg 0x%x returns 0x%x\n", \
> > >> +            (u32)ptr - (u32)lpc_tpm_dev, __ret); \
> > >> +                                      __ret; })
> > >> +
> > > 
> > > Make this inline function
> > > 
> > >> +#define tpm_write(value, ptr) ({                \
> > >> +     u32 __v = value;        \
> > >> +     debug(PREFIX "Write reg 0x%x with 0x%x\n", \
> > >> +            (u32)ptr - (u32)lpc_tpm_dev, __v); \
> > >> +     if (sizeof(*ptr) == 1) \
> > >> +             writeb(__v, ptr); \
> > >> +     else \
> > >> +             writel(__v, ptr); })
> > >> +
> > > 
> > > DTTO
> > 
> > Are you sure these will work as inline functions?
> 
> Why not ? Also, why do you introduce the __v ?

the sizeof() magic requires it be a macro.  and the __v indirection is 
required (there should be a __p too, but that'd be a little more work, and is 
less likely to have side effects).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111016/c3b3d604/attachment.pgp 

  parent reply	other threads:[~2011-10-16 15:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-15  3:38 [U-Boot] [PATCH v2 1/2] Introduce generic TPM support in u-boot Vadim Bendebury
2011-10-15 18:08 ` Marek Vasut
2011-10-15 18:47   ` Vadim Bendebury
2011-10-15 21:09     ` Marek Vasut
2011-10-16  1:04       ` Vadim Bendebury
2011-10-16  3:31         ` Marek Vasut
2011-10-16  3:45           ` Vadim Bendebury
2011-10-16  7:35             ` Wolfgang Denk
2011-10-16 14:57               ` Vadim Bendebury
2011-10-16 20:04                 ` Wolfgang Denk
2011-10-16 20:24                   ` Vadim Bendebury
2011-10-16 20:31                     ` Wolfgang Denk
2011-10-16 20:42                       ` Vadim Bendebury
2011-10-16 20:53                         ` Wolfgang Denk
2011-10-16 21:53                           ` Vadim Bendebury
2011-10-16 12:28             ` Marek Vasut
2011-10-16 19:49               ` Vadim Bendebury
2011-10-17 11:01                 ` Marek Vasut
2011-10-16  6:15         ` Wolfgang Denk
2011-10-16 15:31       ` Mike Frysinger [this message]
2011-10-15 19:25 ` Wolfgang Denk
2011-10-16  1:05   ` Vadim Bendebury
2011-10-15 19:42 ` Mike Frysinger
2011-10-15 20:23   ` Vadim Bendebury
2011-10-16  1:06   ` Vadim Bendebury

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=201110161131.55406.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /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