ppc/pnv: Improve macro parenthesization
authorEric Blake <eblake@redhat.com>
Tue, 19 Sep 2017 14:16:03 +0000 (09:16 -0500)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 27 Sep 2017 03:05:41 +0000 (13:05 +1000)
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>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
include/hw/ppc/pnv_xscom.h

index 3757b2cab94bfc4d5fec8baebc35f6e509bf96aa..38077b479699ce08f1e737181fdf7e187b058735 100644 (file)
@@ -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