From 5b59eadfbf215aa20885d06ce81f263df99cc009 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 14 May 2004 05:40:57 -0700 Subject: [PATCH] MSEC_TO_JIFFIES consolidation From: Ingo Molnar We have various different implementations of MSEC[S]_TO_JIFFIES and JIFFIES_TO_MSEC[S]. We recently had a compile-time clash in USB. Fix all that up. - The SCTP version was very inefficient. Hopefully this version is accurate enough. - Optimise for the HZ=100 and HZ=1000 cases - This version does round-up, so sleep(9 milliseconds) works OK on 100HZ. - We still have lots of jiffies_to_msec and msec_to_jiffies implementations. From: William Lee Irwin III Optimize the cases where HZ is a divisor of 1000 or vice-versa in JIFFIES_TO_MSECS() and MSECS_TO_JIFFIES() by allowing the nonvanishing(!) integral ratios to appear as a parenthesized expressions eligible for constant folding optimizations. From: me Use typesafe inlines for the jiffies-to-millisecond conversion functions. This means that milliseconds officially takes the type `unsigned int'. All current callers seem to be OK with that. Drivers need to be fixed up to use this instead of their private versions. --- include/net/irda/irda.h | 2 -- include/net/sctp/sctp.h | 5 ----- 2 files changed, 7 deletions(-) (limited to 'include/net') diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h index 44ac1b099a3b..497f6a3977bd 100644 --- a/include/net/irda/irda.h +++ b/include/net/irda/irda.h @@ -83,8 +83,6 @@ if(!(expr)) do { \ #define MESSAGE(args...) printk(KERN_INFO args) #define ERROR(args...) printk(KERN_ERR args) -#define MSECS_TO_JIFFIES(ms) (((ms)*HZ+999)/1000) - /* * Magic numbers used by Linux-IrDA. Random numbers which must be unique to * give the best protection diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index efceb30d69bb..17d0f9adce09 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -116,11 +116,6 @@ #define SCTP_STATIC static #endif -#define MSECS_TO_JIFFIES(msec) \ - (((msec / 1000) * HZ) + ((msec % 1000) * HZ) / 1000) -#define JIFFIES_TO_MSECS(jiff) \ - (((jiff / HZ) * 1000) + ((jiff % HZ) * 1000) / HZ) - /* * Function declarations. */ -- cgit v1.2.3