staging: vt6656: Create new function to set led state.
authorMalcolm Priestley <tvboxspy@gmail.com>
Mon, 26 May 2014 12:59:04 +0000 (13:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 May 2014 17:36:49 +0000 (10:36 -0700)
Create vnt_mac_set_led to set state and led.

state has two modes LEDSTS_TMLEN which sets the blink rate
on TX activity and LEDSTS_STS which sets the led.

As result of this patch ControlvMaskByte becomes dead code.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/bssdb.c
drivers/staging/vt6656/iwctl.c
drivers/staging/vt6656/mac.c
drivers/staging/vt6656/mac.h
drivers/staging/vt6656/main_usb.c
drivers/staging/vt6656/wcmd.c
drivers/staging/vt6656/wmgr.c

index 5f631c8f522bfce7d831cb25d6834c94b38b4f08..12b6436eb2a3e02eaa62deb1d784bf427b391dac 100644 (file)
@@ -1015,10 +1015,10 @@ void BSSvSecondCallBack(struct work_struct *work)
                                pMgmt->eCurrState = WMAC_STATE_IDLE;
                                netif_stop_queue(pDevice->dev);
                                pDevice->bLinkPass = false;
-                               ControlvMaskByte(pDevice,
-                                                MESSAGE_REQUEST_MACREG,
-                                                MAC_REG_PAPEDELAY, LEDSTS_STS,
-                                                LEDSTS_SLOW);
+
+                               vnt_mac_set_led(pDevice, LEDSTS_STS,
+                                                               LEDSTS_SLOW);
+
                                pDevice->bRoaming = true;
                                pDevice->bIsRoaming = false;
 
@@ -1126,10 +1126,8 @@ void BSSvSecondCallBack(struct work_struct *work)
                                pMgmt->eCurrState = WMAC_STATE_STARTED;
                                netif_stop_queue(pDevice->dev);
                                pDevice->bLinkPass = false;
-                               ControlvMaskByte(pDevice,
-                                                MESSAGE_REQUEST_MACREG,
-                                                MAC_REG_PAPEDELAY, LEDSTS_STS,
-                                                LEDSTS_SLOW);
+                               vnt_mac_set_led(pDevice, LEDSTS_STS,
+                                                               LEDSTS_SLOW);
                        }
                }
        }
index e7b7ca5586cccc31409ec1be5d4c05ef3d980fb6..0a8e4384d83bdc601a4f8dc4b4e59a4fd1247a75 100644 (file)
@@ -442,9 +442,7 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
                                memset(pMgmt->abyCurrBSSID, 0, 6);
                        }
 
-                       ControlvMaskByte(pDevice,
-                               MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY,
-                                       LEDSTS_STS, LEDSTS_SLOW);
+                       vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_SLOW);
 
                        netif_stop_queue(pDevice->dev);
 
index 51e4a355d9d7a9b6de6af4f1b687e7e09220543d..fdb244f9e3a95dc763f530faedfb4ca5ed04c3a4 100644 (file)
@@ -240,3 +240,16 @@ void MACvWriteBeaconInterval(struct vnt_private *priv, u16 interval)
        vnt_control_out(priv, MESSAGE_TYPE_WRITE,
                MAC_REG_BI, MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
 }
+
+void vnt_mac_set_led(struct vnt_private *priv, u8 state, u8 led)
+{
+       u8 data[2];
+
+       data[0] = led;
+       data[1] = state;
+
+       vnt_control_out(priv, MESSAGE_TYPE_WRITE_MASK, MAC_REG_PAPEDELAY,
+                       MESSAGE_REQUEST_MACREG, ARRAY_SIZE(data), data);
+
+       return;
+}
index 6e45d479bffb6969c8efd731f5af98fa43c87349..986ca95f7204157ac5200544e781eea5b2d3c3d2 100644 (file)
@@ -428,5 +428,6 @@ void MACvDisableProtectMD(struct vnt_private *);
 void MACvEnableBarkerPreambleMd(struct vnt_private *);
 void MACvDisableBarkerPreambleMd(struct vnt_private *);
 void MACvWriteBeaconInterval(struct vnt_private *, u16);
+void vnt_mac_set_led(struct vnt_private *priv, u8, u8);
 
 #endif /* __MAC_H__ */
index 6cc056d07a222718a182089cdcac6797962857ef..df206e607680e92400835ab45f118a4405af2f15 100644 (file)
@@ -551,11 +551,9 @@ static int device_init_registers(struct vnt_private *pDevice)
 
        }
 
-       ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG,
-                               MAC_REG_PAPEDELAY, LEDSTS_TMLEN, 0x38);
+       vnt_mac_set_led(pDevice, LEDSTS_TMLEN, 0x38);
 
-       ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG,
-                               MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
+       vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_SLOW);
 
        MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL0, 0x01);
 
