From: Mike Frysinger Date: Sat, 15 Oct 2011 15:42:45 -0400 Subject: [U-Boot] [PATCH v2 1/2] Introduce generic TPM support in u-boot In-Reply-To: <20111015033850.74AD5419FF@eskimo.mtv.corp.google.com> References: <20111015033850.74AD5419FF@eskimo.mtv.corp.google.com> Message-ID: <201110151542.46102.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Friday 14 October 2011 23:38:50 Vadim Bendebury wrote: > --- /dev/null > +++ b/drivers/tpm/generic_lpc_tpm.c > > +#define TPM_TIMEOUT_ERR (~0) > +#define TPM_DRIVER_ERR (-1) these are the same thing. another reason why you shouldn't mix ~ with normal values. use -2 or something. > +/* 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; }) that last "__ret;" is indented way too far. it should be on the same level as "u32 __ret;" and such. > +#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); }) ({...}) doesn't make sense here. this should be a do{...}while(0). > + printf("%s:%d - failed to get 'command_ready' status\n", > + __FILE__, __LINE__); replace __FILE__/__LINE__ with __func__ here and everywhere else in the file -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/20111015/8a57dc5a/attachment.pgp