[PATCHv2 00/16] staging: rtl8192u: code clean up
Hi, Following comments from Dan Carpenter on my previous patch to limit the lines lengths for rtl8192u/r8192U_core.c [1], please find attached a set of patches splitting those operations. I also took care of keeping the code the more readable possible, some of those patchs even aim to clean the original content. The last patch gets rid of the last WARNING of checkpatch about the 80 lines, as well as the TO_DO_LIST macro that was used in that module to comment out unused or unusable code. Thanks, - R. [1]: https://lkml.org/lkml/2015/8/19/173 Raphaël Beamonte (16): staging: rtl8192u: r8192U_core: fix comments lines over 80 characters staging: rtl8192u: r8192U_core: add line breaks to keep lines under 80 characters staging: rtl8192u: r8192U_core: add temporary variables to keep lines under 80 characters staging: rtl8192u: r8192U_core: reverse conditions to get lines under 80 characters staging: rtl8192u: r8192U_core: rtl8192_adapter_start: reorganize function staging: rtl8192u: r8192U_core: rtl8192_read_eeprom_info: reorganize function staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable pprevious_stats to prev_stats staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable slide_beacon_adc_pwdb_index to sb_index staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable slide_beacon_adc_pwdb_statistics to sb_stats staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: remove unneeded variable staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable rfpath to rfp staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: reorganize function staging: rtl8192u: r8192U_core: rtl8192_tx: replace some inline conditions staging: rtl8192u: r8192U_core: rtl8192_ioctl: reorganize function staging: rtl8192u: r8192U_core: replace else { if() {} } by else if () {} staging: rtl8192u: remove all code framed by symbol TO_DO_LIST drivers/staging/rtl8192u/ieee80211/ieee80211.h |4 +- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 23 - .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c|4 - .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c|5 +- drivers/staging/rtl8192u/r8192U_core.c | 1548 drivers/staging/rtl8192u/r819xU_phy.c | 57 - 6 files changed, 940 insertions(+), 701 deletions(-) -- 2.5.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 01/16] staging: rtl8192u: r8192U_core: fix comments lines over 80 characters
Move, replace and reorganize comments to stay under 80 characters per line, as to follow the kernel code style. Some unuseful comments have been removed. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 232 ++--- 1 file changed, 153 insertions(+), 79 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index b143b36..5e9d0ac 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -143,17 +143,28 @@ struct CHANNEL_LIST { }; static struct CHANNEL_LIST ChannelPlan[] = { - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165}, 24}, /* FCC */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11}, /* IC */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21}, /* ETSI */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* Spain. Change to ETSI. */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* France. Change to ETSI. */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, /* MKK */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, /* MKK1 */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* Israel. */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, /* For 11a , TELEC */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, /* MIC */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 14} /* For Global Domain. 1-11:active scan, 12-14 passive scan. */ + /* FCC */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165}, 24}, + /* IC */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11}, + /* ETSI */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21}, + /* Spain. Change to ETSI. */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, + /* France. Change to ETSI. */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, + /* MKK */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, + /* MKK1 */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, + /* Israel. */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, + /* For 11a , TELEC */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, + /* MIC */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, + /* For Global Domain. 1-11:active scan, 12-14 passive scan. */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 14} }; static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) @@ -194,7 +205,10 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) break; case COUNTRY_CODE_GLOBAL_DOMAIN: - GET_DOT11D_INFO(ieee)->bEnabled = 0; /* this flag enabled to follow 11d country IE setting, otherwise, it shall follow global domain settings. */ + /* this flag enabled to follow 11d country IE setting, +* otherwise, it shall follow global domain settings. +*/ + GET_DOT11D_INFO(ieee)->bEnabled = 0; Dot11d_Reset(ieee); ieee->bGlobalDomain = true; break; @@ -210,9 +224,11 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) static void CamResetAllEntry(struct net_device *dev) { u32 ulcommand = 0; - /* 2004/02/11 In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA associate to AP. -* However, ResetKey is called on OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest -* In this condition, Cam can not be reset because upper layer will not set this static key again. + /* In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA +* associate to AP. However, ResetKey is called on +* OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest. In this +* condition, Cam can not be reset because upper layer will not set +* this static key again. */ ulcommand |= BIT31 | BIT30; write_nic_dword(dev, RWCAM, ulcommand); @@ -1039,8 +1055,9 @@ static void rtl8192_tx_isr(struct urb *tx_urb) * * Caution: * Handling the wait
[PATCHv2 02/16] staging: rtl8192u: r8192U_core: add line breaks to keep lines under 80 characters
Add line breaks in multiple lines to keep them under 80 characters, as to follow the kernel code style. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 626 ++--- 1 file changed, 421 insertions(+), 205 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 5e9d0ac..37c17eb 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -144,25 +144,31 @@ struct CHANNEL_LIST { static struct CHANNEL_LIST ChannelPlan[] = { /* FCC */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165}, 24}, + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, 44, 48, 52, 56, 60, 64, + 149, 153, 157, 161, 165}, 24}, /* IC */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11}, /* ETSI */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21}, + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, + 60, 64}, 21}, /* Spain. Change to ETSI. */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* France. Change to ETSI. */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* MKK */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, + 56, 60, 64}, 22}, /* MKK1 */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, + 56, 60, 64}, 22}, /* Israel. */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 13}, /* For 11a , TELEC */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, + 56, 60, 64}, 22}, /* MIC */ - {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22}, + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, + 56, 60, 64}, 22}, /* For Global Domain. 1-11:active scan, 12-14 passive scan. */ {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 14} }; @@ -190,11 +196,14 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) min_chan = 1; max_chan = 14; } else { - RT_TRACE(COMP_ERR, "unknown rf chip, can't set channel map in function:%s()\n", __func__); + RT_TRACE(COMP_ERR, +"unknown rf chip, can't set channel map in function:%s()\n", +__func__); } if (ChannelPlan[channel_plan].Len != 0) { /* Clear old channel map */ - memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map)); + memset(GET_DOT11D_INFO(ieee)->channel_map, 0, + sizeof(GET_DOT11D_INFO(ieee)->channel_map)); /* Set new channel map */ for (i = 0; i < ChannelPlan[channel_plan].Len; i++) { if (ChannelPlan[channel_plan].Channel[i] < min_chan || ChannelPlan[channel_plan].Channel[i] > max_chan) @@ -262,7 +271,8 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 data) indx | 0xfe00, 0, &data, 1, HZ / 2); if (status < 0) - netdev_err(dev, "write_nic_byte_E TimeOut! status: %d\n", status); + netdev_err(dev, "write_nic_byte_E TimeOut! status: %d\n", + status); } int read_nic_byte_E(struct net_device *dev, int indx, u8 *data) @@ -292,7 +302,8 @@ void write_nic_byte(struct net_device *dev, int indx, u8 data) status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, &data, 1, HZ / 2); +(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, +&data, 1, HZ / 2); if (status < 0) netdev_err(dev, "write_nic_byte TimeOut! status: %d\n", status); @@ -311,7 +322,8 @@ void write_nic_word(struct net_device *dev, int indx, u16 data) status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, &data, 2, HZ / 2); +(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, +
[PATCHv2 05/16] staging: rtl8192u: r8192U_core: rtl8192_adapter_start: reorganize function
Reverse conditions and use goto in the function rtl8192_adapter_start to have most of it under 80 characters per line. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 91 ++ 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 85dfcbb..5573c50 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2816,6 +2816,7 @@ static bool rtl8192_adapter_start(struct net_device *dev) bool init_status = true; u8 SECR_value = 0x0; u8 tmp; + u32 i, TempCCk, tmpRegA; RT_TRACE(COMP_INIT, ">%s()\n", __func__); priv->Rf_Mode = RF_OP_By_SW_3wire; @@ -2997,59 +2998,61 @@ static bool rtl8192_adapter_start(struct net_device *dev) rtl8192_setBBreg(dev, rFPGA0_RFMOD, bCCKEn, 0x1); rtl8192_setBBreg(dev, rFPGA0_RFMOD, bOFDMEn, 0x1); - if (priv->ResetProgress == RESET_TYPE_NORESET) { - /* if D or C cut */ - u8 tmpvalue; + if (priv->ResetProgress != RESET_TYPE_NORESET) + goto end; - read_nic_byte(dev, 0x301, &tmpvalue); - if (tmpvalue == 0x03) { - priv->bDcut = true; - RT_TRACE(COMP_POWER_TRACKING, "D-cut\n"); - } else { - priv->bDcut = false; - RT_TRACE(COMP_POWER_TRACKING, "C-cut\n"); + /* if D or C cut */ + read_nic_byte(dev, 0x301, &tmp); + if (tmp == 0x03) { + priv->bDcut = true; + RT_TRACE(COMP_POWER_TRACKING, "D-cut\n"); + } else { + priv->bDcut = false; + RT_TRACE(COMP_POWER_TRACKING, "C-cut\n"); + } + dm_initialize_txpower_tracking(dev); + + if (!priv->bDcut) + goto end; + + tmpRegA = rtl8192_QueryBBReg(dev, +rOFDM0_XATxIQImbalance, + bMaskDWord); + + for (i = 0; i < TxBBGainTableLength; i++) { + txbbgain_struct tx = priv->txbbgain_table[i]; + + if (tmpRegA == tx.txbbgain_value) { + priv->rfa_txpowertrackingindex = (u8)i; + priv->rfa_txpowertrackingindex_real = + (u8)i; + priv->rfa_txpowertracking_default = + priv->rfa_txpowertrackingindex; + break; } - dm_initialize_txpower_tracking(dev); - - if (priv->bDcut) { - u32 i, TempCCk; - u32 tmpRegA = rtl8192_QueryBBReg(dev, -rOFDM0_XATxIQImbalance, -bMaskDWord); - txbbgain_struct *tx = priv->txbbgain_table; - ccktxbbgain_struct *cck = priv->cck_txbbgain_table; - - for (i = 0; i < TxBBGainTableLength; i++) { - if (tmpRegA == tx[i].txbbgain_value) { - priv->rfa_txpowertrackingindex = (u8)i; - priv->rfa_txpowertrackingindex_real = - (u8)i; - priv->rfa_txpowertracking_default = - priv->rfa_txpowertrackingindex; - break; - } - } + } - TempCCk = rtl8192_QueryBBReg(dev, -rCCK0_TxFilter1, -bMaskByte2); + TempCCk = rtl8192_QueryBBReg(dev, +rCCK0_TxFilter1, +bMaskByte2); - for (i = 0; i < CCKTxBBGainTableLength; i++) { - if (TempCCk == cck[i].ccktxbb_valuearray[0]) { - priv->cck_present_attentuation_20Mdefault = (u8)i; - break; - } - } - priv->cck_present_attentuation_40Mdefault = 0; - priv->cck_present_attentuation_difference = 0; - priv->cck_present_attentuation = - priv->cck_present_attentuation_20Mdefault; + for (i = 0; i < CCKTxBBGainTableLength; i++) { + ccktxbbgain_struct cck = priv->cck_txbbgain_table[i]; + if (TempCCk == cck.ccktxbb_valuearray[0]) { + priv->cck_present_attentuation_20Mdefault = (u8)i; + break;
[PATCHv2 04/16] staging: rtl8192u: r8192U_core: reverse conditions to get lines under 80 characters
Reverse some conditions to clean the code and allow to have lines under 80 characters, as to follow the kernel code style. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 48 ++ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index c8724cd..85dfcbb 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -202,18 +202,19 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) __func__); } cl = ChannelPlan[channel_plan]; - if (cl.Len != 0) { - /* Clear old channel map */ - memset(GET_DOT11D_INFO(ieee)->channel_map, 0, - sizeof(GET_DOT11D_INFO(ieee)->channel_map)); - /* Set new channel map */ - for (i = 0; i < cl.Len; i++) { - u8 chan = cl.Channel[i]; - - if (chan < min_chan || chan > max_chan) - break; - GET_DOT11D_INFO(ieee)->channel_map[chan] = 1; - } + if (cl.Len == 0) + break; + + /* Clear old channel map */ + memset(GET_DOT11D_INFO(ieee)->channel_map, 0, + sizeof(GET_DOT11D_INFO(ieee)->channel_map)); + /* Set new channel map */ + for (i = 0; i < cl.Len; i++) { + u8 chan = cl.Channel[i]; + + if (chan < min_chan || chan > max_chan) + break; + GET_DOT11D_INFO(ieee)->channel_map[chan] = 1; } break; @@ -1088,17 +1089,18 @@ static void rtl8192_tx_isr(struct urb *tx_urb) */ /* Handle MPDU in wait queue. */ - if (queue_index != BEACON_QUEUE) { - /* Don't send data frame during scanning.*/ - if ((skb_queue_len(&priv->ieee80211->skb_waitQ[queue_index]) != 0) && - (!(priv->ieee80211->queue_stop))) { - skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index])); - if (skb) - priv->ieee80211->softmac_hard_start_xmit(skb, -dev); - - return; /* avoid further processing AMSDU */ - } + if (queue_index == BEACON_QUEUE) + return; + + /* Don't send data frame during scanning.*/ + if ((skb_queue_len(&priv->ieee80211->skb_waitQ[queue_index]) != 0) && + (!(priv->ieee80211->queue_stop))) { + skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index])); + if (skb) + priv->ieee80211->softmac_hard_start_xmit(skb, +dev); + + return; /* avoid further processing AMSDU */ } } -- 2.5.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 03/16] staging: rtl8192u: r8192U_core: add temporary variables to keep lines under 80 characters
Add some temporary variables to reduce line length under the maximum of 80 characters, as per the kernel code style. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 139 ++--- 1 file changed, 94 insertions(+), 45 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 37c17eb..c8724cd 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -177,6 +177,7 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) { int i, max_chan = -1, min_chan = -1; struct ieee80211_device *ieee = priv->ieee80211; + struct CHANNEL_LIST cl; switch (channel_plan) { case COUNTRY_CODE_FCC: @@ -200,15 +201,18 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) "unknown rf chip, can't set channel map in function:%s()\n", __func__); } - if (ChannelPlan[channel_plan].Len != 0) { + cl = ChannelPlan[channel_plan]; + if (cl.Len != 0) { /* Clear old channel map */ memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map)); /* Set new channel map */ - for (i = 0; i < ChannelPlan[channel_plan].Len; i++) { - if (ChannelPlan[channel_plan].Channel[i] < min_chan || ChannelPlan[channel_plan].Channel[i] > max_chan) + for (i = 0; i < cl.Len; i++) { + u8 chan = cl.Channel[i]; + + if (chan < min_chan || chan > max_chan) break; - GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 1; + GET_DOT11D_INFO(ieee)->channel_map[chan] = 1; } } break; @@ -1699,9 +1703,12 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) &zero, 0, tx_zero_isr, dev); status = usb_submit_urb(tx_urb_zero, GFP_ATOMIC); if (status) { + atomic_t tx = + priv->tx_pending[tcb_desc->queue_index]; + RT_TRACE(COMP_ERR, "Error TX URB for zero byte %d, error %d", - atomic_read(&priv->tx_pending[tcb_desc->queue_index]), +atomic_read(&tx), status); return -1; } @@ -1748,8 +1755,9 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) oldaddr = priv->oldaddr; align = ((long)oldaddr) & 3; if (align) { - newaddr = oldaddr + 4 - align; - priv->rx_urb[16]->transfer_buffer_length = 16 - 4 + align; + align = 4 - align; + newaddr = oldaddr + align; + priv->rx_urb[16]->transfer_buffer_length = 16 - align; } else { newaddr = oldaddr; priv->rx_urb[16]->transfer_buffer_length = 16; @@ -1913,7 +1921,9 @@ static void rtl8192_qos_activate(struct work_struct *work) */ for (i = 0; i < QOS_QUEUE_NUM; i++) { /* Mode G/A: slotTimeTimer = 9; Mode B: 20 */ - u1bAIFS = qos_parameters->aifs[i] * ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20) + aSifsTime; + int slotTimeTimer = ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20); + + u1bAIFS = qos_parameters->aifs[i] * slotTimeTimer + aSifsTime; u1bAIFS <<= AC_PARAM_AIFS_OFFSET; op_limit = (u32)le16_to_cpu(qos_parameters->tx_op_limit[i]); op_limit <<= AC_PARAM_TXOP_LIMIT_OFFSET; @@ -2121,10 +2131,12 @@ static bool GetNmodeSupportBySecCfg8192(struct net_device *dev) return false; } else if ((wpa_ie_len != 0)) { /* parse pairwise key type */ - if (((ieee->wpa_ie[0] == 0xdd) && (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) || ((ieee->wpa_ie[0] == 0x30) && (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4 - return true; - else - return false; + bool wpaie_dd = (ieee->wpa_ie[0] == 0xdd && +!memcmp(&ieee->wpa_ie[14], ccmp_ie, 4)); + bool wpaie_30 = (ieee->wpa_ie[0] == 0x30 && +!memcmp(&ieee->wpa_ie[10],
[PATCHv2 06/16] staging: rtl8192u: r8192U_core: rtl8192_read_eeprom_info: reorganize function
Refactor code to avoid multiple check of same boolean value, and to make the code clearer. This patches also implements the necessary changes for the code lines in this function to be under 80 chars. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 259 - 1 file changed, 155 insertions(+), 104 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 5573c50..acb8f97 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2497,129 +2497,180 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) priv->rf_type = RTL819X_DEFAULT_RF_TYPE; /* default 1T2R */ priv->rf_chip = RF_8256; - if (priv->card_8192_version == (u8)VERSION_819xU_A) { + /* if version mismatch VERSION_819xU_A, go directly to the led section +*/ + if (priv->card_8192_version != (u8)VERSION_819xU_A) + goto led; + + if (bLoad_From_EEPOM) { /* read Tx power gain offset of legacy OFDM to HT rate */ - if (bLoad_From_EEPOM) - priv->EEPROMTxPowerDiff = (eprom_read(dev, (EEPROM_TxPowerDiff >> 1)) & 0xff00) >> 8; - else - priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower; - RT_TRACE(COMP_EPROM, "TxPowerDiff:%d\n", priv->EEPROMTxPowerDiff); + tmpValue = eprom_read(dev, (EEPROM_TxPowerDiff >> 1)); + priv->EEPROMTxPowerDiff = (tmpValue & 0xff00) >> 8; + /* read ThermalMeter from EEPROM */ - if (bLoad_From_EEPOM) - priv->EEPROMThermalMeter = (u8)(eprom_read(dev, (EEPROM_ThermalMeter >> 1)) & 0x00ff); - else - priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter; - RT_TRACE(COMP_EPROM, "ThermalMeter:%d\n", priv->EEPROMThermalMeter); - /* for tx power track */ - priv->TSSI_13dBm = priv->EEPROMThermalMeter * 100; + tmpValue = eprom_read(dev, (EEPROM_ThermalMeter >> 1)); + priv->EEPROMThermalMeter = (u8)(tmpValue & 0x00ff); + /* read antenna tx power offset of B/C/D to A from EEPROM */ - if (bLoad_From_EEPOM) - priv->EEPROMPwDiff = (eprom_read(dev, (EEPROM_PwDiff >> 1)) & 0x0f00) >> 8; - else - priv->EEPROMPwDiff = EEPROM_Default_PwDiff; - RT_TRACE(COMP_EPROM, "TxPwDiff:%d\n", priv->EEPROMPwDiff); + tmpValue = eprom_read(dev, (EEPROM_PwDiff >> 1)); + priv->EEPROMPwDiff = (tmpValue & 0x0f00) >> 8; + /* Read CrystalCap from EEPROM */ - if (bLoad_From_EEPOM) - priv->EEPROMCrystalCap = (eprom_read(dev, (EEPROM_CrystalCap >> 1)) & 0x0f); - else - priv->EEPROMCrystalCap = EEPROM_Default_CrystalCap; - RT_TRACE(COMP_EPROM, "CrystalCap = %d\n", priv->EEPROMCrystalCap); + tmpValue = eprom_read(dev, (EEPROM_CrystalCap >> 1)); + priv->EEPROMCrystalCap = (tmpValue & 0x0f); + /* get per-channel Tx power level */ - if (bLoad_From_EEPOM) - priv->EEPROM_Def_Ver = (eprom_read(dev, (EEPROM_TxPwIndex_Ver >> 1)) & 0xff00) >> 8; - else - priv->EEPROM_Def_Ver = 1; - RT_TRACE(COMP_EPROM, "EEPROM_DEF_VER:%d\n", priv->EEPROM_Def_Ver); + tmpValue = eprom_read(dev, (EEPROM_TxPwIndex_Ver >> 1)); + priv->EEPROM_Def_Ver = (tmpValue & 0xff00) >> 8; + } else { + /* read Tx power gain offset of legacy OFDM to HT rate */ + priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower; + + /* read ThermalMeter from EEPROM */ + priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter; + + /* read antenna tx power offset of B/C/D to A from EEPROM */ + priv->EEPROMPwDiff = EEPROM_Default_PwDiff; + + /* Read CrystalCap from EEPROM */ + priv->EEPROMCrystalCap = EEPROM_Default_CrystalCap; + + /* get per-channel Tx power level */ + priv->EEPROM_Def_Ver = 1; + } + + /* for tx power track */ + priv->TSSI_13dBm = priv->EEPROMThermalMeter * 100; + + RT_TRACE(COMP_EPROM, "TxPowerDiff:%d\n", priv->EEPROMTxPowerDiff); + RT_TRACE(COMP_EPROM, "ThermalMeter:%d\n", priv->EEPROMThermalMeter); + RT_TRACE(COMP_EPROM, "TxPwDiff:%d\n", priv->EEPROMPwDiff); + RT_TRACE(COMP_EPROM, "CrystalCap = %d\n", priv->EEPROMCrystalCap); + RT_TRACE(COMP_EPROM, "EEPROM_DEF_VER:%d\n", priv->EEPROM_Def_Ver); + + if (bLoad_From_EEPOM) { if (priv->EEPROM_Def_Ver == 0) { /* old eeprom definition */ int i; -
[PATCHv2 10/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: remove unneeded variable
Local variable last_beacon_adc_pwdb was used to store a value that wasn't used after. This patch removes that variable. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index d779506..100fbbe 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4055,7 +4055,6 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, static u32 sb_index; static u32 sb_stats; - static u32 last_beacon_adc_pwdb; struct rtl_80211_hdr_3addr *hdr; u16 sc; @@ -4150,8 +4149,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, /* record the beacon pwdb to the sliding window. */ if (sb_stats++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) { sb_stats = PHY_Beacon_RSSI_SLID_WIN_MAX; - last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[sb_index]; - priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb; + priv->stats.Slide_Beacon_Total -= + priv->stats.Slide_Beacon_pwdb[sb_index]; } priv->stats.Slide_Beacon_Total += prev_stats->RxPWDBAll; priv->stats.Slide_Beacon_pwdb[sb_index] = prev_stats->RxPWDBAll; -- 2.5.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 09/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable slide_beacon_adc_pwdb_statistics to sb_stats
Rename variable to a shorter name to allow easier code refactoring in following patch. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 25c4cbd..d779506 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4054,7 +4054,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, static u32 last_rssi, last_evm; static u32 sb_index; - static u32 slide_beacon_adc_pwdb_statistics; + static u32 sb_stats; static u32 last_beacon_adc_pwdb; struct rtl_80211_hdr_3addr *hdr; @@ -4148,8 +4148,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, if (prev_stats->bPacketBeacon) { /* record the beacon pwdb to the sliding window. */ - if (slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) { - slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX; + if (sb_stats++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) { + sb_stats = PHY_Beacon_RSSI_SLID_WIN_MAX; last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[sb_index]; priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb; } @@ -4158,7 +4158,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, sb_index++; if (sb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) sb_index = 0; - prev_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total / slide_beacon_adc_pwdb_statistics; + prev_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total / sb_stats; if (prev_stats->RxPWDBAll >= 3) prev_stats->RxPWDBAll -= 3; } -- 2.5.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 15/16] staging: rtl8192u: r8192U_core: replace else { if() {} } by else if () {}
An else block only contained an if statement. Replace that else block by an else if block instead. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index f81f267..0d169d0 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4563,15 +4563,13 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, pstats->SignalStrength = precord_stats->SignalStrength = (u8)(rtl819x_signal_scale_mapping((long)pwdb_all)); - } else { + } else if (rf_rx_num != 0) { /* We can judge RX path number now. */ - if (rf_rx_num != 0) { - long currsig = (total_rssi /= rf_rx_num); + long currsig = (total_rssi /= rf_rx_num); - pstats->SignalStrength = - precord_stats->SignalStrength = - (u8)(rtl819x_signal_scale_mapping(currsig)); - } + pstats->SignalStrength = + precord_stats->SignalStrength = + (u8)(rtl819x_signal_scale_mapping(currsig)); } } /* QueryRxPhyStatus8190Pci */ -- 2.5.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 12/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: reorganize function
Reorganize function to make it cleaner, and respect the 80 characters kernel code style rule. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 140 +++-- 1 file changed, 81 insertions(+), 59 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 6bc92a7..ba33b96 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4116,6 +4116,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, if (!prev_stats->bIsCCK && (prev_stats->bPacketToSelf || prev_stats->bToSelfBA)) { for (rfp = RF90_PATH_A; rfp < priv->NumTotalRFPath; rfp++) { + u8 rx, add = 0; + if (!rtl8192_phy_CheckIsLegalRFPath( priv->ieee80211->dev, rfp)) continue; @@ -4124,16 +4126,16 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, priv->stats.rx_rssi_percentage[rfp] = prev_stats->RxMIMOSignalStrength[rfp]; - if (prev_stats->RxMIMOSignalStrength[rfp] > priv->stats.rx_rssi_percentage[rfp]) { - priv->stats.rx_rssi_percentage[rfp] = - ((priv->stats.rx_rssi_percentage[rfp] * (Rx_Smooth_Factor - 1)) + - (prev_stats->RxMIMOSignalStrength[rfp])) / (Rx_Smooth_Factor); - priv->stats.rx_rssi_percentage[rfp] = priv->stats.rx_rssi_percentage[rfp] + 1; - } else { - priv->stats.rx_rssi_percentage[rfp] = - ((priv->stats.rx_rssi_percentage[rfp] * (Rx_Smooth_Factor - 1)) + - (prev_stats->RxMIMOSignalStrength[rfp])) / (Rx_Smooth_Factor); - } + rx = priv->stats.rx_rssi_percentage[rfp]; + if (prev_stats->RxMIMOSignalStrength[rfp] > rx) + add = 1; + + rx *= Rx_Smooth_Factor - 1; + rx += prev_stats->RxMIMOSignalStrength[rfp]; + rx /= Rx_Smooth_Factor; + + priv->stats.rx_rssi_percentage[rfp] = rx + add; + RT_TRACE(COMP_DBG, "priv->stats.rx_rssi_percentage[rfPath] = %d\n", priv->stats.rx_rssi_percentage[rfp]); @@ -4153,12 +4155,17 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, priv->stats.Slide_Beacon_Total -= priv->stats.Slide_Beacon_pwdb[sb_index]; } + priv->stats.Slide_Beacon_Total += prev_stats->RxPWDBAll; priv->stats.Slide_Beacon_pwdb[sb_index] = prev_stats->RxPWDBAll; + sb_index++; if (sb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) sb_index = 0; - prev_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total / sb_stats; + + prev_stats->RxPWDBAll = + priv->stats.Slide_Beacon_Total / sb_stats; + if (prev_stats->RxPWDBAll >= 3) prev_stats->RxPWDBAll -= 3; } @@ -4171,69 +4178,84 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, if (prev_stats->bPacketToSelf || prev_stats->bPacketBeacon || prev_stats->bToSelfBA) { + long pwdb, add = 0; + if (priv->undecorated_smoothed_pwdb < 0) /* initialize */ priv->undecorated_smoothed_pwdb = prev_stats->RxPWDBAll; - if (prev_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) { - priv->undecorated_smoothed_pwdb = - (((priv->undecorated_smoothed_pwdb) * (Rx_Smooth_Factor - 1)) + -(prev_stats->RxPWDBAll)) / (Rx_Smooth_Factor); - priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1; - } else { - priv->undecorated_smoothed_pwdb = - (((priv->undecorated_smoothed_pwdb) * (Rx_Smooth_Factor - 1)) + -(prev_stats->RxPWDBAll)) / (Rx_Smooth_Factor); - } + pwdb = priv->undecorated_smoothed_pwdb; + + if (prev_stats->RxPWDBAll > (u32)pwdb) + add = 1; + + pwdb *= Rx_Smooth_Factor - 1; + pwdb += prev_stats->RxPWDBAll; + pwdb /= Rx_Smooth_Factor; + + priv->undecor
[PATCHv2 07/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable pprevious_stats to prev_stats
Rename variable to a shorter name to allow easier code refactoring in following patch. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 84 +- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index acb8f97..2a7d46d 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4043,7 +4043,7 @@ static long rtl819x_translate_todbm(u8 signal_strength_index) * and it will be reinitialized when returned from S3/S4. */ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, - struct ieee80211_rx_stats *pprevious_stats, + struct ieee80211_rx_stats *prev_stats, struct ieee80211_rx_stats *pcurrent_stats) { bool bcheck = false; @@ -4069,7 +4069,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, pcurrent_stats->Seq_Num = seq; /* Check whether we should take the previous packet into accounting */ - if (!pprevious_stats->bIsAMPDU) { + if (!prev_stats->bIsAMPDU) { /* if previous packet is not aggregated packet */ bcheck = true; } @@ -4079,10 +4079,10 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; priv->stats.slide_rssi_total -= last_rssi; } - priv->stats.slide_rssi_total += pprevious_stats->SignalStrength; + priv->stats.slide_rssi_total += prev_stats->SignalStrength; priv->stats.slide_signal_strength[slide_rssi_index++] = - pprevious_stats->SignalStrength; + prev_stats->SignalStrength; if (slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) slide_rssi_index = 0; @@ -4092,8 +4092,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, pcurrent_stats->rssi = priv->stats.signal_strength; /* If the previous packet does not match the criteria, neglect it */ - if (!pprevious_stats->bPacketMatchBSSID) { - if (!pprevious_stats->bToSelfBA) + if (!prev_stats->bPacketMatchBSSID) { + if (!prev_stats->bToSelfBA) return; } @@ -4102,7 +4102,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, /* only rtl8190 supported -* rtl8190_process_cck_rxpathsel(priv,pprevious_stats); +* rtl8190_process_cck_rxpathsel(priv,prev_stats); */ /* Check RSSI */ @@ -4114,8 +4114,8 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, /* <2> Showed on UI for engineering * hardware does not provide rssi information for each rf path in CCK */ - if (!pprevious_stats->bIsCCK && - (pprevious_stats->bPacketToSelf || pprevious_stats->bToSelfBA)) { + if (!prev_stats->bIsCCK && + (prev_stats->bPacketToSelf || prev_stats->bToSelfBA)) { for (rfpath = RF90_PATH_A; rfpath < priv->NumTotalRFPath; rfpath++) { if (!rtl8192_phy_CheckIsLegalRFPath( priv->ieee80211->dev, rfpath)) @@ -4123,16 +4123,16 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, if (priv->stats.rx_rssi_percentage[rfpath] == 0) priv->stats.rx_rssi_percentage[rfpath] = - pprevious_stats->RxMIMOSignalStrength[rfpath]; - if (pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) { + prev_stats->RxMIMOSignalStrength[rfpath]; + if (prev_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) { priv->stats.rx_rssi_percentage[rfpath] = ((priv->stats.rx_rssi_percentage[rfpath] * (Rx_Smooth_Factor - 1)) + - (pprevious_stats->RxMIMOSignalStrength[rfpath])) / (Rx_Smooth_Factor); + (prev_stats->RxMIMOSignalStrength[rfpath])) / (Rx_Smooth_Factor); priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] + 1; } else { priv->stats.rx_rssi_percentage[rfpath] = ((priv->stats.rx_rssi_percentage[rfpath] * (Rx_Smooth_Factor - 1)) + - (pprevious_stats->RxMIMOSignalStrength[rfpath])) / (Rx_Smooth_Factor); + (prev_stats->
[PATCHv2 13/16] staging: rtl8192u: r8192U_core: rtl8192_tx: replace some inline conditions
Replace some inline conditions by a full if-else statement to make the source clearer and follow the 80 characters kernel code style rule. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index ba33b96..189de56 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1596,12 +1596,18 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) tx_fwinfo->RtsEnable = (tcb_desc->bRTSEnable) ? 1 : 0; tx_fwinfo->CtsEnable = (tcb_desc->bCTSEnable) ? 1 : 0; tx_fwinfo->RtsSTBC = (tcb_desc->bRTSSTBC) ? 1 : 0; - tx_fwinfo->RtsHT = (tcb_desc->rts_rate & 0x80) ? 1 : 0; tx_fwinfo->RtsRate = MRateToHwRate8190Pci((u8)tcb_desc->rts_rate); - tx_fwinfo->RtsSubcarrier = (tx_fwinfo->RtsHT == 0) ? (tcb_desc->RTSSC) : 0; - tx_fwinfo->RtsBandwidth = (tx_fwinfo->RtsHT == 1) ? ((tcb_desc->bRTSBW) ? 1 : 0) : 0; - tx_fwinfo->RtsShort = (tx_fwinfo->RtsHT == 0) ? (tcb_desc->bRTSUseShortPreamble ? 1 : 0) : - (tcb_desc->bRTSUseShortGI ? 1 : 0); + if (tcb_desc->rts_rate & 0x80) { + tx_fwinfo->RtsHT = 1; + tx_fwinfo->RtsSubcarrier = 0; + tx_fwinfo->RtsBandwidth = (tcb_desc->bRTSBW) ? 1 : 0; + tx_fwinfo->RtsShort = (tcb_desc->bRTSUseShortGI ? 1 : 0); + } else { + tx_fwinfo->RtsHT = 0; + tx_fwinfo->RtsSubcarrier = tcb_desc->RTSSC; + tx_fwinfo->RtsBandwidth = 0; + tx_fwinfo->RtsShort = (tcb_desc->bRTSUseShortPreamble ? 1 : 0); + } /* Set Bandwidth and sub-channel settings. */ if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20_40) { -- 2.5.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 08/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable slide_beacon_adc_pwdb_index to sb_index
Rename variable to a shorter name to allow easier code refactoring in following patch. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 2a7d46d..25c4cbd 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4053,7 +4053,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, static u32 slide_evm_index, slide_evm_statistics; static u32 last_rssi, last_evm; - static u32 slide_beacon_adc_pwdb_index; + static u32 sb_index; static u32 slide_beacon_adc_pwdb_statistics; static u32 last_beacon_adc_pwdb; @@ -4150,14 +4150,14 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, /* record the beacon pwdb to the sliding window. */ if (slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) { slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX; - last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index]; + last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[sb_index]; priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb; } priv->stats.Slide_Beacon_Total += prev_stats->RxPWDBAll; - priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = prev_stats->RxPWDBAll; - slide_beacon_adc_pwdb_index++; - if (slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) - slide_beacon_adc_pwdb_index = 0; + priv->stats.Slide_Beacon_pwdb[sb_index] = prev_stats->RxPWDBAll; + sb_index++; + if (sb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) + sb_index = 0; prev_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total / slide_beacon_adc_pwdb_statistics; if (prev_stats->RxPWDBAll >= 3) prev_stats->RxPWDBAll -= 3; -- 2.5.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 11/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable rfpath to rfp
Rename variable to a shorter name to allow easier code refactoring in following patches. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 31 --- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 100fbbe..6bc92a7 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4047,7 +4047,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, struct ieee80211_rx_stats *pcurrent_stats) { bool bcheck = false; - u8 rfpath; + u8 rfp; u32 nspatial_stream, tmp_val; static u32 slide_rssi_index, slide_rssi_statistics; static u32 slide_evm_index, slide_evm_statistics; @@ -4115,27 +4115,28 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, */ if (!prev_stats->bIsCCK && (prev_stats->bPacketToSelf || prev_stats->bToSelfBA)) { - for (rfpath = RF90_PATH_A; rfpath < priv->NumTotalRFPath; rfpath++) { + for (rfp = RF90_PATH_A; rfp < priv->NumTotalRFPath; rfp++) { if (!rtl8192_phy_CheckIsLegalRFPath( - priv->ieee80211->dev, rfpath)) + priv->ieee80211->dev, rfp)) continue; - if (priv->stats.rx_rssi_percentage[rfpath] == 0) - priv->stats.rx_rssi_percentage[rfpath] = - prev_stats->RxMIMOSignalStrength[rfpath]; - if (prev_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) { - priv->stats.rx_rssi_percentage[rfpath] = - ((priv->stats.rx_rssi_percentage[rfpath] * (Rx_Smooth_Factor - 1)) + - (prev_stats->RxMIMOSignalStrength[rfpath])) / (Rx_Smooth_Factor); - priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] + 1; + if (priv->stats.rx_rssi_percentage[rfp] == 0) + priv->stats.rx_rssi_percentage[rfp] = + prev_stats->RxMIMOSignalStrength[rfp]; + + if (prev_stats->RxMIMOSignalStrength[rfp] > priv->stats.rx_rssi_percentage[rfp]) { + priv->stats.rx_rssi_percentage[rfp] = + ((priv->stats.rx_rssi_percentage[rfp] * (Rx_Smooth_Factor - 1)) + + (prev_stats->RxMIMOSignalStrength[rfp])) / (Rx_Smooth_Factor); + priv->stats.rx_rssi_percentage[rfp] = priv->stats.rx_rssi_percentage[rfp] + 1; } else { - priv->stats.rx_rssi_percentage[rfpath] = - ((priv->stats.rx_rssi_percentage[rfpath] * (Rx_Smooth_Factor - 1)) + - (prev_stats->RxMIMOSignalStrength[rfpath])) / (Rx_Smooth_Factor); + priv->stats.rx_rssi_percentage[rfp] = + ((priv->stats.rx_rssi_percentage[rfp] * (Rx_Smooth_Factor - 1)) + + (prev_stats->RxMIMOSignalStrength[rfp])) / (Rx_Smooth_Factor); } RT_TRACE(COMP_DBG, "priv->stats.rx_rssi_percentage[rfPath] = %d\n", -priv->stats.rx_rssi_percentage[rfpath]); +priv->stats.rx_rssi_percentage[rfp]); } } -- 2.5.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCHv2 14/16] staging: rtl8192u: r8192U_core: rtl8192_ioctl: reorganize function
Reorganize function rtl8192_ioctl to replace a switch with only one case besides the default by an if statement. This also allows to follow the 80 characters kernel code style rule. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 141 - 1 file changed, 68 insertions(+), 73 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 189de56..f81f267 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3801,82 +3801,77 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) goto out; } - switch (cmd) { - case RTL_IOCTL_WPA_SUPPLICANT: - /* parse here for HW security */ - if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION) { - if (ipw->u.crypt.set_tx) { - if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) { - ieee->pairwise_key_type = KEY_TYPE_CCMP; - } else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) { - ieee->pairwise_key_type = KEY_TYPE_TKIP; - } else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) { - if (ipw->u.crypt.key_len == 13) - ieee->pairwise_key_type = KEY_TYPE_WEP104; - else if (ipw->u.crypt.key_len == 5) - ieee->pairwise_key_type = KEY_TYPE_WEP40; - } else { - ieee->pairwise_key_type = KEY_TYPE_NA; - } - - if (ieee->pairwise_key_type) { - memcpy((u8 *)key, ipw->u.crypt.key, 16); - EnableHWSecurityConfig8192(dev); - /* We fill both index entry and 4th -* entry for pairwise key as in IPW -* interface, adhoc will only get here, -* so we need index entry for its -* default key serching! -*/ - setKey(dev, 4, ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key); - if (ieee->auth_mode != 2) - setKey(dev, ipw->u.crypt.idx, - ipw->u.crypt.idx, - ieee->pairwise_key_type, - (u8 *)ieee->ap_mac_addr, - 0, key); - } - } else { - memcpy((u8 *)key, ipw->u.crypt.key, 16); - if (strcmp(ipw->u.crypt.alg, "CCMP") == 0) { - ieee->group_key_type = KEY_TYPE_CCMP; - } else if (strcmp(ipw->u.crypt.alg, "TKIP") == 0) { - ieee->group_key_type = KEY_TYPE_TKIP; - } else if (strcmp(ipw->u.crypt.alg, "WEP") == 0) { - if (ipw->u.crypt.key_len == 13) - ieee->group_key_type = KEY_TYPE_WEP104; - else if (ipw->u.crypt.key_len == 5) - ieee->group_key_type = KEY_TYPE_WEP40; - } else { - ieee->group_key_type = KEY_TYPE_NA; - } - - if (ieee->group_key_type) { - setKey(dev, ipw->u.crypt.idx, - /* KeyIndex */ - ipw->u.crypt.idx, - /* KeyType */ - ieee->group_key_type, - /* MacAddr */ - broadcast_addr, - /* DefaultKey */ - 0, - /* KeyContent */ - key); - } - } + if
[PATCHv2 16/16] staging: rtl8192u: remove all code framed by symbol TO_DO_LIST
The symbol TO_DO_LIST was used in the code to frame sections of code unused or unusable. This patch remove all code framed by that symbol in this driver. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 4 +- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 23 - .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 4 - .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c| 5 +- drivers/staging/rtl8192u/r8192U_core.c | 102 ++--- drivers/staging/rtl8192u/r819xU_phy.c | 57 6 files changed, 9 insertions(+), 186 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index d481a26..28ba7d2 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -1654,10 +1654,10 @@ struct ieee80211_device { struct list_headRx_TS_Pending_List; struct list_headRx_TS_Unused_List; RX_TS_RECORDRxTsRecord[TOTAL_TS_NUM]; -//#ifdef TO_DO_LIST + RX_REORDER_ENTRYRxReorderEntry[128]; struct list_headRxReorder_Unused_List; -//#endif + // Qos related. Added by Annie, 2005-11-01. // PSTA_QOSpStaQos; u8 ForcedPriority; // Force per-packet priority 1~7. (default: 0, not to force it.) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index fff8d58..7bbe934 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -318,13 +318,6 @@ static void ieee80211_tx_query_agg_cap(struct ieee80211_device *ieee, if (is_multicast_ether_addr(hdr->addr1)) return; //check packet and mode later -#ifdef TO_DO_LIST - if(pTcb->PacketLength >= 4096) - return; - // For RTL819X, if pairwisekey = wep/tkip, we don't aggrregation. - if(!Adapter->HalFunc.GetNmodeSupportBySecCfgHandler(Adapter)) - return; -#endif if(!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { return; @@ -550,22 +543,6 @@ NO_PROTECTION: static void ieee80211_txrate_selectmode(struct ieee80211_device *ieee, cb_desc *tcb_desc) { -#ifdef TO_DO_LIST - if(!IsDataFrame(pFrame)) - { - pTcb->bTxDisableRateFallBack = true; - pTcb->bTxUseDriverAssingedRate = true; - pTcb->RATRIndex = 7; - return; - } - - if(pMgntInfo->ForcedDataRate!= 0) - { - pTcb->bTxDisableRateFallBack = true; - pTcb->bTxUseDriverAssingedRate = true; - return; - } -#endif if(ieee->bTxDisableRateFallBack) tcb_desc->bTxDisableRateFallBack = true; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c index c27397b..87b1bb9 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c @@ -88,10 +88,6 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee) ieee->bTxDisableRateFallBack = 0; ieee->bTxUseDriverAssingedRate = 0; -#ifdef TO_DO_LIST - // 8190 only. Assign duration operation mode to firmware - pMgntInfo->bTxEnableFwCalcDur = (BOOLEAN)pNdisCommon->bRegTxEnableFwCalcDur; -#endif // 8190 only, Realtek proprietary aggregation mode // Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others pHTInfo->bRegRT2RTAggregation = 1;//0: Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index f33c743..fb493a2 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -193,7 +193,7 @@ void TSInitialize(struct ieee80211_device *ieee) } // Initialize unused Rx Reorder List. INIT_LIST_HEAD(&ieee->RxReorder_Unused_List); -//#ifdef TO_DO_LIST + for(count = 0; count < REORDER_ENTRY_NUM; count++) { list_add_tail( &pRxReorderEntry->List,&ieee->RxReorder_Unused_List); @@ -201,7 +201,6 @@ void TSInitialize(struct ieee80211_device *ieee) break; pRxReorderEntry = &ieee->RxReorderEntry[count+1]; } -//#endif } @@ -461,7 +460,6 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, PTS_COMMON_INFO pTs, if(TxRxSelect == RX_DIR) { -//#ifdef TO_DO_LIST PRX_REORDER_ENTRY pRxReorderEntry;
[PATCH 1/7] staging: wilc1000: remove PANDA_BOARD
This patch removes one of the platform dependencies, PANDA_BOARD from the driver codes. The device tree will provide the platform dependencies in the future commits. Signed-off-by: Tony Cho Signed-off-by: Glen Lee --- drivers/staging/wilc1000/linux_wlan.c | 4 drivers/staging/wilc1000/linux_wlan_common.h | 3 --- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 3 files changed, 11 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 63f44f8..9be0282 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -438,10 +438,6 @@ static int init_irq(linux_wlan_t *p_nic) * * ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM); */ -#elif defined(PANDA_BOARD) - gpio_export(GPIO_NUM, 1); - nic->dev_irq_num = OMAP_GPIO_IRQ(GPIO_NUM); - irq_set_irq_type(nic->dev_irq_num, IRQ_TYPE_LEVEL_LOW); #else nic->dev_irq_num = gpio_to_irq(GPIO_NUM); #endif diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h index ea121f9..5d13c15 100644 --- a/drivers/staging/wilc1000/linux_wlan_common.h +++ b/drivers/staging/wilc1000/linux_wlan_common.h @@ -145,9 +145,6 @@ extern atomic_t DEBUG_LEVEL; #define MODALIAS"wilc_spi3" #define GPIO_NUM133 #endif -#elif defined(PANDA_BOARD) - #define MODALIAS"WILC_SPI" - #define GPIO_NUM139 #elif defined(PLAT_WMS8304) /* rachel */ #define MODALIAS"wilc_spi" #define GPIO_NUM139 diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index e1caea9..f8064f0 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -80,11 +80,7 @@ struct WILC_WFI_stats { * LPC3131 which is important to get the MAC start status when you are blocked * inside linux_wlan_firmware_download() which blocks mac_open(). */ -#if defined(PANDA_BOARD) - #define RX_BH_TYPE RX_BH_THREADED_IRQ -#else #define RX_BH_TYPE RX_BH_KTHREAD -#endif struct wilc_wfi_key { u8 *key; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/7] staging: wilc1000: remove unnecessary define FIVE_GHZ_BAND
From: Glen Lee wilc1000 driver does not support five Ghz band. Remove FIVE_GHZ_BAND and it's related code. Signed-off-by: Glen Lee Signed-off-by: Tony Cho --- drivers/staging/wilc1000/coreconfigurator.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 342df2a..4726fac 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -551,15 +551,9 @@ u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen) u8 get_current_channel(u8 *pu8msa, u16 u16RxLen) { -#ifdef FIVE_GHZ_BAND - /* Get the current channel as its not set in */ - /* 802.11a beacons/probe response*/ - return (get_rf_channel() + 1); -#else /* FIVE_GHZ_BAND */ /* Extract current channel information from */ /* the beacon/probe response frame */ return get_current_channel_802_11n(pu8msa, u16RxLen); -#endif /* FIVE_GHZ_BAND */ } /** -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] staging: wilc1000: remove RX_BH_TYPE
This patch removes the preprocessor definition, RX_BH_TYPE and uses the request_threaded_irq instead of kernel thread to execute the interrupt handler. As a result, linux_wlan_enable_irq() and linux_wlan_disable_irq() are also removed from the linux_wlan.c file. Signed-off-by: Tony Cho --- drivers/staging/wilc1000/linux_wlan.c | 148 +- drivers/staging/wilc1000/linux_wlan_common.h | 3 - drivers/staging/wilc1000/wilc_wfi_netdevice.h | 16 --- drivers/staging/wilc1000/wilc_wlan.c | 3 - 4 files changed, 2 insertions(+), 168 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 9be0282..7265f93 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -300,89 +300,31 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event } #endif -/* - * Interrupt initialization and handling functions - */ - -void linux_wlan_enable_irq(void) -{ - -#if (RX_BH_TYPE != RX_BH_THREADED_IRQ) -#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) - PRINT_D(INT_DBG, "Enabling IRQ ...\n"); - enable_irq(g_linux_wlan->dev_irq_num); -#endif -#endif -} - -void linux_wlan_disable_irq(int wait) -{ -#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) - if (wait) { - PRINT_D(INT_DBG, "Disabling IRQ ...\n"); - disable_irq(g_linux_wlan->dev_irq_num); - } else { - PRINT_D(INT_DBG, "Disabling IRQ ...\n"); - disable_irq_nosync(g_linux_wlan->dev_irq_num); - } -#endif -} - #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) static irqreturn_t isr_uh_routine(int irq, void *user_data) { -#if (RX_BH_TYPE != RX_BH_THREADED_IRQ) - linux_wlan_disable_irq(IRQ_NO_WAIT); -#endif PRINT_D(INT_DBG, "Interrupt received UH\n"); /*While mac is closing cacncel the handling of any interrupts received*/ if (g_linux_wlan->close) { PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n"); - #if (RX_BH_TYPE == RX_BH_THREADED_IRQ) return IRQ_HANDLED; - #else - return IRQ_NONE; - #endif - } -#if (RX_BH_TYPE == RX_BH_WORK_QUEUE) - schedule_work(&g_linux_wlan->rx_work_queue); - return IRQ_HANDLED; -#elif (RX_BH_TYPE == RX_BH_KTHREAD) - up(&g_linux_wlan->rx_sem); - return IRQ_HANDLED; -#elif (RX_BH_TYPE == RX_BH_THREADED_IRQ) return IRQ_WAKE_THREAD; -#endif } #endif -#if (RX_BH_TYPE == RX_BH_WORK_QUEUE || RX_BH_TYPE == RX_BH_THREADED_IRQ) - -#if (RX_BH_TYPE == RX_BH_THREADED_IRQ) irqreturn_t isr_bh_routine(int irq, void *userdata) { linux_wlan_t *nic; nic = (linux_wlan_t *)userdata; -#else -static void isr_bh_routine(struct work_struct *work) -{ - perInterface_wlan_t *nic; - - nic = (perInterface_wlan_t *)container_of(work, linux_wlan_t, rx_work_queue); -#endif /*While mac is closing cacncel the handling of any interrupts received*/ if (g_linux_wlan->close) { PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n"); - #if (RX_BH_TYPE == RX_BH_THREADED_IRQ) return IRQ_HANDLED; - #else - return; - #endif } PRINT_D(INT_DBG, "Interrupt received BH\n"); @@ -391,36 +333,8 @@ static void isr_bh_routine(struct work_struct *work) else PRINT_ER("wlan_handle_rx_isr() hasn't been initialized\n"); -#if (RX_BH_TYPE == RX_BH_THREADED_IRQ) return IRQ_HANDLED; -#endif -} -#elif (RX_BH_TYPE == RX_BH_KTHREAD) -static int isr_bh_routine(void *vp) -{ - linux_wlan_t *nic; - - nic = (linux_wlan_t *)vp; - - while (1) { - down(&nic->rx_sem); - if (g_linux_wlan->close) { - - while (!kthread_should_stop()) - schedule(); - - break; - } - PRINT_D(INT_DBG, "Interrupt received BH\n"); - if (g_linux_wlan->oup.wlan_handle_rx_isr != 0) - g_linux_wlan->oup.wlan_handle_rx_isr(); - else - PRINT_ER("wlan_handle_rx_isr() hasn't been initialized\n"); - } - - return 0; } -#endif #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) static int init_irq(linux_wlan_t *p_nic) @@ -446,17 +360,10 @@ static int init_irq(linux_wlan_t *p_nic) PRINT_ER("could not obtain gpio for WILC_INTR\n"); } -#if (RX_BH_TYPE == RX_BH_THREADED_IRQ) if ((ret != -1) && (request_threaded_irq(nic->dev_irq_num, isr_uh_routine, isr_bh_routine, IRQF_TRIGGER_LOW | IRQF_ONESHOT, /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/ "WILC_IRQ", nic)) <
[PATCH 4/7] staging: wilc1000: remove unused defines
From: Glen Lee This patch removes follwing unused defines. MAX_CFG_PKTLEN MSG_HEADER_LEN QUERY_MSG_TYPE WRITE_MSG_TYPE RESP_MSG_TYPE WRITE_RESP_SUCCESS INVALID MAC_ADDR_LEN Signed-off-by: Glen Lee Signed-off-by: Tony Cho --- drivers/staging/wilc1000/coreconfigurator.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 4726fac..cada26d 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -18,14 +18,6 @@ /* Constants */ /*/ #define INLINE static __inline -#define MAX_CFG_PKTLEN 1450 -#define MSG_HEADER_LEN 4 -#define QUERY_MSG_TYPE 'Q' -#define WRITE_MSG_TYPE 'W' -#define RESP_MSG_TYPE 'R' -#define WRITE_RESP_SUCCESS 1 -#define INVALID 255 -#define MAC_ADDR_LEN6 #define TAG_PARAM_OFFSET (MAC_HDR_LEN + TIME_STAMP_LEN + \ BEACON_INTERVAL_LEN + CAP_INFO_LEN) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/7] staging: wilc1000: remove useless define PHY_802_11n
From: Glen Lee The define PHY_802_11n is useless because wilc1000 support 802.11n as always. Remove PHY_802_11n and it related code. Signed-off-by: Glen Lee Signed-off-by: Tony Cho --- drivers/staging/wilc1000/coreconfigurator.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index f393424..342df2a 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -18,7 +18,6 @@ /* Constants */ /*/ #define INLINE static __inline -#define PHY_802_11n #define MAX_CFG_PKTLEN 1450 #define MSG_HEADER_LEN 4 #define QUERY_MSG_TYPE 'Q' @@ -552,7 +551,6 @@ u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen) u8 get_current_channel(u8 *pu8msa, u16 u16RxLen) { -#ifdef PHY_802_11n #ifdef FIVE_GHZ_BAND /* Get the current channel as its not set in */ /* 802.11a beacons/probe response*/ @@ -562,9 +560,6 @@ u8 get_current_channel(u8 *pu8msa, u16 u16RxLen) /* the beacon/probe response frame */ return get_current_channel_802_11n(pu8msa, u16RxLen); #endif /* FIVE_GHZ_BAND */ -#else - return 0; -#endif /* PHY_802_11n */ } /** -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/7] staging: wilc1000: remove unnecessary extern function declaration
From: Glen Lee Function NetworkInfoReceived, GnrlAsyncInfoReceived and host_int_ScanCompleteReceived are declared in the header file already. Just removes the declaration and comments. Signed-off-by: Glen Lee Signed-off-by: Tony Cho --- drivers/staging/wilc1000/coreconfigurator.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index cada26d..60b8961 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -137,14 +137,6 @@ typedef struct { /* Extern Variable Declarations */ /*/ - -/*/ -/* Extern Function Declarations */ -/*/ -extern s32 SendRawPacket(s8 *ps8Packet, s32 s32PacketLen); -extern void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length); -extern void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length); -extern void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length); /*/ /* Global Variables */ /*/ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/7] staging: wilc1000: delete unused global variables.
From: Glen Lee gstrConfigPktInfo, SemHandleSendPkt and SemHandlePktResp are never used in the drivers. So just delete the variables and it's related code. Signed-off-by: Glen Lee Signed-off-by: Tony Cho --- drivers/staging/wilc1000/coreconfigurator.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 60b8961..ac97830 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -140,12 +140,6 @@ typedef struct { /*/ /* Global Variables */ /*/ -static struct semaphore SemHandleSendPkt; -static struct semaphore SemHandlePktResp; - - -static tstrConfigPktInfo gstrConfigPktInfo; - /* WID Switches */ static tstrWID gastrWIDs[] = { {WID_FIRMWARE_VERSION, WID_STR}, @@ -477,11 +471,6 @@ s32 CoreConfiguratorInit(void) PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit()\n"); - sema_init(&SemHandleSendPkt, 1); - sema_init(&SemHandlePktResp, 0); - - - memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo)); return s32Error; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 7/7] staging: wilc1000: remove unused variables
From: Glen Lee Variable g_num_total_switches is never used so just remove it. gastrWIDs is also not used because g_num_total_switches is deleted. Remove gastrWIDs also. Signed-off-by: Glen Lee Signed-off-by: Tony Cho --- drivers/staging/wilc1000/coreconfigurator.c | 127 1 file changed, 127 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index ac97830..e0dd4820 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -140,133 +140,6 @@ typedef struct { /*/ /* Global Variables */ /*/ -/* WID Switches */ -static tstrWID gastrWIDs[] = { - {WID_FIRMWARE_VERSION, WID_STR}, - {WID_PHY_VERSION, WID_STR}, - {WID_HARDWARE_VERSION, WID_STR}, - {WID_BSS_TYPE, WID_CHAR}, - {WID_QOS_ENABLE,WID_CHAR}, - {WID_11I_MODE, WID_CHAR}, - {WID_CURRENT_TX_RATE, WID_CHAR}, - {WID_LINKSPEED, WID_CHAR}, - {WID_RTS_THRESHOLD, WID_SHORT}, - {WID_FRAG_THRESHOLD,WID_SHORT}, - {WID_SSID, WID_STR}, - {WID_BSSID, WID_ADR}, - {WID_BEACON_INTERVAL, WID_SHORT}, - {WID_POWER_MANAGEMENT, WID_CHAR}, - {WID_LISTEN_INTERVAL, WID_CHAR}, - {WID_DTIM_PERIOD, WID_CHAR}, - {WID_CURRENT_CHANNEL, WID_CHAR}, - {WID_TX_POWER_LEVEL_11A,WID_CHAR}, - {WID_TX_POWER_LEVEL_11B,WID_CHAR}, - {WID_PREAMBLE, WID_CHAR}, - {WID_11G_OPERATING_MODE,WID_CHAR}, - {WID_MAC_ADDR, WID_ADR}, - {WID_IP_ADDRESS,WID_ADR}, - {WID_ACK_POLICY,WID_CHAR}, - {WID_PHY_ACTIVE_REG,WID_CHAR}, - {WID_AUTH_TYPE, WID_CHAR}, - {WID_REKEY_POLICY, WID_CHAR}, - {WID_REKEY_PERIOD, WID_INT}, - {WID_REKEY_PACKET_COUNT,WID_INT}, - {WID_11I_PSK, WID_STR}, - {WID_1X_KEY,WID_STR}, - {WID_1X_SERV_ADDR, WID_IP}, - {WID_SUPP_USERNAME, WID_STR}, - {WID_SUPP_PASSWORD, WID_STR}, - {WID_USER_CONTROL_ON_TX_POWER, WID_CHAR}, - {WID_MEMORY_ADDRESS,WID_INT}, - {WID_MEMORY_ACCESS_32BIT, WID_INT}, - {WID_MEMORY_ACCESS_16BIT, WID_SHORT}, - {WID_MEMORY_ACCESS_8BIT,WID_CHAR}, - {WID_SITE_SURVEY_RESULTS, WID_STR}, - {WID_PMKID_INFO,WID_STR}, - {WID_ASSOC_RES_INFO,WID_STR}, - {WID_MANUFACTURER, WID_STR}, /* 4 Wids added for the CAPI tool*/ - {WID_MODEL_NAME,WID_STR}, - {WID_MODEL_NUM, WID_STR}, - {WID_DEVICE_NAME, WID_STR}, - {WID_SSID_PROBE_REQ,WID_STR}, - -#ifdef MAC_802_11N - {WID_11N_ENABLE,WID_CHAR}, - {WID_11N_CURRENT_TX_MCS,WID_CHAR}, - {WID_TX_POWER_LEVEL_11N,WID_CHAR}, - {WID_11N_OPERATING_MODE,WID_CHAR}, - {WID_11N_SMPS_MODE, WID_CHAR}, - {WID_11N_PROT_MECH, WID_CHAR}, - {WID_11N_ERP_PROT_TYPE, WID_CHAR}, - {WID_11N_HT_PROT_TYPE, WID_CHAR}, - {WID_11N_PHY_ACTIVE_REG_VAL,WID_INT}, - {WID_11N_PRINT_STATS, WID_CHAR}, - {WID_11N_AUTORATE_TABLE,WID_BIN_DATA}, - {WID_HOST_CONFIG_IF_TYPE, WID_CHAR}, - {WID_HOST_DATA_IF_TYPE, WID_CHAR}, - {WID_11N_SIG_QUAL_VAL, WID_SHORT}, - {WID_11N_IMMEDIATE_BA_ENABLED, WID_CHAR}, - {WID_11N_TXOP_PROT_DISABLE, WID_CHAR}, - {WID_11N_SHORT_GI_20MHZ_ENABLE, WID_CHAR}, - {WID_SHORT_SLOT_ALLOWED,WID_CHAR}, - {WID_11W_ENABLE,WID_CHAR}, - {WID_11W_MGMT_PROT_REQ, WID_CHAR}, - {WID_2040_ENABLE, WID_CHAR}, - {WID_2040_COEXISTENCE, WID_CHAR}, - {WID_USER_SEC_CHANNEL_OFFSET, WID_CHAR}, - {WID_2040_CURR_CHANNEL_OFFSET, WID_CHAR}, - {WID_2040_40MHZ_INTOLERANT, WID_CHAR}, - {WID_HUT_RESTART, WID_CHAR}, - {WID_HUT_NUM_TX_PKTS, WID_INT}, - {WID_HUT_FRAME_LEN, WID_SHORT}, - {WID_HUT_TX_FORMAT, WID_CHAR}, - {WID_HUT_BANDWIDTH, WID_CHAR}, - {WID_HUT_OP_BAND, WID_CHAR}, - {WID_HUT_STBC, WID_CHAR}, - {WID_HUT_E
Re: [PATCH 3/3] staging: fbtft: use pr_fmt
On Thu, Sep 10, 2015 at 06:45:15PM +0200, Noralf Trønnes wrote: > > 10.09.2015 06:54, skrev Sudip Mukherjee: > >On Wed, Sep 09, 2015 at 11:20:08PM +0200, Noralf Trønnes wrote: > >>Den 09.09.2015 20:35, skrev Greg Kroah-Hartman: > >>>On Sat, Sep 05, 2015 at 07:13:45PM +0530, Sudip Mukherjee wrote: > Instead of defining DRVNAME and using it in all calls to pr_* family of > macros lets start using pr_fmt. > > Signed-off-by: Sudip Mukherjee > --- > drivers/staging/fbtft/fbtft_device.c | 79 > > 1 file changed, 35 insertions(+), 44 deletions(-) > >>[...] > >> > >Is this driver only for Raspberry Pi? > >I have seen someone submitted a drm driver for Raspberry Pi. And I guess > >that is already merged. > >Tomi (fbdev maintainer) said "Fremebuffer driver will be obsolete > >immediately when there's a DRM driver for that device". And if a drm > >driver is already there for Raspberry Pi then ? > > Not sure what you refer to as driver here. > > The fbtft module presents a simplistic view of fbdev through > 'struct fbtft_par' which the various fbtft drivers use. > > fbtft_device is just a kernel module that can add spi and platform > devices to the kernel and it can be used on all platforms. It's not a > driver of any kind. It really does what Device Tree does, it adds devices. > > vc4 is an upcoming DRM driver for the BCM2835 display hardware (hdmi). > This has nothing to do with the fbtft drivers which target SPI/parallel > bus connected displays with onboard video memory. Ok, Thanks for explaining. Since this is using calls to framebuffer I thought this to be a framebuffer driver. Anyways, I will modify the patch as suggested by Greg. regards sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: speakup: Used kstrtoul instead of simple_strtoul
Used kstrtoul instead of simple_strtoul inorder to fix a warning detected by checkpatch. The warning is given below: drivers/staging/speakup/kobjects.c:156: WARNING: simple_strtoul is obsolete, use kstrtoul instead Signed-off-by: Aparna Karuthodi --- drivers/staging/speakup/kobjects.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index 3708bc1..05de0b7 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -153,7 +153,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj, continue; } - index = simple_strtoul(cp, &temp, 10); + index = kstrtoul(cp, &temp, 10); if (index > 255) { rejected++; cp = linefeed + 1; -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: fbtft: start using pr_fmt
Instead of defining DRVNAME and using it in all calls to pr_* family of macros lets start using pr_fmt. Signed-off-by: Sudip Mukherjee --- Greg, In fbtft_device_spi_device_register() you told to use dev_*, but that pr_err is done when spi_busnum_to_master() fails, and in that case we are not getting reference of any device. drivers/staging/fbtft/fbtft_device.c | 67 1 file changed, 29 insertions(+), 38 deletions(-) diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 95985726..a820d4c 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -13,6 +13,7 @@ * GNU General Public License for more details. */ +#define pr_fmt(fmt) "fbtft_device: " fmt #include #include #include @@ -21,8 +22,6 @@ #include "fbtft.h" -#define DRVNAME "fbtft_device" - #define MAX_GPIOS 32 static struct spi_device *spi_device; @@ -1224,7 +1223,7 @@ static int spi_device_found(struct device *dev, void *data) static void pr_spi_devices(void) { - pr_info(DRVNAME": SPI devices registered:\n"); + pr_info("SPI devices registered:\n"); bus_for_each_dev(&spi_bus_type, NULL, NULL, spi_device_found); } @@ -1242,7 +1241,7 @@ static int p_device_found(struct device *dev, void *data) static void pr_p_devices(void) { - pr_info(DRVNAME": 'fb' Platform devices registered:\n"); + pr_info("'fb' Platform devices registered:\n"); bus_for_each_dev(&platform_bus_type, NULL, NULL, p_device_found); } @@ -1268,8 +1267,8 @@ static int fbtft_device_spi_device_register(struct spi_board_info *spi) master = spi_busnum_to_master(spi->bus_num); if (!master) { - pr_err(DRVNAME ": spi_busnum_to_master(%d) returned NULL\n", - spi->bus_num); + pr_err("spi_busnum_to_master(%d) returned NULL\n", + spi->bus_num); return -EINVAL; } /* make sure it's available */ @@ -1300,11 +1299,11 @@ static int __init fbtft_device_init(void) long val; int ret = 0; - pr_debug("\n\n"DRVNAME": init\n"); + pr_debug("init\n"); if (name == NULL) { #ifdef MODULE - pr_err(DRVNAME": missing module parameter: 'name'\n"); + pr_err("missing module parameter: 'name'\n"); return -EINVAL; #else return 0; @@ -1312,42 +1311,37 @@ static int __init fbtft_device_init(void) } if (init_num > FBTFT_MAX_INIT_SEQUENCE) { - pr_err(DRVNAME - ": init parameter: exceeded max array size: %d\n", - FBTFT_MAX_INIT_SEQUENCE); + pr_err("init parameter: exceeded max array size: %d\n", + FBTFT_MAX_INIT_SEQUENCE); return -EINVAL; } /* parse module parameter: gpios */ while ((p_gpio = strsep(&gpios, ","))) { if (strchr(p_gpio, ':') == NULL) { - pr_err(DRVNAME - ": error: missing ':' in gpios parameter: %s\n", - p_gpio); + pr_err("error: missing ':' in gpios parameter: %s\n", + p_gpio); return -EINVAL; } p_num = p_gpio; p_name = strsep(&p_num, ":"); if (p_name == NULL || p_num == NULL) { - pr_err(DRVNAME - ": something bad happened parsing gpios parameter: %s\n", - p_gpio); + pr_err("something bad happened parsing gpios parameter: %s\n", + p_gpio); return -EINVAL; } ret = kstrtol(p_num, 10, &val); if (ret) { - pr_err(DRVNAME - ": could not parse number in gpios parameter: %s:%s\n", - p_name, p_num); + pr_err("could not parse number in gpios parameter: %s:%s\n", + p_name, p_num); return -EINVAL; } strncpy(fbtft_device_param_gpios[i].name, p_name, FBTFT_GPIO_NAME_SIZE - 1); fbtft_device_param_gpios[i++].gpio = (int) val; if (i == MAX_GPIOS) { - pr_err(DRVNAME - ": gpios parameter: exceeded max array size: %d\n", - MAX_GPIOS); + pr_err("gpios parameter: exceeded max array size: %d\n", + MAX_GPIOS); return -EINVAL; } } @@ -1360,7 +1354,7 @@ static int __init
[PATCH 1/3] staging: fbtft: use dev_*
Use dev_* family of macros where we have a reference of a device. Signed-off-by: Sudip Mukherjee --- Greg, In fbtft_device_spi_delete() you told to make that as dev_debug, but since that dev_info is already under verbose so I kept it as it is. drivers/staging/fbtft/fbtft_device.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 80ab918..95985726 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1215,9 +1215,9 @@ static int spi_device_found(struct device *dev, void *data) { struct spi_device *spi = container_of(dev, struct spi_device, dev); - pr_info(DRVNAME": %s %s %dkHz %d bits mode=0x%02X\n", - spi->modalias, dev_name(dev), spi->max_speed_hz / 1000, - spi->bits_per_word, spi->mode); + dev_info(dev, "%s %s %dkHz %d bits mode=0x%02X\n", spi->modalias, +dev_name(dev), spi->max_speed_hz / 1000, spi->bits_per_word, +spi->mode); return 0; } @@ -1234,9 +1234,8 @@ static int p_device_found(struct device *dev, void *data) *pdev = container_of(dev, struct platform_device, dev); if (strstr(pdev->name, "fb")) - pr_info(DRVNAME": %s id=%d pdata? %s\n", - pdev->name, pdev->id, - pdev->dev.platform_data ? "yes" : "no"); + dev_info(dev, "%s id=%d pdata? %s\n", pdev->name, pdev->id, +pdev->dev.platform_data ? "yes" : "no"); return 0; } @@ -1258,7 +1257,7 @@ static void fbtft_device_spi_delete(struct spi_master *master, unsigned cs) dev = bus_find_device_by_name(&spi_bus_type, NULL, str); if (dev) { if (verbose) - pr_info(DRVNAME": Deleting %s\n", str); + dev_info(dev, "Deleting %s\n", str); device_del(dev); } } @@ -1278,7 +1277,7 @@ static int fbtft_device_spi_device_register(struct spi_board_info *spi) spi_device = spi_new_device(master, spi); put_device(&master->dev); if (!spi_device) { - pr_err(DRVNAME ":spi_new_device() returned NULL\n"); + dev_err(&master->dev, "spi_new_device() returned NULL\n"); return -EPERM; } return 0; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] staging: fbtft: change log level
Reduce the log level of some of the pr_* calls and remove 2 pr_debug calls which just prints "init" and "exit". Signed-off-by: Sudip Mukherjee --- drivers/staging/fbtft/fbtft_device.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index a820d4c..6d868e0 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1223,7 +1223,7 @@ static int spi_device_found(struct device *dev, void *data) static void pr_spi_devices(void) { - pr_info("SPI devices registered:\n"); + pr_debug("SPI devices registered:\n"); bus_for_each_dev(&spi_bus_type, NULL, NULL, spi_device_found); } @@ -1241,7 +1241,7 @@ static int p_device_found(struct device *dev, void *data) static void pr_p_devices(void) { - pr_info("'fb' Platform devices registered:\n"); + pr_debug("'fb' Platform devices registered:\n"); bus_for_each_dev(&platform_bus_type, NULL, NULL, p_device_found); } @@ -1299,8 +1299,6 @@ static int __init fbtft_device_init(void) long val; int ret = 0; - pr_debug("init\n"); - if (name == NULL) { #ifdef MODULE pr_err("missing module parameter: 'name'\n"); @@ -1479,8 +1477,6 @@ static int __init fbtft_device_init(void) static void __exit fbtft_device_exit(void) { - pr_debug("exit\n"); - if (spi_device) { device_del(&spi_device->dev); kfree(spi_device); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: speakup: Changed simple_strtoul to kstrtoul
Used kstrtoul instead of simple_strtoul to remove a warning detected by checkpatch.The warning is given below: drivers/staging/speakup/varhandlers.c:327: WARNING: simple_strtoul is obsolete, use kstrtoul instead Signed-off-by: Aparna Karuthodi --- drivers/staging/speakup/varhandlers.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c index 1b0d1c0..00fd67e 100644 --- a/drivers/staging/speakup/varhandlers.c +++ b/drivers/staging/speakup/varhandlers.c @@ -324,7 +324,7 @@ char *spk_s2uchar(char *start, char *dest) { int val = 0; - val = simple_strtoul(skip_spaces(start), &start, 10); + val = kstrtoul(skip_spaces(start), &start, 10); if (*start == ',') start++; *dest = (u_char)val; -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: lustre: lnet: klnds: socklnd: Added a space
Added a space to fix the following coding style error detected by checkpatch: ERROR: spaces required around that ':' (ctx:VxE) Signed-off-by: Anjali Menon --- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index fa7ad88..81943be 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -715,7 +715,7 @@ ksocknal_queue_tx_locked (ksock_tx_t *tx, ksock_conn_t *conn) LASSERT (tx->tx_resid == tx->tx_nob); CDEBUG (D_NET, "Packet %p type %d, nob %d niov %d nkiov %d\n", - tx, (tx->tx_lnetmsg != NULL) ? tx->tx_lnetmsg->msg_hdr.type: + tx, (tx->tx_lnetmsg != NULL) ? tx->tx_lnetmsg->msg_hdr.type : KSOCK_MSG_NOOP, tx->tx_nob, tx->tx_niov, tx->tx_nkiov); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/dgap: Use strpbrk() instead of dgap_sindex()
The provides strpbrk() function that does the same that the dgap_sindex(). Let's use already defined function instead of writing custom. Signed-off-by: Alexander Kuleshov --- drivers/staging/dgap/dgap.c | 24 +--- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 9112dd2..ee0f022 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -287,28 +287,6 @@ static struct toklist dgap_tlist[] = { { 0,NULL } }; - -/* - * dgap_sindex: much like index(), but it looks for a match of any character in - * the group, and returns that position. - */ -static char *dgap_sindex(char *string, char *group) -{ - char *ptr; - - if (!string || !group) - return NULL; - - for (; *string; string++) { - for (ptr = group; *ptr; ptr++) { - if (*ptr == *string) - return string; - } - } - - return NULL; -} - /* * get a word from the input stream, also keep track of current line number. * words are separated by whitespace. @@ -317,7 +295,7 @@ static char *dgap_getword(char **in) { char *ret_ptr = *in; - char *ptr = dgap_sindex(*in, " \t\n"); + char *ptr = strpbrk(*in, " \t\n"); /* If no word found, return null */ if (!ptr) -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: android: fix typo
'syncrhronization' is wrong spell. 'synchronization' is correct. Signed-off-by: Junesung Lee --- drivers/staging/android/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 24d657b..0a9a7b3 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig @@ -53,7 +53,7 @@ config SW_SYNC depends on SYNC ---help--- A sync object driver that uses a 32bit counter to coordinate - syncrhronization. Useful when there is no hardware primitive backing + synchronization. Useful when there is no hardware primitive backing the synchronization. config SW_SYNC_USER -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 3/4] staging/rtl8188eu : Remove duplicated BIT() definitions
On Wed, Sep 09, 2015 at 03:57:09PM -0700, Anish Bhatt wrote: > The BIT() macro is already defined in bitops.h, remove duplicate > definitions. Users of BIT() macro are expecting unsigned int/u32, so > add typecasts where this creates a build warning. > > Signed-off-by: Anish Bhatt > --- > drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 7 +-- > drivers/staging/rtl8188eu/core/rtw_wlan_util.c| 6 -- > drivers/staging/rtl8188eu/include/rtl8188e_spec.h | 4 > drivers/staging/rtl8188eu/include/wifi.h | 7 --- > 4 files changed, 9 insertions(+), 15 deletions(-) > > diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > index 5dae7de..dd82018 100644 > --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > @@ -4177,10 +4177,13 @@ void mgt_dispatcher(struct adapter *padapter, struct > recv_frame *precv_frame) > > RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, >("+mgt_dispatcher: type(0x%x) subtype(0x%x)\n", > - GetFrameType(pframe), GetFrameSubType(pframe))); > + (unsigned int)GetFrameType(pframe), > + (unsigned int)GetFrameSubType(pframe))); I don't understand why you are adding these typecasts, you aren't changing anything that requires this, right? > > if (GetFrameType(pframe) != WIFI_MGT_TYPE) { > - RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("mgt_dispatcher: > type(0x%x) error!\n", GetFrameType(pframe))); > + RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, > + ("mgt_dispatcher: type(0x%x) error!\n", > + (unsigned int)GetFrameType(pframe))); > return; > } > > diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c > b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c > index 077b39a..3bb40a7fe 100644 > --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c > +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c > @@ -1414,13 +1414,15 @@ void update_IOT_info(struct adapter *padapter) > pmlmeinfo->turboMode_cts2self = 0; > pmlmeinfo->turboMode_rtsen = 1; > /* disable high power */ > - Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false); > + Switch_DM_Func(padapter, (u32)(~DYNAMIC_BB_DYNAMIC_TXPWR), > +false); > break; > case HT_IOT_PEER_REALTEK: > /* rtw_write16(padapter, 0x4cc, 0x); */ > /* rtw_write16(padapter, 0x546, 0x01c0); */ > /* disable high power */ > - Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false); > + Switch_DM_Func(padapter, (u32)(~DYNAMIC_BB_DYNAMIC_TXPWR), > +false); > break; > default: > pmlmeinfo->turboMode_cts2self = 0; > diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_spec.h > b/drivers/staging/rtl8188eu/include/rtl8188e_spec.h > index 2c33eb3..e99179a 100644 > --- a/drivers/staging/rtl8188eu/include/rtl8188e_spec.h > +++ b/drivers/staging/rtl8188eu/include/rtl8188e_spec.h > @@ -19,10 +19,6 @@ > #ifndef __RTL8188E_SPEC_H__ > #define __RTL8188E_SPEC_H__ > > -#ifndef BIT > -#define BIT(x) (1 << (x)) > -#endif > - > #define BIT0 0x0001 > #define BIT1 0x0002 > #define BIT2 0x0004 What about these BIT0 and other #defines, they should be removed too, right? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/2] staging: dgap: fix possible NULL dereference
On Thu, Sep 10, 2015 at 05:24:58PM +0530, Sudip Mukherjee wrote: > The return pointer from dgap_getword() is used in strcmp() where it is > dereferenced. But dgap_getword() can return NULL. > Lets put a check there and return 0 as error. > > Signed-off-by: Sudip Mukherjee > --- > drivers/staging/dgap/dgap.c | 2 ++ > 1 file changed, 2 insertions(+) While this change is all nice and fine, this driver is totally abusing the firmware kernel interface to read in a "configuration file" and then parse it within the driver. That's not ok at all, no tty driver should ever need this. Please work to just rip all of that crap out. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: slicoss: remove unused variables
On Thu, Sep 10, 2015 at 06:52:22PM +0530, Sudip Mukherjee wrote: > On Wed, Sep 09, 2015 at 11:31:37AM -0700, Greg Kroah-Hartman wrote: > > On Fri, Sep 04, 2015 at 06:53:18PM +0530, Sudip Mukherjee wrote: > > > These variables were only assigned some values but they were never used. > > > > > > Signed-off-by: Sudip Mukherjee > > > --- > > > drivers/staging/slicoss/slicoss.c | 27 ++- > > > 1 file changed, 6 insertions(+), 21 deletions(-) > > > > > > diff --git a/drivers/staging/slicoss/slicoss.c > > > b/drivers/staging/slicoss/slicoss.c > > > index 8585970..1536ca0 100644 > > > --- a/drivers/staging/slicoss/slicoss.c > > > +++ b/drivers/staging/slicoss/slicoss.c > > > > @@ -1730,15 +1727,13 @@ static void slic_link_event_handler(struct > > > adapter *adapter) > > > pshmem = (struct slic_shmem *)(unsigned long)adapter->phys_shmem; > > > > > > #if BITS_PER_LONG == 64 > > > - status = slic_upr_request(adapter, > > > - SLIC_UPR_RLSR, > > > - SLIC_GET_ADDR_LOW(&pshmem->linkstatus), > > > - SLIC_GET_ADDR_HIGH(&pshmem->linkstatus), > > > - 0, 0); > > > + slic_upr_request(adapter, SLIC_UPR_RLSR, > > > + SLIC_GET_ADDR_LOW(&pshmem->linkstatus), > > > + SLIC_GET_ADDR_HIGH(&pshmem->linkstatus), 0, 0); > > > #else > > > - status = slic_upr_request(adapter, SLIC_UPR_RLSR, > > > - (u32) &pshmem->linkstatus, /* no 4GB wrap guaranteed */ > > > - 0, 0, 0); > > > + slic_upr_request(adapter, SLIC_UPR_RLSR, > > > + (u32)&pshmem->linkstatus, /* no 4GB wrap guaranteed */ > > > + 0, 0, 0); > > > > Shouldn't we do something with status instead of just ignoring it? > I can think of 3 possibilities. > 1) Ignore it as this is writing READ_LINK_STATUS command to the device > asynchronously, and then writing UP configuration command. So if status > is error here then the device will not be UP. > > 2) loop here with a delay until the call succeeds. (will be a very bad > design, but there are some codes doing that). But this functions is also > called from an ISR so we should not be doing that. > > 3) return the error code and do the error handling properly by clearing > and releasing all resources acquired by the function which called it. > > Which one will you suggest? I am sure you will say : 3. :) I don't know why you even had to ask, of course 3 is the correct thing :) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/2] staging: wilc1000: remove unused enum
On Fri, Sep 11, 2015 at 12:04:19PM +0900, Tony Cho wrote: > From: Glen Lee > > This patch removes a unused enum tenuFrameClass. > > Signed-off-by: Glen Lee > Signed-off-by: Tony Cho > --- > drivers/staging/wilc1000/coreconfigurator.c | 8 > 1 file changed, 8 deletions(-) I already applied this, why resend it? greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: speakup: Changed simple_strtoul to kstrtoul
On Fri, Sep 11, 2015 at 08:47:20PM +0530, Aparna Karuthodi wrote: > Used kstrtoul instead of simple_strtoul to remove a warning detected by > checkpatch.The warning is given below: > drivers/staging/speakup/varhandlers.c:327: WARNING: simple_strtoul is > obsolete, use kstrtoul instead > > Signed-off-by: Aparna Karuthodi > --- > drivers/staging/speakup/varhandlers.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/speakup/varhandlers.c > b/drivers/staging/speakup/varhandlers.c > index 1b0d1c0..00fd67e 100644 > --- a/drivers/staging/speakup/varhandlers.c > +++ b/drivers/staging/speakup/varhandlers.c > @@ -324,7 +324,7 @@ char *spk_s2uchar(char *start, char *dest) > { > int val = 0; > > - val = simple_strtoul(skip_spaces(start), &start, 10); > + val = kstrtoul(skip_spaces(start), &start, 10); > if (*start == ',') > start++; > *dest = (u_char)val; You obviously did not even compile this patch, which is quite rude, don't you think? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: speakup: Used kstrtoul instead of simple_strtoul
On Fri, Sep 11, 2015 at 06:06:34PM +0530, Aparna Karuthodi wrote: > Used kstrtoul instead of simple_strtoul inorder to fix a warning > detected by checkpatch. > The warning is given below: > drivers/staging/speakup/kobjects.c:156: WARNING: simple_strtoul is > obsolete, use kstrtoul instead > > Signed-off-by: Aparna Karuthodi > --- > drivers/staging/speakup/kobjects.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/speakup/kobjects.c > b/drivers/staging/speakup/kobjects.c > index 3708bc1..05de0b7 100644 > --- a/drivers/staging/speakup/kobjects.c > +++ b/drivers/staging/speakup/kobjects.c > @@ -153,7 +153,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj, > continue; > } > > - index = simple_strtoul(cp, &temp, 10); > + index = kstrtoul(cp, &temp, 10); > if (index > 255) { > rejected++; > cp = linefeed + 1; > -- > 1.7.9.5 Never send patches that you yourself did not at least test-build. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2 01/31] staging: wilc1000: rename WILC_WFI_CfgSetChannel
On Fri, Sep 11, 2015 at 04:14:00AM +0900, Chaehyun Lim wrote: > This patch replaces WILC_WFI_CfgSetChannel with > wilc_set_channel to avoid CamelCase. > > Signed-off-by: Chaehyun Lim > --- > V2: to make function name simple > > drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c > b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c > index cf76a33..3149fd8 100644 > --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c > +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c > @@ -677,7 +677,7 @@ static void CfgConnectResult(tenuConnDisconnEvent > enuConnDisconnEvent, > > > /** > - * @brief WILC_WFI_CfgSetChannel > + * @brief wilc_set_channel > * @detailsSet channel for a given wireless interface. Some devices > * may support multi-channel operation (by channel > hopping) so cfg80211 > * doesn't verify much. Note, however, that the passed > netdev may be > @@ -689,8 +689,8 @@ static void CfgConnectResult(tenuConnDisconnEvent > enuConnDisconnEvent, > * @date01 MAR 2012 > * @version 1.0 > */ > -static int WILC_WFI_CfgSetChannel(struct wiphy *wiphy, > - struct cfg80211_chan_def *chandef) > +static int wilc_set_channel(struct wiphy *wiphy, > + struct cfg80211_chan_def *chandef) static functions do not need a "wilc_" prefix. Just name it "set_channel()" Can you redo this series based on that, rebase on my staging-testing git branch as things are changing fast in this driver, and then resend? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: lustre: lnet: klnds: socklnd: Added a space
On Fri, Sep 11, 2015 at 08:48:57PM +0530, Anjali Menon wrote: > Added a space to fix the following coding style error detected by > checkpatch: > > ERROR: spaces required around that ':' (ctx:VxE) > > Signed-off-by: Anjali Menon > --- > drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > index fa7ad88..81943be 100644 > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > @@ -715,7 +715,7 @@ ksocknal_queue_tx_locked (ksock_tx_t *tx, ksock_conn_t > *conn) > LASSERT (tx->tx_resid == tx->tx_nob); > > CDEBUG (D_NET, "Packet %p type %d, nob %d niov %d nkiov %d\n", > - tx, (tx->tx_lnetmsg != NULL) ? tx->tx_lnetmsg->msg_hdr.type: > + tx, (tx->tx_lnetmsg != NULL) ? tx->tx_lnetmsg->msg_hdr.type : > KSOCK_MSG_NOOP, > tx->tx_nob, tx->tx_niov, tx->tx_nkiov); > > -- > 1.9.1 Someone else already sent this patch in before you did, sorry. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel