[PATCH] use offsetof for GET_CHANNEL_INDEX

Jan Kiszka <[email protected]> Mon, 18 Feb 2008 18:32:13 +0100
Newsgroups gmane.linux.kernel.tracing
Message-ID <[email protected]>
This cleans up a home-brewed macro, fixing several compiler warnings on
x86-64.

Signed-off-by: Jan Kiszka <[email protected]>

---
 include/linux/ltt-tracer.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/include/linux/ltt-tracer.h
===================================================================
--- a/include/linux/ltt-tracer.h
+++ b/include/linux/ltt-tracer.h
@@ -405,7 +405,7 @@ static inline unsigned int ltt_subbuf_he
 
 /* Get the offset of the channel in the ltt_trace_struct */
 #define GET_CHANNEL_INDEX(chan)	\
-	(unsigned int)&((struct ltt_trace_struct *)NULL)->channel.chan
+	offsetof(struct ltt_trace_struct, channel.chan)
 
 static inline struct ltt_channel_struct *ltt_get_channel_from_index(
 		struct ltt_trace_struct *trace, unsigned int index)