]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
dccp: ccid2.c, ccid3.c use clamp(), clamp_t()
authorHarvey Harrison <harvey.harrison@gmail.com>
Fri, 2 May 2008 23:44:07 +0000 (16:44 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 May 2008 23:44:07 +0000 (16:44 -0700)
Makes the intention of the nested min/max clear.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dccp/ccids/ccid2.c
net/dccp/ccids/ccid3.c

index b5b52ebb2693d308d46deee5e6c5f6a5e27d7199..8e9580874216aff323c42d9b43cf8517027e7ed5 100644 (file)
@@ -716,7 +716,7 @@ static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk)
         * packets for new connections, following the rules from [RFC3390]".
         * We need to convert the bytes of RFC3390 into the packets of RFC 4341.
         */
-       hctx->ccid2hctx_cwnd = min(4U, max(2U, 4380U / dp->dccps_mss_cache));
+       hctx->ccid2hctx_cwnd = clamp(4380U / dp->dccps_mss_cache, 2U, 4U);
 
        /* Make sure that Ack Ratio is enabled and within bounds. */
        max_ratio = DIV_ROUND_UP(hctx->ccid2hctx_cwnd, 2);
index e76f460af0ea03a2c634d9e18137789ece6fd047..cd61dea2eea16bd1511f9c42e5648fc069ea4184 100644 (file)
@@ -88,8 +88,8 @@ static void ccid3_hc_tx_set_state(struct sock *sk,
 static inline u64 rfc3390_initial_rate(struct sock *sk)
 {
        const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
-       const __u32 w_init = min_t(__u32, 4 * hctx->ccid3hctx_s,
-                                  max_t(__u32, 2 * hctx->ccid3hctx_s, 4380));
+       const __u32 w_init = clamp_t(__u32, 4380U,
+                       2 * hctx->ccid3hctx_s, 4 * hctx->ccid3hctx_s);
 
        return scaled_div(w_init << 6, hctx->ccid3hctx_rtt);
 }