Re: [PATCH] use offsetof for GET_CHANNEL_INDEX
Mathieu Desnoyers <[email protected]> Tue, 19 Feb 2008 15:48:55 -0500
| Newsgroups | gmane.linux.kernel.tracing |
|---|---|
| Message-ID | <20080219204855.GC16701@Krystal> |
* Jan Kiszka ([email protected]) wrote: > This cleans up a home-brewed macro, fixing several compiler warnings on > x86-64. > Hrm, weird, I never got this warning on x86_64. I'll apply anyway, since it's a lot cleaner. Thanks! Mathieu > 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) > _______________________________________________ > Ltt-dev mailing list > [email protected] > http://listserv.shafik.org/mailman/listinfo/ltt-dev > -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68