staging: vt6656: Move vnt_rx_data to usbpipe.c
authorMalcolm Priestley <tvboxspy@gmail.com>
Tue, 3 Mar 2020 20:41:05 +0000 (20:41 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Mar 2020 06:54:09 +0000 (07:54 +0100)
vnt_rx_data is a USB function and vnt_submit_rx_urb_complete is
the only caller therefore removing dpc.c/h files and becoming
static.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/d3937276-5a47-7184-e263-84d9c9cb5c7a@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/Makefile
drivers/staging/vt6656/dpc.c [deleted file]
drivers/staging/vt6656/dpc.h [deleted file]
drivers/staging/vt6656/main_usb.c
drivers/staging/vt6656/usbpipe.c

index 60a41fe62bede6799e0009da7a401eb5ceab6f69..375f54e9f58b5b9b974132df02114d9c983e242e 100644 (file)
@@ -9,7 +9,6 @@ vt6656_stage-y +=       main_usb.o \
                        baseband.o \
                        wcmd.o\
                        rxtx.o \
-                       dpc.o \
                        power.o \
                        key.o \
                        rf.o \
diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
deleted file mode 100644 (file)
index a0b60e7..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
- * All rights reserved.
- *
- * File: dpc.c
- *
- * Purpose: handle dpc rx functions
- *
- * Author: Lyndon Chen
- *
- * Date: May 20, 2003
- *
- * Functions:
- *
- * Revision History:
- *
- */
-
-#include "dpc.h"
-#include "device.h"
-#include "mac.h"
-#include "baseband.h"
-#include "rf.h"
-
-int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
-               unsigned long bytes_received)
-{
-       struct ieee80211_hw *hw = priv->hw;
-       struct ieee80211_supported_band *sband;
-       struct sk_buff *skb;
-       struct ieee80211_rx_status *rx_status;
-       struct vnt_rx_header *head;
-       struct vnt_rx_tail *tail;
-       u32 frame_size;
-       int ii;
-       u16 rx_bitrate, pay_load_with_padding;
-       u8 rate_idx = 0;
-       long rx_dbm;
-
-       skb = ptr_rcb->skb;
-       rx_status = IEEE80211_SKB_RXCB(skb);
-
-       /* [31:16]RcvByteCount ( not include 4-byte Status ) */
-       head = (struct vnt_rx_header *)skb->data;
-       frame_size = head->wbk_status >> 16;
-       frame_size += 4;
-
-       if (bytes_received != frame_size) {
-               dev_dbg(&priv->usb->dev, "------- WRONG Length 1\n");
-               return false;
-       }
-
-       if ((bytes_received > 2372) || (bytes_received <= 40)) {
-               /* Frame Size error drop this packet.*/
-               dev_dbg(&priv->usb->dev, "------ WRONG Length 2\n");
-               return false;
-       }
-
-       /* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
-       /* -8TSF - 4RSR - 4SQ3 - ?Padding */
-
-       /* if SQ3 the range is 24~27, if no SQ3 the range is 20~23 */
-
-       /*Fix hardware bug => PLCP_Length error */
-       if (((bytes_received - head->pay_load_len) > 27) ||
-           ((bytes_received - head->pay_load_len) < 24) ||
-           (bytes_received < head->pay_load_len)) {
-               dev_dbg(&priv->usb->dev, "Wrong PLCP Length %x\n",
-                       head->pay_load_len);
-               return false;
-       }
-
-       sband = hw->wiphy->bands[hw->conf.chandef.chan->band];
-       rx_bitrate = head->rx_rate * 5; /* rx_rate * 5 */
-
-       for (ii = 0; ii < sband->n_bitrates; ii++) {
-               if (sband->bitrates[ii].bitrate == rx_bitrate) {
-                       rate_idx = ii;
-                               break;
-               }
-       }
-
-       if (ii == sband->n_bitrates) {
-               dev_dbg(&priv->usb->dev, "Wrong Rx Bit Rate %d\n", rx_bitrate);
-               return false;
-       }
-
-       pay_load_with_padding = ((head->pay_load_len / 4) +
-               ((head->pay_load_len % 4) ? 1 : 0)) * 4;
-
-       tail = (struct vnt_rx_tail *)(skb->data +
-                                     sizeof(*head) + pay_load_with_padding);
-       priv->tsf_time = le64_to_cpu(tail->tsf_time);
-
-       if (tail->rsr & (RSR_IVLDTYP | RSR_IVLDLEN))
-               return false;
-
-       vnt_rf_rssi_to_dbm(priv, tail->rssi, &rx_dbm);
-
-       priv->bb_pre_ed_rssi = (u8)-rx_dbm + 1;
-       priv->current_rssi = priv->bb_pre_ed_rssi;
-
-       skb_pull(skb, sizeof(*head));
-       skb_trim(skb, head->pay_load_len);
-
-       rx_status->mactime = priv->tsf_time;
-       rx_status->band = hw->conf.chandef.chan->band;
-       rx_status->signal = rx_dbm;
-       rx_status->flag = 0;
-       rx_status->freq = hw->conf.chandef.chan->center_freq;
-
-       if (!(tail->rsr & RSR_CRCOK))
-               rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
-
-       rx_status->rate_idx = rate_idx;
-
-       if (tail->new_rsr & NEWRSR_DECRYPTOK)
-               rx_status->flag |= RX_FLAG_DECRYPTED;
-
-       ieee80211_rx_irqsafe(priv->hw, skb);
-
-       return true;
-}
diff --git a/drivers/staging/vt6656/dpc.h b/drivers/staging/vt6656/dpc.h
deleted file mode 100644 (file)
index e080add..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
- * All rights reserved.
- *
- * File: dpc.h
- *
- * Purpose:
- *
- * Author: Jerry Chen
- *
- * Date: Jun. 27, 2002
- *
- */
-
-#ifndef __DPC_H__
-#define __DPC_H__
-
-#include "device.h"
-
-int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
-               unsigned long bytes_received);
-
-#endif /* __RXTX_H__ */
index 37fff88a6687ffdec3d8b0b0f6494c984bcbeeff..30cb2eb7be3e99a7ca66d54f1938c978fa3e182e 100644 (file)
@@ -30,7 +30,6 @@
 #include "power.h"
 #include "wcmd.h"
 #include "rxtx.h"
