mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 11/13] hrtimer: fix multiple macro argument expansion
@ 2006-02-13  1:11 Roman Zippel
  2006-02-13 14:06 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Roman Zippel @ 2006-02-13  1:11 UTC (permalink / raw)
  To: Andrew Morton, tglx, linux-kernel


For two macros the arguments were expanded twice, change them to inline
functions to avoid it.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>

---

 include/linux/ktime.h |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Index: linux-2.6-git/include/linux/ktime.h
===================================================================
--- linux-2.6-git.orig/include/linux/ktime.h	2006-02-12 18:33:42.000000000 +0100
+++ linux-2.6-git/include/linux/ktime.h	2006-02-12 18:33:45.000000000 +0100
@@ -93,10 +93,16 @@ static inline ktime_t ktime_set(long sec
 		({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
 
 /* convert a timespec to ktime_t format: */
-#define timespec_to_ktime(ts)		ktime_set((ts).tv_sec, (ts).tv_nsec)
+static inline ktime_t timespec_to_ktime(struct timespec ts)
+{
+	return ktime_set(ts.tv_sec, ts.tv_nsec);
+}
 
 /* convert a timeval to ktime_t format: */
-#define timeval_to_ktime(tv)		ktime_set((tv).tv_sec, (tv).tv_usec * 1000)
+static inline ktime_t timeval_to_ktime(struct timeval tv)
+{
+	return ktime_set(tv.tv_sec, tv.tv_usec * NSEC_PER_USEC);
+}
 
 /* Map the ktime_t to timespec conversion to nsec_to_timespec function */
 #define ktime_to_timespec(kt)		nsec_to_timespec((kt).tv64)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 11/13] hrtimer: fix multiple macro argument expansion
  2006-02-13  1:11 [PATCH 11/13] hrtimer: fix multiple macro argument expansion Roman Zippel
@ 2006-02-13 14:06 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2006-02-13 14:06 UTC (permalink / raw)
  To: Roman Zippel; +Cc: Andrew Morton, tglx, linux-kernel


* Roman Zippel <zippel@linux-m68k.org> wrote:

> For two macros the arguments were expanded twice, change them to 
> inline functions to avoid it.
> 
> Signed-off-by: Roman Zippel <zippel@linux-m68k.org>

yep. We checked that there are no current users of that macro which 
could expose this double expansion, but still it's better to have this 
fixed in v2.6.16 too.

Acked-by: Ingo Molnar <mingo@elte.hu>

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-13 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-13  1:11 [PATCH 11/13] hrtimer: fix multiple macro argument expansion Roman Zippel
2006-02-13 14:06 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®