diff options
-rw-r--r-- | include/net/sock.h | 3 | ||||
-rw-r--r-- | net/bridge/br_stp_bpdu.c | 2 | ||||
-rw-r--r-- | net/dccp/ackvec.c | 5 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_crypt_ccmp.c | 5 | ||||
-rw-r--r-- | net/ipv4/inet_diag.c | 5 | ||||
-rw-r--r-- | net/ipv4/inet_timewait_sock.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 3 | ||||
-rw-r--r-- | net/mac80211/aes_ccm.c | 5 | ||||
-rw-r--r-- | net/mac80211/tx.c | 2 | ||||
-rw-r--r-- | net/sunrpc/svcsock.c | 3 |
10 files changed, 21 insertions, 16 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index dfeb8b13024f..802c670ba820 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #ifndef _SOCK_H | 40 | #ifndef _SOCK_H |
41 | #define _SOCK_H | 41 | #define _SOCK_H |
42 | 42 | ||
43 | #include <linux/kernel.h> | ||
43 | #include <linux/list.h> | 44 | #include <linux/list.h> |
44 | #include <linux/timer.h> | 45 | #include <linux/timer.h> |
45 | #include <linux/cache.h> | 46 | #include <linux/cache.h> |
@@ -702,7 +703,7 @@ extern int sk_stream_mem_schedule(struct sock *sk, int size, int kind); | |||
702 | 703 | ||
703 | static inline int sk_stream_pages(int amt) | 704 | static inline int sk_stream_pages(int amt) |
704 | { | 705 | { |
705 | return (amt + SK_STREAM_MEM_QUANTUM - 1) / SK_STREAM_MEM_QUANTUM; | 706 | return DIV_ROUND_UP(amt, SK_STREAM_MEM_QUANTUM); |
706 | } | 707 | } |
707 | 708 | ||
708 | static inline void sk_stream_mem_reclaim(struct sock *sk) | 709 | static inline void sk_stream_mem_reclaim(struct sock *sk) |
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index 60112bce6698..14f0c888eecc 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c | |||
@@ -64,7 +64,7 @@ static inline int br_get_ticks(const unsigned char *src) | |||
64 | { | 64 | { |
65 | unsigned long ticks = ntohs(get_unaligned((__be16 *)src)); | 65 | unsigned long ticks = ntohs(get_unaligned((__be16 *)src)); |
66 | 66 | ||
67 | return (ticks * HZ + STP_HZ - 1) / STP_HZ; | 67 | return DIV_ROUND_UP(ticks * HZ, STP_HZ); |
68 | } | 68 | } |
69 | 69 | ||
70 | /* called under bridge lock */ | 70 | /* called under bridge lock */ |
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c index 3f8984b5f6e8..83378f379f72 100644 --- a/net/dccp/ackvec.c +++ b/net/dccp/ackvec.c | |||
@@ -69,9 +69,8 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) | |||
69 | struct dccp_sock *dp = dccp_sk(sk); | 69 | struct dccp_sock *dp = dccp_sk(sk); |
70 | struct dccp_ackvec *av = dp->dccps_hc_rx_ackvec; | 70 | struct dccp_ackvec *av = dp->dccps_hc_rx_ackvec; |
71 | /* Figure out how many options do we need to represent the ackvec */ | 71 | /* Figure out how many options do we need to represent the ackvec */ |
72 | const u16 nr_opts = (av->dccpav_vec_len + | 72 | const u16 nr_opts = DIV_ROUND_UP(av->dccpav_vec_len, |
73 | DCCP_MAX_ACKVEC_OPT_LEN - 1) / | 73 | DCCP_MAX_ACKVEC_OPT_LEN); |
74 | DCCP_MAX_ACKVEC_OPT_LEN; | ||
75 | u16 len = av->dccpav_vec_len + 2 * nr_opts, i; | 74 | u16 len = av->dccpav_vec_len + 2 * nr_opts, i; |
76 | u32 elapsed_time; | 75 | u32 elapsed_time; |
77 | const unsigned char *tail, *from; | 76 | const unsigned char *tail, *from; |
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c index b016b4104de6..2e6b099fc84c 100644 --- a/net/ieee80211/ieee80211_crypt_ccmp.c +++ b/net/ieee80211/ieee80211_crypt_ccmp.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * more details. | 9 | * more details. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | ||
12 | #include <linux/err.h> | 13 | #include <linux/err.h> |
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
@@ -241,7 +242,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
241 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | 242 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
242 | ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); | 243 | ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); |
243 | 244 | ||
244 | blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; | 245 | blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); |
245 | last = data_len % AES_BLOCK_LEN; | 246 | last = data_len % AES_BLOCK_LEN; |
246 | 247 | ||
247 | for (i = 1; i <= blocks; i++) { | 248 | for (i = 1; i <= blocks; i++) { |
@@ -351,7 +352,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
351 | ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); | 352 | ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); |
352 | xor_block(mic, b, CCMP_MIC_LEN); | 353 | xor_block(mic, b, CCMP_MIC_LEN); |
353 | 354 | ||
354 | blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; | 355 | blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); |
355 | last = data_len % AES_BLOCK_LEN; | 356 | last = data_len % AES_BLOCK_LEN; |
356 | 357 | ||
357 | for (i = 1; i <= blocks; i++) { | 358 | for (i = 1; i <= blocks; i++) { |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index def007ec1d6f..686ddd62f71a 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * 2 of the License, or (at your option) any later version. | 11 | * 2 of the License, or (at your option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/kernel.h> | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/types.h> | 16 | #include <linux/types.h> |
16 | #include <linux/fcntl.h> | 17 | #include <linux/fcntl.h> |
@@ -112,7 +113,7 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
112 | } | 113 | } |
113 | #endif | 114 | #endif |
114 | 115 | ||
115 | #define EXPIRES_IN_MS(tmo) ((tmo - jiffies) * 1000 + HZ - 1) / HZ | 116 | #define EXPIRES_IN_MS(tmo) DIV_ROUND_UP((tmo - jiffies) * 1000, HZ) |
116 | 117 | ||
117 | if (icsk->icsk_pending == ICSK_TIME_RETRANS) { | 118 | if (icsk->icsk_pending == ICSK_TIME_RETRANS) { |
118 | r->idiag_timer = 1; | 119 | r->idiag_timer = 1; |
@@ -190,7 +191,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, | |||
190 | r->id.idiag_dst[0] = tw->tw_daddr; | 191 | r->id.idiag_dst[0] = tw->tw_daddr; |
191 | r->idiag_state = tw->tw_substate; | 192 | r->idiag_state = tw->tw_substate; |
192 | r->idiag_timer = 3; | 193 | r->idiag_timer = 3; |
193 | r->idiag_expires = (tmo * 1000 + HZ - 1) / HZ; | 194 | r->idiag_expires = DIV_ROUND_UP(tmo * 1000, HZ); |
194 | r->idiag_rqueue = 0; | 195 | r->idiag_rqueue = 0; |
195 | r->idiag_wqueue = 0; | 196 | r->idiag_wqueue = 0; |
196 | r->idiag_uid = 0; | 197 | r->idiag_uid = 0; |
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 2586df09b9b6..4e189e28f306 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * From code orinally in TCP | 8 | * From code orinally in TCP |
9 | */ | 9 | */ |
10 | 10 | ||
11 | 11 | #include <linux/kernel.h> | |
12 | #include <net/inet_hashtables.h> | 12 | #include <net/inet_hashtables.h> |
13 | #include <net/inet_timewait_sock.h> | 13 | #include <net/inet_timewait_sock.h> |
14 | #include <net/ip.h> | 14 | #include <net/ip.h> |
@@ -292,7 +292,7 @@ void inet_twsk_schedule(struct inet_timewait_sock *tw, | |||
292 | if (timeo >= timewait_len) { | 292 | if (timeo >= timewait_len) { |
293 | slot = INET_TWDR_TWKILL_SLOTS - 1; | 293 | slot = INET_TWDR_TWKILL_SLOTS - 1; |
294 | } else { | 294 | } else { |
295 | slot = (timeo + twdr->period - 1) / twdr->period; | 295 | slot = DIV_ROUND_UP(timeo, twdr->period); |
296 | if (slot >= INET_TWDR_TWKILL_SLOTS) | 296 | if (slot >= INET_TWDR_TWKILL_SLOTS) |
297 | slot = INET_TWDR_TWKILL_SLOTS - 1; | 297 | slot = INET_TWDR_TWKILL_SLOTS - 1; |
298 | } | 298 | } |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index aff31427f525..18c64c74f6d5 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -247,6 +247,7 @@ | |||
247 | * TCP_CLOSE socket is finished | 247 | * TCP_CLOSE socket is finished |
248 | */ | 248 | */ |
249 | 249 | ||
250 | #include <linux/kernel.h> | ||
250 | #include <linux/module.h> | 251 | #include <linux/module.h> |
251 | #include <linux/types.h> | 252 | #include <linux/types.h> |
252 | #include <linux/fcntl.h> | 253 | #include <linux/fcntl.h> |
@@ -2210,7 +2211,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | |||
2210 | goto out; | 2211 | goto out; |
2211 | 2212 | ||
2212 | mss = skb_shinfo(skb)->gso_size; | 2213 | mss = skb_shinfo(skb)->gso_size; |
2213 | skb_shinfo(skb)->gso_segs = (skb->len + mss - 1) / mss; | 2214 | skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss); |
2214 | 2215 | ||
2215 | segs = NULL; | 2216 | segs = NULL; |
2216 | goto out; | 2217 | goto out; |
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c index e55569bee7d0..bf7ba128b963 100644 --- a/net/mac80211/aes_ccm.c +++ b/net/mac80211/aes_ccm.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/kernel.h> | ||
10 | #include <linux/types.h> | 11 | #include <linux/types.h> |
11 | #include <linux/crypto.h> | 12 | #include <linux/crypto.h> |
12 | #include <linux/err.h> | 13 | #include <linux/err.h> |
@@ -63,7 +64,7 @@ void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch, | |||
63 | s_0 = scratch + AES_BLOCK_LEN; | 64 | s_0 = scratch + AES_BLOCK_LEN; |
64 | e = scratch + 2 * AES_BLOCK_LEN; | 65 | e = scratch + 2 * AES_BLOCK_LEN; |
65 | 66 | ||
66 | num_blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; | 67 | num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); |
67 | last_len = data_len % AES_BLOCK_LEN; | 68 | last_len = data_len % AES_BLOCK_LEN; |
68 | aes_ccm_prepare(tfm, b_0, aad, b, s_0, b); | 69 | aes_ccm_prepare(tfm, b_0, aad, b, s_0, b); |
69 | 70 | ||
@@ -102,7 +103,7 @@ int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch, | |||
102 | s_0 = scratch + AES_BLOCK_LEN; | 103 | s_0 = scratch + AES_BLOCK_LEN; |
103 | a = scratch + 2 * AES_BLOCK_LEN; | 104 | a = scratch + 2 * AES_BLOCK_LEN; |
104 | 105 | ||
105 | num_blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; | 106 | num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); |
106 | last_len = data_len % AES_BLOCK_LEN; | 107 | last_len = data_len % AES_BLOCK_LEN; |
107 | aes_ccm_prepare(tfm, b_0, aad, b, s_0, a); | 108 | aes_ccm_prepare(tfm, b_0, aad, b, s_0, a); |
108 | 109 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 457166889cc7..4ab29282dd67 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -476,7 +476,7 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx) | |||
476 | hdrlen = ieee80211_get_hdrlen(tx->fc); | 476 | hdrlen = ieee80211_get_hdrlen(tx->fc); |
477 | payload_len = first->len - hdrlen; | 477 | payload_len = first->len - hdrlen; |
478 | per_fragm = frag_threshold - hdrlen - FCS_LEN; | 478 | per_fragm = frag_threshold - hdrlen - FCS_LEN; |
479 | num_fragm = (payload_len + per_fragm - 1) / per_fragm; | 479 | num_fragm = DIV_ROUND_UP(payload_len, per_fragm); |
480 | 480 | ||
481 | frags = kzalloc(num_fragm * sizeof(struct sk_buff *), GFP_ATOMIC); | 481 | frags = kzalloc(num_fragm * sizeof(struct sk_buff *), GFP_ATOMIC); |
482 | if (!frags) | 482 | if (!frags) |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 036ab520df21..406b3e687952 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | 19 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/kernel.h> | ||
22 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
23 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
24 | #include <linux/fcntl.h> | 25 | #include <linux/fcntl.h> |
@@ -877,7 +878,7 @@ svc_udp_recvfrom(struct svc_rqst *rqstp) | |||
877 | } else { | 878 | } else { |
878 | rqstp->rq_arg.page_len = len - rqstp->rq_arg.head[0].iov_len; | 879 | rqstp->rq_arg.page_len = len - rqstp->rq_arg.head[0].iov_len; |
879 | rqstp->rq_respages = rqstp->rq_pages + 1 + | 880 | rqstp->rq_respages = rqstp->rq_pages + 1 + |
880 | (rqstp->rq_arg.page_len + PAGE_SIZE - 1)/ PAGE_SIZE; | 881 | DIV_ROUND_UP(rqstp->rq_arg.page_len, PAGE_SIZE); |
881 | } | 882 | } |
882 | 883 | ||
883 | if (serv->sv_stats) | 884 | if (serv->sv_stats) |