diff options
Diffstat (limited to 'drivers/staging/vt6656/baseband.c')
-rw-r--r-- | drivers/staging/vt6656/baseband.c | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index f18e059ce66b..a19a563d8bcc 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -22,6 +22,8 @@ * */ +#include <linux/bits.h> +#include <linux/kernel.h> #include "mac.h" #include "baseband.h" #include "rf.h" @@ -132,7 +134,6 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type, { unsigned int frame_time; unsigned int preamble; - unsigned int tmp; unsigned int rate = 0; if (tx_rate > RATE_54M) @@ -146,20 +147,11 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type, else preamble = 192; - frame_time = (frame_length * 80) / rate; - tmp = (frame_time * rate) / 80; - - if (frame_length != tmp) - frame_time++; - + frame_time = DIV_ROUND_UP(frame_length * 80, rate); 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; if (pkt_type != PK_TYPE_11A) @@ -213,11 +205,7 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, break; case RATE_5M: - count = (bit_count * 10) / 55; - tmp = (count * 55) / 10; - - if (tmp != bit_count) - count++; + count = DIV_ROUND_UP(bit_count * 10, 55); if (preamble_type == 1) phy->signal = 0x0a; @@ -367,9 +355,6 @@ int vnt_vt3184_init(struct vnt_private *priv) int ret = 0; u16 length; u8 *addr; - u8 *agc; - u16 length_agc; - u8 array[256]; u8 data; ret = vnt_control_in(priv, MESSAGE_TYPE_READ, 0, MESSAGE_REQUEST_EEPROM, @@ -386,8 +371,6 @@ int vnt_vt3184_init(struct vnt_private *priv) priv->bb_rx_conf = vnt_vt3184_al2230[10]; length = sizeof(vnt_vt3184_al2230); addr = vnt_vt3184_al2230; - agc = vnt_vt3184_agc; - length_agc = sizeof(vnt_vt3184_agc); priv->bb_vga[0] = 0x1C; priv->bb_vga[1] = 0x10; @@ -398,8 +381,6 @@ int vnt_vt3184_init(struct vnt_private *priv) priv->bb_rx_conf = vnt_vt3184_al2230[10]; length = sizeof(vnt_vt3184_al2230); addr = vnt_vt3184_al2230; - agc = vnt_vt3184_agc; - length_agc = sizeof(vnt_vt3184_agc); addr[0xd7] = 0x06; @@ -413,8 +394,6 @@ int vnt_vt3184_init(struct vnt_private *priv) priv->bb_rx_conf = vnt_vt3184_vt3226d0[10]; length = sizeof(vnt_vt3184_vt3226d0); addr = vnt_vt3184_vt3226d0; - agc = vnt_vt3184_agc; - length_agc = sizeof(vnt_vt3184_agc); priv->bb_vga[0] = 0x20; priv->bb_vga[1] = 0x10; @@ -430,8 +409,6 @@ int vnt_vt3184_init(struct vnt_private *priv) priv->bb_rx_conf = vnt_vt3184_vt3226d0[10]; length = sizeof(vnt_vt3184_vt3226d0); addr = vnt_vt3184_vt3226d0; - agc = vnt_vt3184_agc; - length_agc = sizeof(vnt_vt3184_agc); priv->bb_vga[0] = 0x20; priv->bb_vga[1] = 0x10; @@ -447,17 +424,14 @@ int vnt_vt3184_init(struct vnt_private *priv) goto end; } - memcpy(array, addr, length); - ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE, - MESSAGE_REQUEST_BBREG, length, array); + MESSAGE_REQUEST_BBREG, length, addr); if (ret) goto end; - memcpy(array, agc, length_agc); - ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, - MESSAGE_REQUEST_BBAGC, length_agc, array); + MESSAGE_REQUEST_BBAGC, + sizeof(vnt_vt3184_agc), vnt_vt3184_agc); if (ret) goto end; @@ -468,7 +442,7 @@ int vnt_vt3184_init(struct vnt_private *priv) if (ret) goto end; - ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01); + ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0)); if (ret) goto end; } else if (priv->rf_type == RF_VT3226D0) { @@ -477,7 +451,7 @@ int vnt_vt3184_init(struct vnt_private *priv) if (ret) goto end; - ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01); + ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0)); if (ret) goto end; } |