From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Ehrhardt Date: Wed, 02 Jul 2008 11:55:31 +0000 Subject: Subject: [PATCH] kvmppc: kvmtrace: fix TRACE_REC_* macro definitions Message-Id: <486B6CB3.5030501@linux.vnet.ibm.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: kvm-ppc@vger.kernel.org Subject: [PATCH] kvmppc: kvmtrace: fix TRACE_REC_* macro definitions From: Christian Ehrhardt The current patch kvm_trace_nobitfields.diff in the kvmppc.hg-dev repo doesn't compile. code: rec.rec_val |=3D TRACE_REC_EVENT_ID(va_arg(*args, u32)); +makro #define TRACE_REC_EVENT_ID (val) \ (0x0fffffff & (val)) extended to: rec.rec_val |=3D (val) (0x0fffffff & (val))(__builtin_va_arg(*args,u32)); failing with: kvm_trace.c: In function 'kvm_add_trace': kvm_trace.c:66: error: 'val' undeclared (first use in this function) kvm_trace.c:66: error: (Each undeclared identifier is reported only once kvm_trace.c:66: error: for each function it appears in.) Obviously caused by the blank between macro definition and (val) which makes it a non-parameter macro. Additionally the two macro definitions below don't put () around the=20 parameter which is one of the golden macro rules to keep operator precedence=20 independent to what someone passes as argument to your macro. This patch fixes both issues, Hollis could you please fold it into "kvm_trace_nobitfields.diff" and add my signed-off-by then. Signed-off-by: Christian Ehrhardt --- [diffstat] kvm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) [diff] diff --git a/include/linux/kvm.h b/include/linux/kvm.h --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -331,12 +331,12 @@ struct kvm_trace_rec { } u; } __attribute__((packed)); =20 -#define TRACE_REC_EVENT_ID (val) \ +#define TRACE_REC_EVENT_ID(val) \ (0x0fffffff & (val)) -#define TRACE_REC_NUM_DATA_ARGS (val) \ - (0x70000000 & (val << 28)) -#define TRACE_REC_TCS (val) \ - (0x80000000 & (val << 31)) +#define TRACE_REC_NUM_DATA_ARGS(val) \ + (0x70000000 & ((val) << 28)) +#define TRACE_REC_TCS(val) \ + (0x80000000 & ((val) << 31)) =20 #define KVMIO 0xAE =20 --=20 Gr=FCsse / regards,=20 Christian Ehrhardt IBM Linux Technology Center, Open Virtualization