Subject: [PATCH] kvmppc: kvmtrace: fix TRACE_REC_* macro definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Subject: [PATCH] kvmppc: kvmtrace: fix TRACE_REC_* macro definitions

From: Christian Ehrhardt <ehrhardt@xxxxxxxxxxxxxxxxxx>

The current patch kvm_trace_nobitfields.diff in the kvmppc.hg-dev repo
doesn't compile.

code:
  rec.rec_val     |= TRACE_REC_EVENT_ID(va_arg(*args, u32));
+makro
  #define TRACE_REC_EVENT_ID (val) \
               (0x0fffffff & (val))

extended to:
  rec.rec_val |= (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 parameter which is one of the golden macro rules to keep operator precedence 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 <ehrhardt@xxxxxxxxxxxxxxxxxx>
---

[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));

-#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))

#define KVMIO 0xAE


--

Grüsse / regards, Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux