All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppc/pnv: Improve macro parenthesization
@ 2017-09-19 14:16 Eric Blake
  2017-09-19 15:22 ` [Qemu-devel] [Qemu-ppc] " Cédric Le Goater
  2017-09-20  1:00 ` [Qemu-devel] " David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Blake @ 2017-09-19 14:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, David Gibson, Alexander Graf, open list:PowerPC

Although none of the existing macro call-sites were broken,
it's always better to write macros that properly parenthesize
arguments that can be complex expressions, so that the intended
order of operations is not broken.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 include/hw/ppc/pnv_xscom.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h
index 3757b2cab9..38077b4796 100644
--- a/include/hw/ppc/pnv_xscom.h
+++ b/include/hw/ppc/pnv_xscom.h
@@ -54,7 +54,7 @@ typedef struct PnvXScomInterfaceClass {
  *   PCB SLAVE   0x110Fxxxx
  */

-#define PNV_XSCOM_EX_CORE_BASE(base, i) (base | (((uint64_t)i) << 24))
+#define PNV_XSCOM_EX_CORE_BASE(base, i) ((base) | ((uint64_t)(i) << 24))
 #define PNV_XSCOM_EX_CORE_SIZE    0x100000

 #define PNV_XSCOM_LPC_BASE        0xb0020
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] ppc/pnv: Improve macro parenthesization
  2017-09-19 14:16 [Qemu-devel] [PATCH] ppc/pnv: Improve macro parenthesization Eric Blake
@ 2017-09-19 15:22 ` Cédric Le Goater
  2017-09-20  1:00 ` [Qemu-devel] " David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: Cédric Le Goater @ 2017-09-19 15:22 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: qemu-trivial, open list:PowerPC, David Gibson

On 09/19/2017 04:16 PM, Eric Blake wrote:
> Although none of the existing macro call-sites were broken,
> it's always better to write macros that properly parenthesize
> arguments that can be complex expressions, so that the intended
> order of operations is not broken.

yes.

> Signed-off-by: Eric Blake <eblake@redhat.com>

Reviewed-by: Cédric Le Goater <clg@kaod.org>

C.
> ---
>  include/hw/ppc/pnv_xscom.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h
> index 3757b2cab9..38077b4796 100644
> --- a/include/hw/ppc/pnv_xscom.h
> +++ b/include/hw/ppc/pnv_xscom.h
> @@ -54,7 +54,7 @@ typedef struct PnvXScomInterfaceClass {
>   *   PCB SLAVE   0x110Fxxxx
>   */
> 
> -#define PNV_XSCOM_EX_CORE_BASE(base, i) (base | (((uint64_t)i) << 24))
> +#define PNV_XSCOM_EX_CORE_BASE(base, i) ((base) | ((uint64_t)(i) << 24))
>  #define PNV_XSCOM_EX_CORE_SIZE    0x100000
> 
>  #define PNV_XSCOM_LPC_BASE        0xb0020
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] ppc/pnv: Improve macro parenthesization
  2017-09-19 14:16 [Qemu-devel] [PATCH] ppc/pnv: Improve macro parenthesization Eric Blake
  2017-09-19 15:22 ` [Qemu-devel] [Qemu-ppc] " Cédric Le Goater
@ 2017-09-20  1:00 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2017-09-20  1:00 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, qemu-trivial, Alexander Graf, open list:PowerPC

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

On Tue, Sep 19, 2017 at 09:16:03AM -0500, Eric Blake wrote:
> Although none of the existing macro call-sites were broken,
> it's always better to write macros that properly parenthesize
> arguments that can be complex expressions, so that the intended
> order of operations is not broken.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>

Applied to ppc-for-2.11, thanks.

> ---
>  include/hw/ppc/pnv_xscom.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h
> index 3757b2cab9..38077b4796 100644
> --- a/include/hw/ppc/pnv_xscom.h
> +++ b/include/hw/ppc/pnv_xscom.h
> @@ -54,7 +54,7 @@ typedef struct PnvXScomInterfaceClass {
>   *   PCB SLAVE   0x110Fxxxx
>   */
> 
> -#define PNV_XSCOM_EX_CORE_BASE(base, i) (base | (((uint64_t)i) << 24))
> +#define PNV_XSCOM_EX_CORE_BASE(base, i) ((base) | ((uint64_t)(i) << 24))
>  #define PNV_XSCOM_EX_CORE_SIZE    0x100000
> 
>  #define PNV_XSCOM_LPC_BASE        0xb0020

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-20  2:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-19 14:16 [Qemu-devel] [PATCH] ppc/pnv: Improve macro parenthesization Eric Blake
2017-09-19 15:22 ` [Qemu-devel] [Qemu-ppc] " Cédric Le Goater
2017-09-20  1:00 ` [Qemu-devel] " David Gibson

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.