Commit e681bb28 authored by Oscar Carter's avatar Oscar Carter Committed by Greg Kroah-Hartman

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: default avatarOscar Carter <oscar.carter@gmx.com>
Reviewed-by: default avatarQuentin Deslandes <quentin.deslandes@itdev.co.uk>
Link: https://lore.kernel.org/r/20200326175902.14467-1-oscar.carter@gmx.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a10079c6
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
#include <linux/bits.h> #include <linux/bits.h>
#include <linux/kernel.h>
#include "mac.h" #include "mac.h"
#include "baseband.h" #include "baseband.h"
#include "rf.h" #include "rf.h"
...@@ -133,7 +134,6 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type, ...@@ -133,7 +134,6 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type,
{ {
unsigned int frame_time; unsigned int frame_time;
unsigned int preamble; unsigned int preamble;
unsigned int tmp;
unsigned int rate = 0; unsigned int rate = 0;
if (tx_rate > RATE_54M) if (tx_rate > RATE_54M)
...@@ -147,20 +147,11 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type, ...@@ -147,20 +147,11 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type,
else else
preamble = 192; preamble = 192;
frame_time = (frame_length * 80) / rate; frame_time = DIV_ROUND_UP(frame_length * 80, rate);
tmp = (frame_time * rate) / 80;
if (frame_length != tmp)
frame_time++;
return preamble + frame_time; return preamble + frame_time;
} }
frame_time = (frame_length * 8 + 22) / rate;
tmp = ((frame_time * rate) - 22) / 8;
if (frame_length != tmp)
frame_time++;
frame_time = DIV_ROUND_UP(frame_length * 8 + 22, rate);
frame_time = frame_time * 4; frame_time = frame_time * 4;
if (pkt_type != PK_TYPE_11A) if (pkt_type != PK_TYPE_11A)
...@@ -214,11 +205,7 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, ...@@ -214,11 +205,7 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length,
break; break;
case RATE_5M: case RATE_5M:
count = (bit_count * 10) / 55; count = DIV_ROUND_UP(bit_count * 10, 55);
tmp = (count * 55) / 10;
if (tmp != bit_count)
count++;
if (preamble_type == 1) if (preamble_type == 1)
phy->signal = 0x0a; phy->signal = 0x0a;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment