summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2004-06-29 00:40:01 -0700
committerDavid S. Miller <davem@nuts.davemloft.net>2004-06-29 00:40:01 -0700
commite560d2c3894250fd053f0e2235108c74b7f40b82 (patch)
treeb00b47350827116de152a59232a73a15c8bbd82b /include
parent4b53b3b771cee1f7c1c47ff6ad345bf7ff4c5311 (diff)
[PKT_SCHED]: Eliminate guard from TDIFF_SAFE.
The last argument in the PSCHED_TDIFF_SAFE is no longer used; only usage eliminated by previous patch. It gets rid of a bad macro usage. Also, can use the standard min_t macro which also eliminates the macro problem of double evaluation of bound. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/net/pkt_sched.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index f122aba715d9..2b9adcee816e 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -308,13 +308,13 @@ extern PSCHED_WATCHER psched_time_mark;
extern int psched_tod_diff(int delta_sec, int bound);
-#define PSCHED_TDIFF_SAFE(tv1, tv2, bound, guard) \
+#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \
({ \
int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \
int __delta = (tv1).tv_usec - (tv2).tv_usec; \
switch (__delta_sec) { \
default: \
- __delta = psched_tod_diff(__delta_sec, bound); guard; break; \
+ __delta = psched_tod_diff(__delta_sec, bound); break; \
case 2: \
__delta += 1000000; \
case 1: \
@@ -355,12 +355,8 @@ extern int psched_tod_diff(int delta_sec, int bound);
#else
#define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2))
-#define PSCHED_TDIFF_SAFE(tv1, tv2, bound, guard) \
-({ \
- long long __delta = (tv1) - (tv2); \
- if ( __delta > (long long)(bound)) { __delta = (bound); guard; } \
- __delta; \
-})
+#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \
+ min_t(long long, (tv1) - (tv2), bound)
#define PSCHED_TLESS(tv1, tv2) ((tv1) < (tv2))