index aae573baec1bf40f46f8bd6bc32b9ff85cd9c3e4..79f7463be443a6f8724127d41606201281f7a049 100644 (file)
@@ -426,7 +426,9 @@ void vRunCommand(struct work_struct *work)
                                             (8),
                                             &Status);
                        pDevice->bLinkPass = false;
-                       ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
+
+                       vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_SLOW);
+
                        // unlock command busy
                        pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
                        pItemSSID->len = 0;
@@ -472,7 +474,8 @@ void vRunCommand(struct work_struct *work)
                        }
                        netif_stop_queue(pDevice->dev);
                        pDevice->bLinkPass = false;
-                       ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
+
+                       vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_SLOW);
                }
                // set initial state
                pMgmt->eCurrState = WMAC_STATE_IDLE;
@@ -507,7 +510,9 @@ void vRunCommand(struct work_struct *work)
                                if (netif_queue_stopped(pDevice->dev))
                                        netif_wake_queue(pDevice->dev);
                                pDevice->bLinkPass = true;
-                               ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER);
+
+                               vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_INTER);
+
                                pMgmt->sNodeDBTable[0].bActive = true;
                                pMgmt->sNodeDBTable[0].uInActiveCount = 0;
                        } else {
@@ -538,7 +543,6 @@ void vRunCommand(struct work_struct *work)
                                s_bClearBSSID_SCAN(pDevice);
 /*
                                pDevice->bLinkPass = true;
-                               ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER);
                                if (netif_queue_stopped(pDevice->dev)){
                                        netif_wake_queue(pDevice->dev);
                                }
@@ -600,7 +604,9 @@ void vRunCommand(struct work_struct *work)
                        pDevice->byLinkWaitCount = 0;
                        pDevice->byReAssocCount = 0;
                        pDevice->bLinkPass = true;
-                       ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER);
+
+                       vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_INTER);
+
                        s_bClearBSSID_SCAN(pDevice);
 
                        if (netif_queue_stopped(pDevice->dev))
@@ -626,7 +632,8 @@ void vRunCommand(struct work_struct *work)
                        pMgmt->eCurrState = WMAC_STATE_IDLE;
                        pMgmt->eCurrMode = WMAC_MODE_STANDBY;
                        pDevice->bLinkPass = false;
-                       ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
+
+                       vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_SLOW);
 
                        BSSvClearNodeDBTable(pDevice, 0);
 
@@ -647,7 +654,9 @@ void vRunCommand(struct work_struct *work)
                        if (netif_queue_stopped(pDevice->dev))
                                netif_wake_queue(pDevice->dev);
                        pDevice->bLinkPass = true;
-                       ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER);
+
+                       vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_INTER);
+
                        schedule_delayed_work(&pDevice->second_callback_work, HZ);
                }
                break;
@@ -791,14 +800,17 @@ void vRunCommand(struct work_struct *work)
                                netif_stop_queue(pDevice->dev);
                                CARDbRadioPowerOff(pDevice);
                                MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD);
-                               ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_OFF);
+
+                               vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_OFF);
+
                                pDevice->bHWRadioOff = true;
                        } else {
                                DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_ON........................\n");
                                pDevice->bHWRadioOff = false;
                                CARDbRadioPowerOn(pDevice);
                                MACvRegBitsOff(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD);
-                               ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_ON);
+
+                               vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_ON);
                        }
                }
 
index 4f46aa6e25f5fb3a91b9c6483445c98122e3f6bd..8cb80a677335fd6e7fe616b0ae63fbe0956a1e1a 100644 (file)
@@ -756,7 +756,8 @@ static void s_vMgrRxAssocResponse(struct vnt_private *pDevice,
             pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
             DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Link with AP(SSID): %s\n", pItemSSID->abySSID);
             pDevice->bLinkPass = true;
-            ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER);
+
+           vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_INTER);
 
        //if(pDevice->bWPASuppWextEnabled == true)
           {
@@ -1398,7 +1399,8 @@ static void s_vMgrRxDeauthentication(struct vnt_private *pDevice,
                     pMgmt->eCurrState = WMAC_STATE_IDLE;
                     netif_stop_queue(pDevice->dev);
                     pDevice->bLinkPass = false;
-                    ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW);
+
+                   vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_SLOW);
                 }
             }
 
@@ -1883,7 +1885,9 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true)
                 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed] \n");
                 pMgmt->eCurrState = WMAC_STATE_JOINTED;
                 pDevice->bLinkPass = true;
-                ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER);
+
+               vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_INTER);
+
                 if (netif_queue_stopped(pDevice->dev)){
                     netif_wake_queue(pDevice->dev);
                 }
@@ -2488,7 +2492,9 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus)
             // Adopt BSS state in Adapter Device Object
            pDevice->op_mode = NL80211_IFTYPE_ADHOC;
             pDevice->bLinkPass = true;
-            ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER);
+
+           vnt_mac_set_led(pDevice, LEDSTS_STS, LEDSTS_INTER);
+
             memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN);
 
                DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join IBSS ok:%pM\n",
This page took 0.042694 seconds and 5 git commands to generate.