staging: vt6656: Delete int.c/h file and move functions to usbpipe
authorMalcolm Priestley <tvboxspy@gmail.com>
Mon, 2 Mar 2020 21:22:49 +0000 (21:22 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Mar 2020 06:52:32 +0000 (07:52 +0100)
Move functions vnt_int_process_data and vnt_int_report_rate to
usbpipe.c and vnt_interrupt_data to usbpipe.h

These form part of the USB structure.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/bc21d3d7-81be-4ec1-030e-4e7a45f98238@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/Makefile
drivers/staging/vt6656/int.c [deleted file]
drivers/staging/vt6656/int.h [deleted file]
drivers/staging/vt6656/main_usb.c
drivers/staging/vt6656/usbpipe.c
drivers/staging/vt6656/usbpipe.h

index b64c0d8..60a41fe 100644 (file)
@@ -15,7 +15,6 @@ vt6656_stage-y +=     main_usb.o \
                        rf.o \
                        usbpipe.o \
                        channel.o \
-                       firmware.o \
-                       int.o
+                       firmware.o
 
 obj-$(CONFIG_VT6656) +=        vt6656_stage.o
diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
deleted file mode 100644 (file)
index 139be3f..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
- * All rights reserved.
- *
- * File: int.c
- *
- * Purpose: Handle USB interrupt endpoint
- *
- * Author: Jerry Chen
- *
- * Date: Apr. 2, 2004
- *
- * Functions:
- *
- * Revision History:
- *      04-02-2004 Jerry Chen:  Initial release
- *
- */
-
-#include "int.h"
-#include "mac.h"
-#include "power.h"
-#include "usbpipe.h"
-
-static int vnt_int_report_rate(struct vnt_private *priv, u8 pkt_no, u8 tsr)
-{
-       struct vnt_usb_send_context *context;
-       struct ieee80211_tx_info *info;
-       u8 tx_retry = (tsr & 0xf0) >> 4;
-       s8 idx;
-
-       if (pkt_no >= priv->num_tx_context)
-               return -EINVAL;
-
-       context = priv->tx_context[pkt_no];
-
-       if (!context->skb)
-               return -EINVAL;
-
-       info = IEEE80211_SKB_CB(context->skb);
-       idx = info->control.rates[0].idx;
-
-       ieee80211_tx_info_clear_status(info);
-
-       info->status.rates[0].count = tx_retry;
-
-       if (!(tsr & TSR_TMO)) {
-               info->status.rates[0].idx = idx;
-
-               if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
-                       info->flags |= IEEE80211_TX_STAT_ACK;
-       }
-
-       ieee80211_tx_status_irqsafe(priv->hw, context->skb);
-
-       context->in_use = false;
-
-       return 0;
-}
-
-void vnt_int_process_data(struct vnt_private *priv)
-{
-       struct vnt_interrupt_data *int_data;
-       struct ieee80211_low_level_stats *low_stats = &priv->low_stats;
-
-       dev_dbg(&priv->usb->dev, "---->s_nsInterruptProcessData\n");
-
-       int_data = (struct vnt_interrupt_data *)priv->int_buf.data_buf;
-
-       if (int_data->tsr0 & TSR_VALID)
-               vnt_int_report_rate(priv, int_data->pkt0, int_data->tsr0);
-
-       if (int_data->tsr1 & TSR_VALID)
-               vnt_int_report_rate(priv, int_data->pkt1, int_data->tsr1);
-
-       if (int_data->tsr2 & TSR_VALID)
-               vnt_int_report_rate(priv, int_data->pkt2, int_data->tsr2);
-
-       if (int_data->tsr3 & TSR_VALID)
-               vnt_int_report_rate(priv, int_data->pkt3, int_data->tsr3);
-
-       if (int_data->isr0 != 0) {
-               if (int_data->isr0 & ISR_BNTX &&
-                   priv->op_mode == NL80211_IFTYPE_AP)
-                       vnt_schedule_command(priv, WLAN_CMD_BECON_SEND);
-
-               if (int_data->isr0 & ISR_TBTT &&
-                   priv->hw->conf.flags & IEEE80211_CONF_PS) {
-                       if (!priv->wake_up_count)
-                               priv->wake_up_count =
-                                       priv->hw->conf.listen_interval;
-
-                       --priv->wake_up_count;
-
-                       /* Turn on wake up to listen next beacon */
-                       if (priv->wake_up_count == 1)
-                               vnt_schedule_command(priv,
-                                                    WLAN_CMD_TBTT_WAKEUP);
-               }
-               priv->current_tsf = le64_to_cpu(int_data->tsf);
-
-               low_stats->dot11RTSSuccessCount += int_data->rts_success;
-               low_stats->dot11RTSFailureCount += int_data->rts_fail;
-               low_stats->dot11ACKFailureCount += int_data->ack_fail;
-               low_stats->dot11FCSErrorCount += int_data->fcs_err;
-       }
-
-       priv->int_buf.in_use = false;
-}
diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h
deleted file mode 100644 (file)
index 0b7473a..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
- * All rights reserved.
- *
- * File: int.h
- *
- * Purpose:
- *
- * Author: Jerry Chen
- *
- * Date: Apr. 2, 2004
- *
- */
-
-#ifndef __INT_H__
-#define __INT_H__
-
-#include "device.h"
-
-struct vnt_interrupt_data {
-       u8 tsr0;
-       u8 pkt0;
-       u16 time0;
-       u8 tsr1;
-       u8 pkt1;
-       u16 time1;
-       u8 tsr2;
-       u8 pkt2;
-       u16 time2;
-       u8 tsr3;
-       u8 pkt3;
-       u16 time3;
-       __le64 tsf;
-       u8 isr0;
-       u8 isr1;
-       u8 rts_success;
-       u8 rts_fail;
-       u8 ack_fail;
-       u8 fcs_err;
-       u8 sw[2];
-} __packed;
-
-void vnt_int_process_data(struct vnt_private *priv);
-
-#endif /* __INT_H__ */
index a22f88b..37fff88 100644 (file)
@@ -35,7 +35,6 @@
 #include "firmware.h"
 #include "usbpipe.h"
 #include "channel.h"
-#include "int.h"
 
 /*
  * define module options
index 0e29dc2..c905f3e 100644 (file)
  *
  */
 
-#include "int.h"
 #include "rxtx.h"
 #include "dpc.h"
 #include "desc.h"
 #include "device.h"
 #include "usbpipe.h"
+#include "mac.h"
 
 #define USB_CTL_WAIT   500 /* ms */
 
@@ -139,6 +139,92 @@ int vnt_control_in_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 *data)
                              reg_off, reg, sizeof(u8), data);
 }
 
+static int vnt_int_report_rate(struct vnt_private *priv, u8 pkt_no, u8 tsr)
+{
+       struct vnt_usb_send_context *context;
+       struct ieee80211_tx_info *info;
+       u8 tx_retry = (tsr & 0xf0) >> 4;
+       s8 idx;
+
+       if (pkt_no >= priv->num_tx_context)
+               return -EINVAL;
+
+       context = priv->tx_context[pkt_no];
+
+       if (!context->skb)
+               return -EINVAL;
+
+       info = IEEE80211_SKB_CB(context->skb);
+       idx = info->control.rates[0].idx;
+
+       ieee80211_tx_info_clear_status(info);
+
+       info->status.rates[0].count = tx_retry;
+
+       if (!(tsr & TSR_TMO)) {
+               info->status.rates[0].idx = idx;
+
+               if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+                       info->flags |= IEEE80211_TX_STAT_ACK;
+       }
+
+       ieee80211_tx_status_irqsafe(priv->hw, context->skb);
+
+       context->in_use = false;
+
+       return 0;
+}
+
+static void vnt_int_process_data(struct vnt_private *priv)
+{
+       struct vnt_interrupt_data *int_data;
+       struct ieee80211_low_level_stats *low_stats = &priv->low_stats;
+
+       dev_dbg(&priv->usb->dev, "---->s_nsInterruptProcessData\n");
+
+       int_data = (struct vnt_interrupt_data *)priv->int_buf.data_buf;
+
+       if (int_data->tsr0 & TSR_VALID)
+               vnt_int_report_rate(priv, int_data->pkt0, int_data->tsr0);
+
+       if (int_data->tsr1 & TSR_VALID)
+               vnt_int_report_rate(priv, int_data->pkt1, int_data->tsr1);
+
+       if (int_data->tsr2 & TSR_VALID)
+               vnt_int_report_rate(priv, int_data->pkt2, int_data->tsr2);
+
+       if (int_data->tsr3 & TSR_VALID)
+               vnt_int_report_rate(priv, int_data->pkt3, int_data->tsr3);
+
+       if (int_data->isr0 != 0) {
+               if (int_data->isr0 & ISR_BNTX &&
+                   priv->op_mode == NL80211_IFTYPE_AP)
+                       vnt_schedule_command(priv, WLAN_CMD_BECON_SEND);
+
+               if (int_data->isr0 & ISR_TBTT &&
+                   priv->hw->conf.flags & IEEE80211_CONF_PS) {
+                       if (!priv->wake_up_count)
+                               priv->wake_up_count =
+                                       priv->hw->conf.listen_interval;
+
+                       --priv->wake_up_count;
+
+                       /* Turn on wake up to listen next beacon */
+                       if (priv->wake_up_count == 1)
+                               vnt_schedule_command(priv,
+                                                    WLAN_CMD_TBTT_WAKEUP);
+               }
+               priv->current_tsf = le64_to_cpu(int_data->tsf);
+
+               low_stats->dot11RTSSuccessCount += int_data->rts_success;
+               low_stats->dot11RTSFailureCount += int_data->rts_fail;
+               low_stats->dot11ACKFailureCount += int_data->ack_fail;
+               low_stats->dot11FCSErrorCount += int_data->fcs_err;
+       }
+
+       priv->int_buf.in_use = false;
+}
+
 static void vnt_start_interrupt_urb_complete(struct urb *urb)
 {
        struct vnt_private *priv = urb->context;
index 4e3341b..35697b5 100644 (file)
 
 #include "device.h"
 
+struct vnt_interrupt_data {
+       u8 tsr0;
+       u8 pkt0;
+       u16 time0;
+       u8 tsr1;
+       u8 pkt1;
+       u16 time1;
+       u8 tsr2;
+       u8 pkt2;
+       u16 time2;
+       u8 tsr3;
+       u8 pkt3;
+       u16 time3;
+       __le64 tsf;
+       u8 isr0;
+       u8 isr1;
+       u8 rts_success;
+       u8 rts_fail;
+       u8 ack_fail;
+       u8 fcs_err;
+       u8 sw[2];
+} __packed;
+
 #define VNT_REG_BLOCK_SIZE     64
 
 int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,