The bit rate can be found by multiplying the rate value by 5. Use rx_bitrate to compared to sband bitrates removing the need to find it by hw_value. Signed-off-by: Malcolm Priestley <tvboxspy@xxxxxxxxx> --- drivers/staging/vt6656/device.h | 1 - drivers/staging/vt6656/dpc.c | 21 ++++++--------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index e2fabe818b19..2f6567d92b83 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -264,7 +264,6 @@ struct vnt_private { struct usb_interface *intf; u64 tsf_time; - u8 rx_rate; u32 rx_buf_sz; int mc_list_count; diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index 2bcb29b11883..a55e2f6b09e3 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -35,14 +35,13 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb, u8 *rsr, *new_rsr, *rssi; __le64 *tsf_time; u32 frame_size; - int ii, r; - u8 *rx_rate, *sq, *sq_3; + int ii; + u8 *sq, *sq_3; u32 wbk_status; u8 *skb_data; u16 *pay_load_len; - u16 pay_load_with_padding; + u16 rx_bitrate, pay_load_with_padding; u8 rate_idx = 0; - u8 rate[MAX_RATE] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; long rx_dbm; skb = ptr_rcb->skb; @@ -66,8 +65,6 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb, skb_data = (u8 *)skb->data; - rx_rate = skb_data + 5; - /* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */ /* -8TSF - 4RSR - 4SQ3 - ?Padding */ @@ -85,23 +82,17 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb, } sband = hw->wiphy->bands[hw->conf.chandef.chan->band]; - - for (r = RATE_1M; r < MAX_RATE; r++) { - if (*rx_rate == rate[r]) - break; - } - - priv->rx_rate = r; + rx_bitrate = *(skb_data + 5) * 5; /* rx_rate * 5 */ for (ii = 0; ii < sband->n_bitrates; ii++) { - if (sband->bitrates[ii].hw_value == r) { + if (sband->bitrates[ii].bitrate == rx_bitrate) { rate_idx = ii; break; } } if (ii == sband->n_bitrates) { - dev_dbg(&priv->usb->dev, "Wrong RxRate %x\n", *rx_rate); + dev_dbg(&priv->usb->dev, "Wrong Rx Bit Rate %d\n", rx_bitrate); return false; } -- 2.24.0 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel