Skip to content

Commit e681bb2

Browse files
Oscar Cartergregkh
authored andcommitted
staging: vt6656: Use DIV_ROUND_UP macro instead of specific code
Use DIV_ROUND_UP macro instead of specific code with the same purpose. Also, remove the unused variables. Signed-off-by: Oscar Carter <[email protected]> Reviewed-by: Quentin Deslandes <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a10079c commit e681bb2

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

drivers/staging/vt6656/baseband.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424

2525
#include <linux/bits.h>
26+
#include <linux/kernel.h>
2627
#include "mac.h"
2728
#include "baseband.h"
2829
#include "rf.h"
@@ -133,7 +134,6 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type,
133134
{
134135
unsigned int frame_time;
135136
unsigned int preamble;
136-
unsigned int tmp;
137137
unsigned int rate = 0;
138138

139139
if (tx_rate > RATE_54M)
@@ -147,20 +147,11 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type,
147147
else
148148
preamble = 192;
149149

150-
frame_time = (frame_length * 80) / rate;
151-
tmp = (frame_time * rate) / 80;
152-
153-
if (frame_length != tmp)
154-
frame_time++;
155-
150+
frame_time = DIV_ROUND_UP(frame_length * 80, rate);
156151
return preamble + frame_time;
157152
}
158-
frame_time = (frame_length * 8 + 22) / rate;
159-
tmp = ((frame_time * rate) - 22) / 8;
160-
161-
if (frame_length != tmp)
162-
frame_time++;
163153

154+
frame_time = DIV_ROUND_UP(frame_length * 8 + 22, rate);
164155
frame_time = frame_time * 4;
165156

166157
if (pkt_type != PK_TYPE_11A)
@@ -214,11 +205,7 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length,
214205

215206
break;
216207
case RATE_5M:
217-
count = (bit_count * 10) / 55;
218-
tmp = (count * 55) / 10;
219-
220-
if (tmp != bit_count)
221-
count++;
208+
count = DIV_ROUND_UP(bit_count * 10, 55);
222209

223210
if (preamble_type == 1)
224211
phy->signal = 0x0a;

0 commit comments

Comments
 (0)