-#include "dpc.h"
 #include "rf.h"
 #include "firmware.h"
 #include "usbpipe.h"
index c905f3eaf6554d4c075d5252e548215a78629726..b9e79755e7fa0761dc9835a7af798fbe1491b648 100644 (file)
  */
 
 #include "rxtx.h"
-#include "dpc.h"
 #include "desc.h"
 #include "device.h"
 #include "usbpipe.h"
 #include "mac.h"
+#include "rf.h"
 
 #define USB_CTL_WAIT   500 /* ms */
 
@@ -294,6 +294,106 @@ err:
        return ret;
 }
 
+static int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
+                      unsigned long bytes_received)
+{
+       struct ieee80211_hw *hw = priv->hw;
+       struct ieee80211_supported_band *sband;
+       struct sk_buff *skb;
+       struct ieee80211_rx_status *rx_status;
+       struct vnt_rx_header *head;
+       struct vnt_rx_tail *tail;
+       u32 frame_size;
+       int ii;
+       u16 rx_bitrate, pay_load_with_padding;
+       u8 rate_idx = 0;
+       long rx_dbm;
+
+       skb = ptr_rcb->skb;
+       rx_status = IEEE80211_SKB_RXCB(skb);
+
+       /* [31:16]RcvByteCount ( not include 4-byte Status ) */
+       head = (struct vnt_rx_header *)skb->data;
+       frame_size = head->wbk_status >> 16;
+       frame_size += 4;
+
+       if (bytes_received != frame_size) {
+               dev_dbg(&priv->usb->dev, "------- WRONG Length 1\n");
+               return false;
+       }
+
+       if ((bytes_received > 2372) || (bytes_received <= 40)) {
+               /* Frame Size error drop this packet.*/
+               dev_dbg(&priv->usb->dev, "------ WRONG Length 2\n");
+               return false;
+       }
+
+       /* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
+       /* -8TSF - 4RSR - 4SQ3 - ?Padding */
+
+       /* if SQ3 the range is 24~27, if no SQ3 the range is 20~23 */
+
+       /*Fix hardware bug => PLCP_Length error */
+       if (((bytes_received - head->pay_load_len) > 27) ||
+           ((bytes_received - head->pay_load_len) < 24) ||
+           (bytes_received < head->pay_load_len)) {
+               dev_dbg(&priv->usb->dev, "Wrong PLCP Length %x\n",
+                       head->pay_load_len);
+               return false;
+       }
+
+       sband = hw->wiphy->bands[hw->conf.chandef.chan->band];
+       rx_bitrate = head->rx_rate * 5; /* rx_rate * 5 */
+
+       for (ii = 0; ii < sband->n_bitrates; ii++) {
+               if (sband->bitrates[ii].bitrate == rx_bitrate) {
+                       rate_idx = ii;
+                               break;
+               }
+       }
+
+       if (ii == sband->n_bitrates) {
+               dev_dbg(&priv->usb->dev, "Wrong Rx Bit Rate %d\n", rx_bitrate);
+               return false;
+       }
+
+       pay_load_with_padding = ((head->pay_load_len / 4) +
+               ((head->pay_load_len % 4) ? 1 : 0)) * 4;
+
+       tail = (struct vnt_rx_tail *)(skb->data +
+                                     sizeof(*head) + pay_load_with_padding);
+       priv->tsf_time = le64_to_cpu(tail->tsf_time);
+
+       if (tail->rsr & (RSR_IVLDTYP | RSR_IVLDLEN))
+               return false;
+
+       vnt_rf_rssi_to_dbm(priv, tail->rssi, &rx_dbm);
+
+       priv->bb_pre_ed_rssi = (u8)-rx_dbm + 1;
+       priv->current_rssi = priv->bb_pre_ed_rssi;
+
+       skb_pull(skb, sizeof(*head));
+       skb_trim(skb, head->pay_load_len);
+
+       rx_status->mactime = priv->tsf_time;
+       rx_status->band = hw->conf.chandef.chan->band;
+       rx_status->signal = rx_dbm;
+       rx_status->flag = 0;
+       rx_status->freq = hw->conf.chandef.chan->center_freq;
+
+       if (!(tail->rsr & RSR_CRCOK))
+               rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
+
+       rx_status->rate_idx = rate_idx;
+
+       if (tail->new_rsr & NEWRSR_DECRYPTOK)
+               rx_status->flag |= RX_FLAG_DECRYPTED;
+
+       ieee80211_rx_irqsafe(priv->hw, skb);
+
+       return true;
+}
+
 static void vnt_submit_rx_urb_complete(struct urb *urb)
 {
        struct vnt_rcb *rcb = urb->context;