diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2007-08-28 18:50:33 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:48:37 -0400 |
commit | 172589ccdde41b59861c92c4a971b95514ef24e3 (patch) | |
tree | ae775e6db4cb85aad1c74b6d93ba359f9dfe88ea /net/mac80211 | |
parent | c45248c70125cc374fdf264659643276c72801bf (diff) |
[NET]: DIV_ROUND_UP cleanup (part two)
Hopefully captured all single statement cases under net/. I'm
not too sure if there is some policy about #includes that are
"guaranteed" (ie., in the current tree) to be available through
some other #included header, so I just added linux/kernel.h to
each changed file that didn't #include it previously.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/aes_ccm.c | 5 | ||||
-rw-r--r-- | net/mac80211/tx.c | 2 |
2 files changed, 4 insertions, 3 deletions
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) |