From: Malcolm Priestley Date: Mon, 26 May 2014 12:59:04 +0000 (+0100) Subject: staging: vt6656: Create new function to set led state. X-Git-Tag: next-20140530~19^2~174 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=96f6975bd3841a227185712bbd672c278e481816;p=karo-tx-linux.git staging: vt6656: Create new function to set led state. 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index 5f631c8f522b..12b6436eb2a3 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -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); } } } diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index e7b7ca5586cc..0a8e4384d83b 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -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); diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index 51e4a355d9d7..fdb244f9e3a9 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -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; +} diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h index 6e45d479bffb..986ca95f7204 100644 --- a/drivers/staging/vt6656/mac.h +++ b/drivers/staging/vt6656/mac.h @@ -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__ */ diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 6cc056d07a22..df206e607680 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -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); diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index aae573baec1b..79f7463be443 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -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); } } diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index 4f46aa6e25f5..8cb80a677335 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -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",