[PATCH] drivers: staging: lustre: replace variable length array by dynamic allocation
Fixes the following sparse warnings: drivers/staging/lustre/lustre/llite/xattr.c:89:62: warning: Variable length array is used. drivers/staging/lustre/lustre/llite/xattr.c:366:62: warning: Variable length array is used. Signed-off-by: Raphaël Beamonte --- drivers/staging/lustre/lustre/llite/xattr.c | 24 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 6187bffec8c4..ccfc728d8ec0 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -86,7 +86,7 @@ ll_xattr_set_common(const struct xattr_handler *handler, const char *name, const void *value, size_t size, int flags) { - char fullname[strlen(handler->prefix) + strlen(name) + 1]; + char *fullname; struct ll_sb_info *sbi = ll_i2sbi(inode); struct ptlrpc_request *req = NULL; const char *pv = value; @@ -140,10 +140,18 @@ ll_xattr_set_common(const struct xattr_handler *handler, return -EPERM; } + fullname = kmalloc(strlen(handler->prefix) + strlen(name) + 1, + GFP_KERNEL); + if (!fullname) + return -ENOMEM; + sprintf(fullname, "%s%s\n", handler->prefix, name); rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid, fullname, pv, size, 0, flags, ll_i2suppgid(inode), &req); + + kfree(fullname); + if (rc) { if (rc == -EOPNOTSUPP && handler->flags == XATTR_USER_T) { LCONSOLE_INFO("Disabling user_xattr feature because it is not supported on the server\n"); @@ -363,7 +371,7 @@ static int ll_xattr_get_common(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size) { - char fullname[strlen(handler->prefix) + strlen(name) + 1]; + char *fullname; struct ll_sb_info *sbi = ll_i2sbi(inode); #ifdef CONFIG_FS_POSIX_ACL struct ll_inode_info *lli = ll_i2info(inode); @@ -410,9 +418,17 @@ static int ll_xattr_get_common(const struct xattr_handler *handler, if (handler->flags == XATTR_ACL_DEFAULT_T && !S_ISDIR(inode->i_mode)) return -ENODATA; #endif + fullname = kmalloc(strlen(handler->prefix) + strlen(name) + 1, + GFP_KERNEL); + if (!fullname) + return -ENOMEM; + sprintf(fullname, "%s%s\n", handler->prefix, name); - return ll_xattr_list(inode, fullname, handler->flags, buffer, size, -OBD_MD_FLXATTR); + rc = ll_xattr_list(inode, fullname, handler->flags, buffer, size, + OBD_MD_FLXATTR); + + kfree(fullname); + return rc; } static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size) -- 2.11.0
[PATCH] drivers: staging: ccree: ISO C forbids casting to and from non-scalar
Fixes the following sparse warnings: drivers/staging/ccree/ssi_hash.c:2447:24: warning: cast to non-scalar drivers/staging/ccree/ssi_hash.c:2447:24: warning: cast from non-scalar drivers/staging/ccree/ssi_hash.c:2448:28: warning: cast to non-scalar drivers/staging/ccree/ssi_hash.c:2448:28: warning: cast from non-scalar Signed-off-by: Raphaël Beamonte --- drivers/staging/ccree/ssi_hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 162d17dee2cd..8585f73161b3 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -2444,8 +2444,8 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata) /* register hmac version */ - if struct ssi_hash_template)driver_hash[alg]).hw_mode != DRV_CIPHER_XCBC_MAC) && - (((struct ssi_hash_template)driver_hash[alg]).hw_mode != DRV_CIPHER_CMAC)) { + if struct ssi_hash_template *)&driver_hash[alg])->hw_mode != DRV_CIPHER_XCBC_MAC) && + (((struct ssi_hash_template *)&driver_hash[alg])->hw_mode != DRV_CIPHER_CMAC)) { t_alg = ssi_hash_create_alg(&driver_hash[alg], true); if (IS_ERR(t_alg)) { rc = PTR_ERR(t_alg); -- 2.11.0
[PATCH staging/rtl8712] staging: rtl8712: checkpatch cleanup: block comments using a trailing */
Fix checkpatch.pl warning "Block comments use a trailing */ on a separate line" on multiple files of the driver by editing the affected comments. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8712/rtl8712_led.c | 12 -- drivers/staging/rtl8712/rtl8712_recv.c | 54 - drivers/staging/rtl8712/rtl8712_recv.h | 3 +- drivers/staging/rtl8712/rtl8712_spec.h | 3 +- drivers/staging/rtl8712/rtl8712_syscfg_bitdef.h | 27 - drivers/staging/rtl8712/rtl8712_xmit.c | 9 +++-- drivers/staging/rtl8712/rtl871x_cmd.h | 9 +++-- drivers/staging/rtl8712/rtl871x_ht.h| 3 +- drivers/staging/rtl8712/rtl871x_ioctl.h | 3 +- drivers/staging/rtl8712/rtl871x_ioctl_set.c | 12 -- drivers/staging/rtl8712/rtl871x_led.h | 15 --- drivers/staging/rtl8712/rtl871x_mlme.c | 30 +- drivers/staging/rtl8712/rtl871x_mlme.h | 12 -- drivers/staging/rtl8712/rtl871x_mp.c| 3 +- drivers/staging/rtl8712/rtl871x_mp.h| 3 +- drivers/staging/rtl8712/rtl871x_mp_ioctl.h | 39 -- drivers/staging/rtl8712/rtl871x_mp_phy_regdef.h | 33 ++- drivers/staging/rtl8712/rtl871x_pwrctrl.c | 3 +- drivers/staging/rtl8712/rtl871x_pwrctrl.h | 3 +- drivers/staging/rtl8712/rtl871x_recv.c | 24 +++ drivers/staging/rtl8712/rtl871x_recv.h | 9 +++-- drivers/staging/rtl8712/rtl871x_security.h | 24 +++ drivers/staging/rtl8712/rtl871x_sta_mgt.c | 3 +- drivers/staging/rtl8712/rtl871x_xmit.c | 18 ++--- drivers/staging/rtl8712/rtl871x_xmit.h | 12 -- drivers/staging/rtl8712/usb_halinit.c | 3 +- drivers/staging/rtl8712/usb_intf.c | 12 -- drivers/staging/rtl8712/wifi.h | 15 --- drivers/staging/rtl8712/wlan_bssdef.h | 6 ++- 29 files changed, 268 insertions(+), 134 deletions(-) diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c index 9055827..76d0535 100644 --- a/drivers/staging/rtl8712/rtl8712_led.c +++ b/drivers/staging/rtl8712/rtl8712_led.c @@ -58,10 +58,12 @@ enum _LED_STATE_871x { LED_POWER_ON_BLINK = 5, LED_SCAN_BLINK = 6, /* LED is blinking during scanning period, * the # of times to blink is depend on time -* for scanning. */ +* for scanning. +*/ LED_NO_LINK_BLINK = 7, /* LED is blinking during no link state. */ LED_BLINK_StartToBlink = 8,/* Customized for Sercomm Printer - * Server case */ + * Server case + */ LED_BLINK_WPS = 9, /* LED is blinkg during WPS communication */ LED_TXRX_BLINK = 10, LED_BLINK_WPS_STOP = 11,/*for ALPHA */ @@ -110,7 +112,8 @@ static void DeInitLed871x(struct LED_871x *pLed) { del_timer_sync(&pLed->BlinkTimer); /* We should reset bLedBlinkInProgress if we cancel -* the LedControlTimer, */ +* the LedControlTimer, +*/ pLed->bLedBlinkInProgress = false; } @@ -827,7 +830,8 @@ static void BlinkTimerCallback(unsigned long data) struct LED_871x *pLed = (struct LED_871x *)data; /* This fixed the crash problem on Fedora 12 when trying to do the -* insmod;ifconfig up;rmmod commands. */ +* insmod;ifconfig up;rmmod commands. +*/ if (pLed->padapter->bSurpriseRemoved || pLed->padapter->bDriverStopped) return; schedule_work(&pLed->BlinkWorkItem); diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index f25b34c..4027d1a 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -163,7 +163,8 @@ static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib, drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f) >> 16; drvinfo_sz <<= 3; /*TODO: -* Offset 0 */ +* Offset 0 +*/ pattrib->bdecrypted = ((le32_to_cpu(prxstat->rxdw0) & BIT(27)) >> 27) ? 0 : 1; pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) & BIT(14)) >> 14; @@ -210,7 +211,8 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter, curfragnum = 0; if (curfragnum != pfhdr->attrib.frag_num) { /*the first fragment number must be 0 -*free the whole queue*/ +*free the whole queue +*/ r8712_free_recvframe(prframe, pfree_recv_queue); r8712_free_recvframe_queue
[PATCHv4 2/2] staging: rtl8192u: r8192U_core: reuse local temporary variables to keep lines under 80 characters
Reuse some local 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 | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index e67be02..35f7d0e 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1704,8 +1704,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; @@ -5198,7 +5199,8 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, } else { /* Key Material */ if (KeyContent != NULL) { - write_nic_dword(dev, WCAMI, (u32)(*(KeyContent + i - 2))); + TargetContent = (u32)(*(KeyContent + i - 2)); + write_nic_dword(dev, WCAMI, TargetContent); write_nic_dword(dev, RWCAM, TargetCommand); } } -- 2.5.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv4 1/2] 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 | 130 ++--- 1 file changed, 88 insertions(+), 42 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 28b54ba..e67be02 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -171,6 +171,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: @@ -194,15 +195,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; @@ -1649,9 +1653,11 @@ 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) { + int idx = 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(&priv->tx_pending[idx]), status); return -1; } @@ -1863,7 +1869,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; @@ -2071,10 +2079,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], ccmp_rsn_ie, 4)); + + return (wpaie_dd || wpaie_30); } else { return true; } @@ -2420,9 +2430,9 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) int i; for (i = 0; i < 6; i += 2) { - u16 tmp = 0; + u16 tmp = ((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1); - tmp = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) &g
Re: [PATCHv3 02/15] staging: rtl8192u: r8192U_core: add temporary variables to keep lines under 80 characters
2015-09-20 22:16 GMT-04:00 Greg Kroah-Hartman : > On Sun, Sep 20, 2015 at 01:14:14PM -0400, Raphaël Beamonte wrote: >> 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 28b54ba..2abc3e77 100644 >> --- a/drivers/staging/rtl8192u/r8192U_core.c >> +++ b/drivers/staging/rtl8192u/r8192U_core.c >> @@ -171,6 +171,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; > > A whole structure on the stack? Are you sure you want to do that? Nope. I don't want to. I don't know what I was thinking, or if even I was. Sorry for that, should have been a pointer. >> >> switch (channel_plan) { >> case COUNTRY_CODE_FCC: >> @@ -194,15 +195,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]; > > You just did a memory copy of a whole structure, did you really want to > do that? If so, why? You just changed the logic of this function, > potentially slowing things down and setting yourself up for causing real > bugs (hint, anything you now change in that structure is not going to be > ever saved, it will go away after the function is exited.) You're right. Should have been a pointer. Sorry again, that wasn't the intention. > Please be more aware of how structures and pointers work in C before > doing changes like this, I can't take this change. > >> + 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; >> @@ -1649,9 +1653,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]; > > Oh that's funny, think about what you just did here. Also should have been a pointer. I'll do a more thorough recheck of that patch before re-sending it. Thanks for your review and your time! > Please get some more experience with C before doing kernel development. > C is tricky and will let you shoot yourself in the foot and any other > body part if you are not _VERY_ careful. You just blew off a few limbs > without realizing it at all in just the first two changes you made. > > thanks, > > greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv3 08/15] 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 638bd5a..f56fb1b 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4004,7 +4004,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; @@ -4098,8 +4098,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; } @@ -4108,7 +4108,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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv3 01/15] 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 | 608 ++--- 1 file changed, 409 insertions(+), 199 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index d243989..28b54ba 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -190,11 +190,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 +265,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 +296,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 +316,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, +&data, 2, HZ / 2); if (status < 0) netdev_err(dev, "write_nic_word TimeOut! status: %d\n", status); @@ -329,11 +335,13 @@ void write_nic_dword(struct net_device *dev, int indx, u32 data) status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, &data, 4, HZ / 2); +(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f, +&data, 4, HZ / 2); if (status < 0) - netdev_err(dev, "write_nic_dword TimeOut! status: %d\n", status); + netdev_err(dev, "write_nic_dword TimeOut! status: %d\n", + status); } @@ -347,7 +355,8 @@ int read_nic_byte(struct net_device *dev, int indx, u8 *data) status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, -(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, "%s failure status: %d\n", __func__, status); @@ -619,7 +628,8 @@ static void rtl8192_proc_init_one(struct net_device *dev) if (rtl8192_proc) { dir = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev); if (!dir) { - RT_TRACE(COMP_ERR, "Unable to i
[PATCHv3 09/15] 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 f56fb1b..510f08d 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4005,7 +4005,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; @@ -4100,8 +4099,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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv3 02/15] 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 28b54ba..2abc3e77 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -171,6 +171,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: @@ -194,15 +195,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; @@ -1649,9 +1653,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; } @@ -1698,8 +1705,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; + long nalign = 4 - align; + newaddr = oldaddr + nalign; + priv->rx_urb[16]->transfer_buffer_length = 16 - nalign; } else { newaddr = oldaddr; priv->rx_urb[16]->transfer_buffer_length = 16; @@ -1863,7 +1871,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; @@ -2071,10 +2081,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 &
[PATCHv3 04/15] 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 7fe86ff..eb9c07e 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2766,6 +2766,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; @@ -2947,59 +2948,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]; +
[PATCHv3 03/15] 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 2abc3e77..7fe86ff 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -196,18 +196,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; @@ -1082,17 +1083,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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv3 10/15] 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 510f08d..b3dd18b 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3997,7 +3997,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; @@ -4065,27 +4065,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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv3 06/15] 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 7314e2f..1fd51ab 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3993,7 +3993,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; @@ -4019,7 +4019,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; } @@ -4029,10 +4029,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; @@ -4042,8 +4042,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; } @@ -4052,7 +4052,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 */ @@ -4064,8 +4064,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)) @@ -4073,16 +4073,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)) + -
[PATCHv3 05/15] 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 eb9c07e..7314e2f 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2447,129 +2447,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
[PATCHv3 12/15] 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 b3cedec..7dc1b34 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1546,12 +1546,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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv3 14/15] 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 171a494..7e04259 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4513,15 +4513,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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv3 15/15] 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 1ab0aea..36a7acc 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 == R
[PATCHv3 13/15] 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 7dc1b34..171a494 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3751,82 +3751,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, - /* Default
[PATCHv3 00/15] staging: rtl8192u: code clean up
Hi, Following Greg's comments on the previous version, here's an updated and rebased one without the already committed patch. Difference with v2: - Some line breaks were removed as it was less readable with them (patch 01) - A temporary variable has been created instead of reusing an existing variable (patch 02) Thanks, - R. Raphaël Beamonte (15): 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 | 1392 drivers/staging/rtl8192u/r819xU_phy.c | 57 - 6 files changed, 822 insertions(+), 663 deletions(-) -- 2.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv3 11/15] 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 b3dd18b..b3cedec 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4066,6 +4066,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; @@ -4074,16 +4076,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]); @@ -4103,12 +4105,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; } @@ -4121,69 +4128,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 >
[PATCHv3 07/15] 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 1fd51ab..638bd5a 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4003,7 +4003,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; @@ -4100,14 +4100,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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] tools lib api fs: Store tracing mountpoint for better error message
2015-09-19 10:47 GMT-04:00 Jiri Olsa : > Storing the actual tracing path mountpoint to display correct > error message hint ('Hint:' line). The error hint rediscovers > mountpoints, but it could be different from what we actually > used in tracing path. > > Before we'd display debugfs mount even though tracefs was used: > $ perf record -e sched:sched_krava ls > event syntax error: 'sched:sched_krava' >\___ can't access trace events > > Error: No permissions to read > /sys/kernel/debug/tracing/events/sched/sched_krava > Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug' > ... > > After this change, correct mountpoint is displayed: > $ perf record -e sched:sched_krava ls > event syntax error: 'sched:sched_krava' >\___ can't access trace events > > Error: No permissions to read > /sys/kernel/debug/tracing/events/sched/sched_krava > Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/tracing' > ... > > Link: http://lkml.kernel.org/n/tip-xw7mf64ie0svh6m449vby...@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/lib/api/fs/tracing_path.c | 13 +++-- > 1 file changed, 3 insertions(+), 10 deletions(-) > > diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c > index 38aca2dd1946..0406a7d5c891 100644 > --- a/tools/lib/api/fs/tracing_path.c > +++ b/tools/lib/api/fs/tracing_path.c > @@ -12,12 +12,14 @@ > #include "tracing_path.h" > > > +char tracing_mnt[PATH_MAX + 1] = "/sys/kernel/debug"; > char tracing_path[PATH_MAX + 1]= "/sys/kernel/debug/tracing"; > char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events"; > > > static void __tracing_path_set(const char *tracing, const char *mountpoint) > { > + snprintf(tracing_mnt, sizeof(tracing_mnt), "%s", mountpoint); > snprintf(tracing_path, sizeof(tracing_path), "%s/%s", > mountpoint, tracing); > snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s", > @@ -109,19 +111,10 @@ static int strerror_open(int err, char *buf, size_t > size, const char *filename) > "Hint:\tTry 'sudo mount -t debugfs nodev > /sys/kernel/debug'"); > break; > case EACCES: { > - const char *mountpoint = debugfs__mountpoint(); > - > - if (!access(mountpoint, R_OK) && strncmp(filename, > "tracing/", 8) == 0) { > - const char *tracefs_mntpoint = tracefs__mountpoint(); > - > - if (tracefs_mntpoint) > - mountpoint = tracefs__mountpoint(); > - } > - > snprintf(buf, size, > "Error:\tNo permissions to read %s/%s\n" > "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", > -tracing_events_path, filename, mountpoint); > +tracing_events_path, filename, tracing_mnt); > } > break; > default: > -- > 2.4.3 > Reviewed-by: Raphaël Beamonte -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] tools lib api fs: Store tracing mountpoint for better error message
2015-09-19 11:00 GMT-04:00 Jiri Olsa : > On Sat, Sep 19, 2015 at 08:50:19AM -0600, David Ahern wrote: >> On 9/19/15 8:47 AM, Jiri Olsa wrote: >> >> >diff --git a/tools/lib/api/fs/tracing_path.c >> >b/tools/lib/api/fs/tracing_path.c >> >index 38aca2dd1946..0406a7d5c891 100644 >> >--- a/tools/lib/api/fs/tracing_path.c >> >+++ b/tools/lib/api/fs/tracing_path.c >> >@@ -12,12 +12,14 @@ >> > #include "tracing_path.h" >> > >> > >> >+char tracing_mnt[PATH_MAX + 1] = "/sys/kernel/debug"; >> > char tracing_path[PATH_MAX + 1]= "/sys/kernel/debug/tracing"; >> > char tracing_events_path[PATH_MAX + 1] = >> > "/sys/kernel/debug/tracing/events"; >> >> why all the +1s? null terminator has to fit within PATH_MAX as well. > > good question.. can't see a reason ATM It is quite weird actually, it seems there is multiple occurrences of that, without any comment to explain why that +1, even if the #define of PATH_MAX in limits.h specify that that size also counts nul. Most of these occurrences are linked to perf though, but there's also fs/ocfs2/aops.c, scripts/docproc.c and usr/gen_init_cpio.c. Perhaps a mistake that started somewhere and that was propagated looking at the original mistake? > jirka > >> >> > >> > >> > static void __tracing_path_set(const char *tracing, const char >> > *mountpoint) >> > { >> >+snprintf(tracing_mnt, sizeof(tracing_mnt), "%s", mountpoint); >> > snprintf(tracing_path, sizeof(tracing_path), "%s/%s", >> > mountpoint, tracing); >> > snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s", >> >@@ -109,19 +111,10 @@ static int strerror_open(int err, char *buf, size_t >> >size, const char *filename) >> > "Hint:\tTry 'sudo mount -t debugfs nodev >> > /sys/kernel/debug'"); >> > break; >> > case EACCES: { >> >-const char *mountpoint = debugfs__mountpoint(); >> >- >> >-if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", >> >8) == 0) { >> >-const char *tracefs_mntpoint = tracefs__mountpoint(); >> >- >> >-if (tracefs_mntpoint) >> >-mountpoint = tracefs__mountpoint(); >> >-} >> >- >> > snprintf(buf, size, >> > "Error:\tNo permissions to read %s/%s\n" >> > "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", >> >- tracing_events_path, filename, mountpoint); >> >+ tracing_events_path, filename, tracing_mnt); >> > } >> > break; >> > default: >> > >> >> LGTM. >> >> David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv2 03/16] staging: rtl8192u: r8192U_core: add temporary variables to keep lines under 80 characters
2015-09-17 1:18 GMT-04:00 Greg Kroah-Hartman : > On Thu, Sep 17, 2015 at 01:06:33AM -0400, Raphaël Beamonte wrote: >> 2015-09-17 0:57 GMT-04:00 Greg Kroah-Hartman : >> >> >> @@ -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; >> > > > But step back please, what exactly is this trying to do? I think it's a > round_up type function, perhaps that should be what we do instead (the > kernel has such functions already.) I think it's trying to get a 4-alignment for the transfer_buffer stored in priv->rx_urb[16]. If our alignment is not correct, and there is for instance X needed to align (X < 4), we move the address of X, and reduce the buffer size of X. I looked at the code of round_up (also round_down and __round_mask) in the kernel, but I'm not totally sure how we would use it here? > It might be the same "idea", but it's not what you did, so don't try to > sneak it in. That wasn't my intention. Sorry for that. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv2 03/16] staging: rtl8192u: r8192U_core: add temporary variables to keep lines under 80 characters
2015-09-17 0:57 GMT-04:00 Greg Kroah-Hartman : >> @@ -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; > > At a quick glance, this conversion looks wrong... What is wrong with it? oldaddr + 4 - align; can also be read: oldaddr + (4 - align); as well as 16 - 4 + align; can also be read 16 - (4 - align); as when we remove the parenthesis, the - sign invert the parenthesis elements signs. Calculating (4 - align) previously thus preserve the logic here! > And it's not what your changelog text said you were doing :( It's true that I didn't add a new temporary variable here but instead re-used one that is not used after, but I thought it went in the same idea as the rest of this patch. Should I separate that as another patch? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] perf tools: Propagate error info from tp_format
2015-09-14 17:36 GMT-04:00 Arnaldo Carvalho de Melo : > Em Mon, Sep 14, 2015 at 04:59:41PM -0400, Raphaël Beamonte escreveu: >> 2015-09-14 16:53 GMT-04:00 Arnaldo Carvalho de Melo : >> > +++ b/tools/perf/util/evsel.c >> > @@ -234,7 +234,9 @@ struct perf_evsel *perf_evsel__newtp_idx(const char >> > *sys, const char *name, int >> > struct perf_evsel *evsel = zalloc(perf_evsel__object.size); >> > int err = -ENOMEM; >> > >> > - if (evsel != NULL) { >> > + if (evsel == NULL) { >> > + goto out_err; >> > + } else { >> >> Is the else really necessary after a goto? > > Not really, we can remove it and all would be equivalent (the code > with/without should be the same), its just that I wanted to avoid > touching the identation to reduce patch size and since we need o open a > brace to declare that attr variable... > > - Arnaldo Ok. Though, given the content of that function, we could probably declare attr in the first lines of the function and assign it its value after the if. But I understand the patch size argument! :o) On another subject, but on the same lines, shouldn't we use if (!evsel) instead of if (evsel == NULL)? (kernel code style if I'm not mistaken) Or is there something that prevents from using it here? >> > struct perf_event_attr attr = { >> > .type = PERF_TYPE_TRACEPOINT, >> > .sample_type = (PERF_SAMPLE_RAW | >> > PERF_SAMPLE_TIME | >> > @@ -261,6 +263,7 @@ struct perf_evsel *perf_evsel__newtp_idx(const char >> > *sys, const char *name, int >> > out_free: >> > zfree(&evsel->name); >> > free(evsel); >> > +out_err: >> > return ERR_PTR(err); >> > } >> > >> > diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c >> > index 8e3a60e3e15f..802bb868d446 100644 >> > --- a/tools/perf/util/trace-event.c >> > +++ b/tools/perf/util/trace-event.c >> > @@ -100,7 +100,7 @@ struct event_format* >> > trace_event__tp_format(const char *sys, const char *name) >> > { >> > if (!tevent_initialized && trace_event__init2()) >> > - return NULL; >> > + return ERR_PTR(-ENOMEM); >> > >> > return tp_format(sys, name); >> > } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] perf tools: Propagate error info from tp_format
2015-09-14 16:53 GMT-04:00 Arnaldo Carvalho de Melo : > Em Thu, Sep 10, 2015 at 10:24:52AM +0200, Jiri Olsa escreveu: >> On Wed, Sep 09, 2015 at 05:58:13PM -0300, Arnaldo Carvalho de Melo wrote: >> >> SNIP >> >> > This kind of stuff is ok, as evsel is a local variable and you kept the >> > interface for perf_evsel__syscall_newtp(), i.e. it returns NULL if a new >> > evsel can't be instantiated. >> > >> > Ok, but that is a different interface than the one used by >> > perf_evsel__newtp(), that also instantiates a new evsel. >> > >> > So when one thinks about "foo__new()" we now need to check which one of >> > the two interfaces it uses, if err.h or if the old NULL based failure >> > reporting one. >> > >> > Double tricky if it is foo__new() and foo__new_variant(), as >> > perf_evsel__syscall_newtp() and perf_evsel__newtp(), i.e. both will >> > return a "struct perf_evsel" instance, but one using err.h, the other >> > use NULL. >> > >> > Ok, you marked the ones using a comment, wonder if we couldn't use >> > 'sparse' somehow here, is it used to check IS_ERR() usage in the kernel? >> >> hum, not sure.. will check ;-) >> >> at least we could mark related functions with __must_check >> to force the return value check >> >> > >> > Ah, but what about this in trace__event_handler() in builtin-trace.c? >> > >> > if (evsel->tp_format) { >> > event_format__fprintf(evsel->tp_format, sample->cpu, >> > sample->raw_data, sample->raw_size, >> > trace->output); >> > } >> > >> > >> > Don't we have to use IS_ERR() here? Ok, no, because if setting up >> > evsel->tp_format fails, then that evsel will be destroyed and >> > perf_evsel__newtp() will return ERR_PTR(), so it is ok not no use >> > ERR_PTR(evsel->tp_format) because it will only be != NULL when it was >> > successfully set up. >> > >> > But then, in perf_evsel__newtp_idx if zalloc() fails we will not return >> > ERR_PTR(), but instead NULL, a-ha, this one seems to be a real bug, no? >> >> hate those allocations in declarations.. never do any good ;-) >> >> yep, NULL is not an error, so it's real bug, attached patch should fix it >> >> thanks, >> jirka > > > Ok continuing, found two more problems in this patch, fixed as follows, > merging. > > - Arnaldo > > diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c > index 666b67a4df9d..4bb0c5d2059d 100644 > --- a/tools/perf/tests/mmap-basic.c > +++ b/tools/perf/tests/mmap-basic.c > @@ -65,7 +65,7 @@ int test__basic_mmap(void) > > snprintf(name, sizeof(name), "sys_enter_%s", > syscall_names[i]); > evsels[i] = perf_evsel__newtp("syscalls", name); > - if (evsels[i] == NULL) { > + if (IS_ERR(evsels[i]) == NULL) { > pr_debug("perf_evsel__new\n"); > goto out_delete_evlist; > } > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index 08c20ee4e27d..6b5d1b509148 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -234,7 +234,9 @@ struct perf_evsel *perf_evsel__newtp_idx(const char *sys, > const char *name, int > struct perf_evsel *evsel = zalloc(perf_evsel__object.size); > int err = -ENOMEM; > > - if (evsel != NULL) { > + if (evsel == NULL) { > + goto out_err; > + } else { Is the else really necessary after a goto? > struct perf_event_attr attr = { > .type = PERF_TYPE_TRACEPOINT, > .sample_type = (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | > @@ -261,6 +263,7 @@ struct perf_evsel *perf_evsel__newtp_idx(const char *sys, > const char *name, int > out_free: > zfree(&evsel->name); > free(evsel); > +out_err: > return ERR_PTR(err); > } > > diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c > index 8e3a60e3e15f..802bb868d446 100644 > --- a/tools/perf/util/trace-event.c > +++ b/tools/perf/util/trace-event.c > @@ -100,7 +100,7 @@ struct event_format* > trace_event__tp_format(const char *sys, const char *name) > { > if (!tevent_initialized && trace_event__init2()) > - return NULL; > + return ERR_PTR(-ENOMEM); > > return tp_format(sys, name); > } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] staging/rtl8192u: remove unused function
2015-09-14 14:00 GMT-04:00 Nicolas Joseph : > Remove N_DBPSOfRate used in ComputeTxTime, remove by > commit 742728f97a99 ("staging: rtl8192u: remove unused function.") > > Signed-off-by: Nicolas Joseph > --- > drivers/staging/rtl8192u/r8192U_core.c | 44 > -- > 1 file changed, 44 deletions(-) > > diff --git a/drivers/staging/rtl8192u/r8192U_core.c > b/drivers/staging/rtl8192u/r8192U_core.c > index b143b36..80a6a4f 100644 > --- a/drivers/staging/rtl8192u/r8192U_core.c > +++ b/drivers/staging/rtl8192u/r8192U_core.c > @@ -1227,50 +1227,6 @@ inline u8 rtl8192_IsWirelessBMode(u16 rate) > return 0; > } > > -u16 N_DBPSOfRate(u16 DataRate) > -{ > - u16 N_DBPS = 24; > - > - switch (DataRate) { > - case 60: > - N_DBPS = 24; > - break; > - > - case 90: > - N_DBPS = 36; > - break; > - > - case 120: > - N_DBPS = 48; > - break; > - > - case 180: > - N_DBPS = 72; > - break; > - > - case 240: > - N_DBPS = 96; > - break; > - > - case 360: > - N_DBPS = 144; > - break; > - > - case 480: > - N_DBPS = 192; > - break; > - > - case 540: > - N_DBPS = 216; > - break; > - > - default: > - break; > - } > - > - return N_DBPS; > -} > - > short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) > { > struct r8192_priv *priv = ieee80211_priv(dev); > -- > 2.5.2 > Not sure the commit message is really clear. Something like this seems more clean to me: "Remove unused function N_DBPSOfRate. This function was only used by function ComputeTxTime that was removed in a previous commit." -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] perf tools: Enhance parsing events tracepoint error output
2015-09-11 16:22 GMT-04:00 Arnaldo Carvalho de Melo : > Em Fri, Sep 11, 2015 at 03:56:44PM -0400, Raphaël Beamonte escreveu: >> Another possibility would be to have another perf command, sort of a >> "perf remountfs", to run with sudo and that would make itself both >> checks and remount accordingly the two fs. > > This part maybe more interesting, so I'll focus on it, yeah, having a: > 'perf fixperms' command (have a better name? :) ) may make sense, would > need context tho, i.e. something like: > > perf fixperms trace > > Or: > > perf fixperms top > > But then, perhaps in that case: > > $ trace ls > Error:No permissions to read > /sys/kernel/debug/tracing/events/raw_syscalls/sys_(enter|exit) > Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug' > > We could just add some more text saying that please check as well that > the other parts of the path we're trying to access are available once > the suggestion is followed. Wouldn't it be almost the same as your "Something is wrong with tracefs and/or debugfs, figure it out and try again" ? ;o) I think that if the 'fixperms' need a context, we could as well give the 'perf fixperms' command to type directly in the Hint, such as: $ trace ls Error:No permissions to read /sys/kernel/debug/tracing/events/raw_syscalls/sys_(enter|exit) Hint: Try 'sudo perf fixperms trace' It would be the same as the current copy/paste, but one command that would fix the situation directly, instead of having to check the permissions of each level in the path. A little bit user-friendlier! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] perf tools: Enhance parsing events tracepoint error output
2015-09-11 14:55 GMT-04:00 Arnaldo Carvalho de Melo : > Em Fri, Sep 11, 2015 at 01:50:02PM -0400, Raphaël Beamonte escreveu: >> 2015-09-11 12:16 GMT-04:00 Jiri Olsa : >> > On Sat, Sep 12, 2015 at 01:09:31AM +0900, Namhyung Kim wrote: >> >> >> has a problem - if tracefs is mounted under debugfs, the access mode >> >> of debugfs also affects, so in this case I had to change it both for >> >> debugfs and tracefs.. > >> > hum, I wonder the error message needs to be that smart.. >> >> Hmm... If tracefs is mounted under debugfs, wouldn't remounting >> debugfs do the trick, as it was done before? > > Not necessarily, we may be able to access /a/ but not /a/b/, so, before > we get to /a/b/ we need to solve access to /a/ to then realize that > /a/b/ also need permission change so that we can access it. Well, I kind of had in mind that if we can access /a/, it's that /a/ is not the problem, so why would we remount it? Remounting /a/b/ should do the trick, and there's no reason we couldn't do it if we can access /a/. Or perhaps I'm missing something? >> If so, why couldn't we just check the paths with a basic strcmp to >> verify if tracefs starts by debugfs, and in that case offer to remount >> debugfs, else offer to remount tracefs? > > say it is how it was before tracefs: > > /sys/kernel/debug/tracing/ > > If we can't access "/sys/kernel/debug/tracing/" because we can't access > "/sys/kernel/debug/" we need first to change (remount, chmod/grp/own, > whatever is best in each hypotetical use case) /sys/kernel/debug/ to > then do the same for /sys/kernel/debug/tracing/, no? In that case, I'm following: if we can't access /sys/kernel/debug, we have to remount it anyway, and there's no guarantee that /sys/kernel/debug/tracing will have the right permissions. In that case, ok, we perhaps need to remount both. Perhaps because: can we be sure that if /sys/kernel/debug is inaccessible, it will be the same for /sys/kernel/debug/tracing ? > We could of course say something like "Something is wrong with tracefs > and/or debugfs, figure it out and try again", but we can do better, > right? 8-P > > - Arnaldo I agree! We were talking in a previous conversation about making perf the user-friendliest possible. But I don't know if providing two different remount to the user at the same time is the best thing to do (even in that second case). Why not checking first access to debugfs: if it doesn't work, give the remount line for debugfs then exit. The user will do it then run perf again. If it works, check tracefs: if it doesn't work, give the remount line for tracefs. That gives at most two fail-runs of perf before using it without any problem. It also allows not to give the user two different remount lines directly when we can't be sure the second one is useful (perhaps tracefs will be accessible directly?) Another possibility would be to have another perf command, sort of a "perf remountfs", to run with sudo and that would make itself both checks and remount accordingly the two fs. Thoughts? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] perf tools: Enhance parsing events tracepoint error output
2015-09-11 12:16 GMT-04:00 Jiri Olsa : > On Sat, Sep 12, 2015 at 01:09:31AM +0900, Namhyung Kim wrote: >> has a problem - if tracefs is mounted under debugfs, the access mode >> of debugfs also affects, so in this case I had to change it both for >> debugfs and tracefs.. > > > hum, I wonder the error message needs to be that smart.. > > jirka Hmm... If tracefs is mounted under debugfs, wouldn't remounting debugfs do the trick, as it was done before? If so, why couldn't we just check the paths with a basic strcmp to verify if tracefs starts by debugfs, and in that case offer to remount debugfs, else offer to remount tracefs? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[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 &
[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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[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, - /* Default
[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 == R
[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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[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 >
[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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[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: * Han
[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
[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)) + -
[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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[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]; +
[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 && +
[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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/5] perf tools: Propagate error info for the tracepoint parsing
int parse_events_add_tracepoint(struct list_head *list, int *idx, > - char *sys, char *event); > + char *sys, char *event, > + struct parse_events_error *error); > int parse_events_add_numeric(struct parse_events_evlist *data, > struct list_head *list, > u32 type, u64 config, > diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y > index 9cd70819c795..54a3004a8192 100644 > --- a/tools/perf/util/parse-events.y > +++ b/tools/perf/util/parse-events.y > @@ -376,7 +376,7 @@ PE_NAME '-' PE_NAME ':' PE_NAME > snprintf(&sys_name, 128, "%s-%s", $1, $3); > > ALLOC_LIST(list); > - ABORT_ON(parse_events_add_tracepoint(list, &data->idx, &sys_name, > $5)); > + ABORT_ON(parse_events_add_tracepoint(list, &data->idx, &sys_name, $5, > data->error)); > $$ = list; > } > | > @@ -386,7 +386,7 @@ PE_NAME ':' PE_NAME > struct list_head *list; > > ALLOC_LIST(list); > - if (parse_events_add_tracepoint(list, &data->idx, $1, $3)) { > + if (parse_events_add_tracepoint(list, &data->idx, $1, $3, > data->error)) { > struct parse_events_error *error = data->error; > > if (error) { > -- > 2.4.3 > Works for me. Reviewed-by: Raphaël Beamonte I also made sure I could compile and run perf with that patch applied on top of the current linux master. Should I also propose my Tested-by: tag? I didn't do thorough tests though. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface
2015-09-07 4:38 GMT-04:00 Jiri Olsa : > Adding part of the kernel's interface: > inline void * __must_check ERR_PTR(long error); > inline long __must_check PTR_ERR(__force const void *ptr); > inline bool __must_check IS_ERR(__force const void *ptr); > > it will be used to propagate error through pointers > in following patches. > > Link: http://lkml.kernel.org/n/tip-ufgnyf683uab69anmmrab...@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/include/linux/err.h | 49 > +++ > 1 file changed, 49 insertions(+) > create mode 100644 tools/include/linux/err.h Reviewed-by: Raphaël Beamonte > > diff --git a/tools/include/linux/err.h b/tools/include/linux/err.h > new file mode 100644 > index ..c9ada48f5156 > --- /dev/null > +++ b/tools/include/linux/err.h > @@ -0,0 +1,49 @@ > +#ifndef __TOOLS_LINUX_ERR_H > +#define __TOOLS_LINUX_ERR_H > + > +#include > +#include > + > +#include > + > +/* > + * Original kernel header comment: > + * > + * Kernel pointers have redundant information, so we can use a > + * scheme where we can return either an error code or a normal > + * pointer with the same return value. > + * > + * This should be a per-architecture thing, to allow different > + * error and pointer decisions. > + * > + * Userspace note: > + * The same principle works for userspace, because 'error' pointers > + * fall down to the unused hole far from user space, as described > + * in Documentation/x86/x86_64/mm.txt for x86_64 arch: > + * > + * - 7fff (=47 bits) user space, different per > mm hole caused by [48:63] sign extension > + * ffe0 - (=2 MB) unused hole > + * > + * It should be the same case for other architectures, because > + * this code is used in generic kernel code. > + */ > +#define MAX_ERRNO 4095 > + > +#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) > + > +static inline void * __must_check ERR_PTR(long error) > +{ > + return (void *) error; > +} > + > +static inline long __must_check PTR_ERR(__force const void *ptr) > +{ > + return (long) ptr; > +} > + > +static inline bool __must_check IS_ERR(__force const void *ptr) > +{ > + return IS_ERR_VALUE((unsigned long)ptr); > +} > + > +#endif /* _LINUX_ERR_H */ > -- > 2.4.3 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface
2015-09-08 17:06 GMT-04:00 Arnaldo Carvalho de Melo : > Em Tue, Sep 08, 2015 at 04:22:39PM -0400, Raphaël Beamonte escreveu: >> 2015-09-07 4:38 GMT-04:00 Jiri Olsa : >> > Adding part of the kernel's interface: >> > inline void * __must_check ERR_PTR(long error); >> > inline long __must_check PTR_ERR(__force const void *ptr); >> > inline bool __must_check IS_ERR(__force const void *ptr); >> > >> > it will be used to propagate error through pointers >> > in following patches. >> > >> > Link: http://lkml.kernel.org/n/tip-ufgnyf683uab69anmmrab...@git.kernel.org >> > Signed-off-by: Jiri Olsa >> > --- >> > tools/include/linux/err.h | 49 >> > +++ >> > 1 file changed, 49 insertions(+) >> > create mode 100644 tools/include/linux/err.h >> > >> > diff --git a/tools/include/linux/err.h b/tools/include/linux/err.h >> > new file mode 100644 >> > index ..c9ada48f5156 >> > --- /dev/null >> > +++ b/tools/include/linux/err.h >> > @@ -0,0 +1,49 @@ >> > +#ifndef __TOOLS_LINUX_ERR_H >> > +#define __TOOLS_LINUX_ERR_H >> > + >> > +#include >> > +#include >> > + >> > +#include >> > + >> > +/* >> > + * Original kernel header comment: >> > + * >> > + * Kernel pointers have redundant information, so we can use a >> > + * scheme where we can return either an error code or a normal >> > + * pointer with the same return value. >> > + * >> > + * This should be a per-architecture thing, to allow different >> > + * error and pointer decisions. >> > + * >> > + * Userspace note: >> > + * The same principle works for userspace, because 'error' pointers >> > + * fall down to the unused hole far from user space, as described >> > + * in Documentation/x86/x86_64/mm.txt for x86_64 arch: >> > + * >> > + * - 7fff (=47 bits) user space, different >> > per mm hole caused by [48:63] sign extension >> > + * ffe0 - (=2 MB) unused hole >> > + * >> > + * It should be the same case for other architectures, because >> > + * this code is used in generic kernel code. >> > + */ >> > +#define MAX_ERRNO 4095 >> > + >> > +#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) >> > + >> > +static inline void * __must_check ERR_PTR(long error) >> > +{ >> > + return (void *) error; >> > +} >> > + >> > +static inline long __must_check PTR_ERR(__force const void *ptr) >> > +{ >> > + return (long) ptr; >> > +} >> > + >> > +static inline bool __must_check IS_ERR(__force const void *ptr) >> > +{ >> > + return IS_ERR_VALUE((unsigned long)ptr); >> > +} >> > + >> > +#endif /* _LINUX_ERR_H */ >> > -- >> > 2.4.3 >> >> Perhaps a dumb question, but it seems the code is exactly the same as >> in linux/err.h besides the part of the comment you added. Why not >> using that file directly in the other patches then? > > We can't do that. > > Read: > > commit 3f735377bfd6567d80815a6242c147211963680a > Author: Arnaldo Carvalho de Melo > Date: Sun Jul 5 22:48:21 2015 -0300 > > tools: Copy lib/rbtree.c to tools/lib/ > > So that we can remove kernel specific stuff we've been stubbing out via > a tools/include/linux/export.h that gets removed in this patch and to > avoid breakages in the future like the one fixed recently where > rcupdate.h started being used in rbtree.h. > > > -- > > There are more copies like that, but the explanation above should be > enough, no? Yes, I understand now! Thanks! > > > - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface
2015-09-08 16:22 GMT-04:00 Raphaël Beamonte : > Perhaps a dumb question, but it seems the code is exactly the same as > in linux/err.h besides the part of the comment you added. Why not > using that file directly in the other patches then? I meant include/linux/err.h, from git root -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface
2015-09-07 4:38 GMT-04:00 Jiri Olsa : > Adding part of the kernel's interface: > inline void * __must_check ERR_PTR(long error); > inline long __must_check PTR_ERR(__force const void *ptr); > inline bool __must_check IS_ERR(__force const void *ptr); > > it will be used to propagate error through pointers > in following patches. > > Link: http://lkml.kernel.org/n/tip-ufgnyf683uab69anmmrab...@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/include/linux/err.h | 49 > +++ > 1 file changed, 49 insertions(+) > create mode 100644 tools/include/linux/err.h > > diff --git a/tools/include/linux/err.h b/tools/include/linux/err.h > new file mode 100644 > index ..c9ada48f5156 > --- /dev/null > +++ b/tools/include/linux/err.h > @@ -0,0 +1,49 @@ > +#ifndef __TOOLS_LINUX_ERR_H > +#define __TOOLS_LINUX_ERR_H > + > +#include > +#include > + > +#include > + > +/* > + * Original kernel header comment: > + * > + * Kernel pointers have redundant information, so we can use a > + * scheme where we can return either an error code or a normal > + * pointer with the same return value. > + * > + * This should be a per-architecture thing, to allow different > + * error and pointer decisions. > + * > + * Userspace note: > + * The same principle works for userspace, because 'error' pointers > + * fall down to the unused hole far from user space, as described > + * in Documentation/x86/x86_64/mm.txt for x86_64 arch: > + * > + * - 7fff (=47 bits) user space, different per > mm hole caused by [48:63] sign extension > + * ffe0 - (=2 MB) unused hole > + * > + * It should be the same case for other architectures, because > + * this code is used in generic kernel code. > + */ > +#define MAX_ERRNO 4095 > + > +#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) > + > +static inline void * __must_check ERR_PTR(long error) > +{ > + return (void *) error; > +} > + > +static inline long __must_check PTR_ERR(__force const void *ptr) > +{ > + return (long) ptr; > +} > + > +static inline bool __must_check IS_ERR(__force const void *ptr) > +{ > + return IS_ERR_VALUE((unsigned long)ptr); > +} > + > +#endif /* _LINUX_ERR_H */ > -- > 2.4.3 Perhaps a dumb question, but it seems the code is exactly the same as in linux/err.h besides the part of the comment you added. Why not using that file directly in the other patches then? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2] staging: rtl8192u: r8192U_core: fix use ether_addr_copy() over memcpy() code style issue
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) The values used are stored as dev_addr in net_device (declared in include/linux/netdevice.h) and sa_data in sockaddr (declared in include/linux/socket.h). Both these elements are u16 aligned as shown by using pahole (position must be a multiple of sizeof(u16)): unsigned char *dev_addr; /* 888 8 */ char sa_data[14]; /* 214 */ It is thus safe to use ether_addr_copy() instead of memcpy() for that call, as it is already done in multiple files in the Linux kernel sources: drivers/net/ethernet/broadcom/genet/bcmgenet.c drivers/net/ethernet/brocade/bna/bnad.c drivers/net/ethernet/emulex/benet/be_main.c drivers/net/ethernet/ezchip/nps_enet.c drivers/net/ethernet/ibm/ibmveth.c drivers/net/ethernet/intel/fm10k/fm10k_netdev.c drivers/net/ethernet/intel/i40e/i40e_main.c drivers/net/ethernet/mellanox/mlx5/core/en_main.c drivers/net/usb/lan78xx.c net/8021q/vlan_dev.c net/batman-adv/soft-interface.c net/dsa/slave.c Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 76255cb..b143b36 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3469,7 +3469,7 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac) down(&priv->wx_sem); - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + ether_addr_copy(dev->dev_addr, addr->sa_data); schedule_work(&priv->reset_wq); up(&priv->wx_sem); -- 2.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv2 18/19] staging: rtl8192u: r8192U_core: fix use ether_addr_copy() over memcpy() code style issue
2015-09-03 13:00 GMT-04:00 Greg Kroah-Hartman : > You need to prove that they are aligned before I can take this patch :( Right! I looked at those structs using pahole. The structs used are net_device from include/linux/netdevice.h and sockaddr from include/linux/socket.h, in which we use the elements dev_addr and sa_data respectively. Using pahole, the output for both those elements in the structs are: unsigned char *dev_addr; /* 888 8 */ char sa_data[14]; /* 214 */ If I understand correctly how pahole is outputing the information and what a u16 alignment means in the struct, I should, for both those cases, have a multiple of 2 (sizeof(u16)) as first value in the comment following the line (first value being the position of the element in the struct, second value its size). So if I understood correctly, in both those cases, it's working: they're u16 aligned. Also, to be sure, I searched in the kernel sources and found multiple files that are currently using both those structs and ether_addr_copy: (line numbers are those for commit 34fca4b of your staging-testing tree) drivers/net/ethernet/broadcom/genet/bcmgenet.c (line 2957) drivers/net/ethernet/brocade/bna/bnad.c (line 3250) drivers/net/ethernet/emulex/benet/be_main.c (line 315) drivers/net/ethernet/ezchip/nps_enet.c (line 421) drivers/net/ethernet/ibm/ibmveth.c (line 1460) drivers/net/ethernet/intel/fm10k/fm10k_netdev.c (line 911) drivers/net/ethernet/intel/i40e/i40e_main.c (line 1518) drivers/net/ethernet/mellanox/mlx5/core/en_main.c (line 1796) drivers/net/usb/lan78xx.c (line 1777) drivers/staging/rtl8192e/rtl8192e/rtl_core.c (line 2285) drivers/staging/rtl8712/os_intfs.c (line 181) net/8021q/vlan_dev.c (line 338) net/batman-adv/soft-interface.c (line 140) net/dsa/slave.c (line 198) Given that information, it should be fine for that change in rtl8192u! But if I'm mistaken somewhere please tell me! Should I update my patch with those information in the changelog? If so, how verbose do you expect it to be? Thanks! -R -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv4 1/2] staging: wilc1000: remove FREE_WILC_BUFFER()
Oh well. Actually you did it. I answered while pulling the git... Sorry for that unuseful mail! :) 2015-09-05 12:25 GMT-04:00 Raphaël Beamonte : > 2015-09-02 21:19 GMT-04:00 Greg Kroah-Hartman : >> Turns out this file is never even built, you should just remove it :) > > You're right, although it seems that is one of the "To-dos" of that > module, as the references I find about the config variable to allow > the compiling of that file is the following: > > config WILC1000_PREALLOCATE_DURING_SYSTEM_BOOT > bool "Preallocate memory pool during system boot" > ---help--- > To do. > > Found on > https://github.com/linux4sc/wireless-driver/blob/master/wilc1000/Kconfig > However, it seems that entry of the Kconfig has been removed in the > kernel. It thus can probably be safe to remove all occurences linked > to that option from the driver in the kernel, while the authors will > be able to add them back when it will be a working configuration > option. I'll do that! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv4 1/2] staging: wilc1000: remove FREE_WILC_BUFFER()
2015-09-02 21:19 GMT-04:00 Greg Kroah-Hartman : > Turns out this file is never even built, you should just remove it :) You're right, although it seems that is one of the "To-dos" of that module, as the references I find about the config variable to allow the compiling of that file is the following: config WILC1000_PREALLOCATE_DURING_SYSTEM_BOOT bool "Preallocate memory pool during system boot" ---help--- To do. Found on https://github.com/linux4sc/wireless-driver/blob/master/wilc1000/Kconfig However, it seems that entry of the Kconfig has been removed in the kernel. It thus can probably be safe to remove all occurences linked to that option from the driver in the kernel, while the authors will be able to add them back when it will be a working configuration option. I'll do that! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 15/31] tools lib api fs: Add FSTYPE__mount() method
2015-09-04 12:44 GMT-04:00 Arnaldo Carvalho de Melo : > From: Jiri Olsa > > Adding FSTYPE__mount (where FSTYPE is, as of now, one of sysfs, procfs, > debugfs, tracefs) method that tries to mount the filesystem in case no > mount of FSTYPE is found. > > Signed-off-by: Jiri Olsa > Cc: Raphael Beamonte > Cc: David Ahern > Cc: Matt Fleming > Cc: Namhyung Kim > Cc: Peter Zijlstra > Cc: Steven Rostedt > Link: > http://lkml.kernel.org/r/1441180605-24737-12-git-send-email-jo...@kernel.org > Signed-off-by: Arnaldo Carvalho de Melo > --- > tools/lib/api/fs/fs.c | 44 +++- > tools/lib/api/fs/fs.h | 15 +++ > 2 files changed, 50 insertions(+), 9 deletions(-) Same thing here. I think I sent it to a reply of reply, should have sent it directly in reply to the patch. Reviewed-by: Raphael Beamonte > diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c > index ef16d2a83a27..bc93baf33fff 100644 > --- a/tools/lib/api/fs/fs.c > +++ b/tools/lib/api/fs/fs.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > > #include "debugfs.h" > #include "fs.h" > @@ -215,16 +216,49 @@ static const char *fs__mountpoint(int idx) > return fs__get_mountpoint(fs); > } > > -#define FS__MOUNTPOINT(name, idx) \ > +static const char *mount_overload(struct fs *fs) > +{ > + size_t name_len = strlen(fs->name); > + /* "PERF_" + name + "_ENVIRONMENT" + '\0' */ > + char upper_name[5 + name_len + 12 + 1]; > + > + snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name); > + mem_toupper(upper_name, name_len); > + > + return getenv(upper_name) ?: *fs->mounts; > +} > + > +static const char *fs__mount(int idx) > +{ > + struct fs *fs = &fs__entries[idx]; > + const char *mountpoint; > + > + if (fs__mountpoint(idx)) > + return (const char *)fs->path; > + > + mountpoint = mount_overload(fs); > + > + if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0) > + return NULL; > + > + return fs__check_mounts(fs) ? fs->path : NULL; > +} > + > +#define FS(name, idx) \ > const char *name##__mountpoint(void) \ > { \ > return fs__mountpoint(idx); \ > +} \ > + \ > +const char *name##__mount(void)\ > +{ \ > + return fs__mount(idx); \ > } > > -FS__MOUNTPOINT(sysfs, FS__SYSFS); > -FS__MOUNTPOINT(procfs, FS__PROCFS); > -FS__MOUNTPOINT(debugfs, FS__DEBUGFS); > -FS__MOUNTPOINT(tracefs, FS__TRACEFS); > +FS(sysfs, FS__SYSFS); > +FS(procfs, FS__PROCFS); > +FS(debugfs, FS__DEBUGFS); > +FS(tracefs, FS__TRACEFS); > > int filename__read_int(const char *filename, int *value) > { > diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h > index 9013227ae0d1..a9627ea5e6ae 100644 > --- a/tools/lib/api/fs/fs.h > +++ b/tools/lib/api/fs/fs.h > @@ -9,10 +9,17 @@ > #define PATH_MAX 4096 > #endif > > -const char *sysfs__mountpoint(void); > -const char *procfs__mountpoint(void); > -const char *debugfs__mountpoint(void); > -const char *tracefs__mountpoint(void); > +#define FS(name) \ > + const char *name##__mountpoint(void); \ > + const char *name##__mount(void); > + > +FS(sysfs) > +FS(procfs) > +FS(debugfs) > +FS(tracefs) > + > +#undef FS > + > > int filename__read_int(const char *filename, int *value); > int sysctl__read_int(const char *sysctl, int *value); > -- > 2.1.0 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 10/31] tools lib api fs: Move debugfs__strerror_open into tracing_path.c object
2015-09-04 12:44 GMT-04:00 Arnaldo Carvalho de Melo : > From: Jiri Olsa > > Moving debugfs__strerror_open out of api/fs/debugfs.c, because it's not > debugfs specific. It'll be changed to consider tracefs mount as well in > following patches. > > Renaming it into tracing_path__strerror_open_tp to fit into the > namespace. No functional change is intended. > > Signed-off-by: Jiri Olsa > Reviewed-by: Matt Fleming > Cc: Raphael Beamonte > Cc: David Ahern > Cc: Namhyung Kim > Cc: Peter Zijlstra > Cc: Steven Rostedt > Link: > http://lkml.kernel.org/r/1441180605-24737-6-git-send-email-jo...@kernel.org > Signed-off-by: Arnaldo Carvalho de Melo > --- > tools/lib/api/fs/debugfs.c | 52 --- > tools/lib/api/fs/tracing_path.c | 54 > + > tools/lib/api/fs/tracing_path.h | 3 +++ > tools/perf/builtin-trace.c | 5 ++-- > 4 files changed, 60 insertions(+), 54 deletions(-) I perhaps sent it a bit late, but my Reviewed-by can be used here also. Reviewed-by: Raphael Beamonte > diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c > index eb7cf4d18f8a..c707cfb32782 100644 > --- a/tools/lib/api/fs/debugfs.c > +++ b/tools/lib/api/fs/debugfs.c > @@ -75,55 +75,3 @@ char *debugfs_mount(const char *mountpoint) > out: > return debugfs_mountpoint; > } > - > -int debugfs__strerror_open(int err, char *buf, size_t size, const char > *filename) > -{ > - char sbuf[128]; > - > - switch (err) { > - case ENOENT: > - if (debugfs_found) { > - snprintf(buf, size, > -"Error:\tFile %s/%s not found.\n" > -"Hint:\tPerhaps this kernel misses some > CONFIG_ setting to enable this feature?.\n", > -debugfs_mountpoint, filename); > - break; > - } > - snprintf(buf, size, "%s", > -"Error:\tUnable to find debugfs\n" > -"Hint:\tWas your kernel compiled with debugfs > support?\n" > -"Hint:\tIs the debugfs filesystem mounted?\n" > -"Hint:\tTry 'sudo mount -t debugfs nodev > /sys/kernel/debug'"); > - break; > - case EACCES: { > - const char *mountpoint = debugfs_mountpoint; > - > - if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, > "tracing/", 8) == 0) { > - const char *tracefs_mntpoint = > tracefs_find_mountpoint(); > - > - if (tracefs_mntpoint) > - mountpoint = tracefs_mntpoint; > - } > - > - snprintf(buf, size, > -"Error:\tNo permissions to read %s/%s\n" > -"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n", > -debugfs_mountpoint, filename, mountpoint); > - } > - break; > - default: > - snprintf(buf, size, "%s", strerror_r(err, sbuf, > sizeof(sbuf))); > - break; > - } > - > - return 0; > -} > - > -int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char > *sys, const char *name) > -{ > - char path[PATH_MAX]; > - > - snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*"); > - > - return debugfs__strerror_open(err, buf, size, path); > -} > diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c > index 1fd6e1f99234..3b3e4f5fc50b 100644 > --- a/tools/lib/api/fs/tracing_path.c > +++ b/tools/lib/api/fs/tracing_path.c > @@ -5,6 +5,8 @@ > #include > #include > #include > +#include > +#include > #include "debugfs.h" > #include "tracefs.h" > > @@ -81,3 +83,55 @@ void put_tracing_file(char *file) > { > free(file); > } > + > +static int strerror_open(int err, char *buf, size_t size, const char > *filename) > +{ > + char sbuf[128]; > + > + switch (err) { > + case ENOENT: > + if (debugfs_configured()) { > + snprintf(buf, size, > +"Error:\tFile %s/%s not found.\n" > +"Hint:\tPerhaps this kernel misses some > CONFIG_ setting to enable this feature?.\n", > +debugfs_mountpoint, filename); > + break; > + } > + snprintf(buf, size, "%s", > +"Error:\tUnable to find debugfs\n" > +"Hint:\tWas your kernel compiled with debugfs > support?\n" > +"Hint:\tIs the debugfs filesystem mounted?\n" > +"Hint:\tTry 'sudo mount -t debugfs nodev > /sys/kernel/debug'"); > + break; > + case EACCES: { > + const char *mountpoint = debugfs_mountpoint; > + > +
Re: [PATCH 11/15] tools lib api: Add mount support for fs
2015-09-04 11:00 GMT-04:00 Steven Rostedt : > I will also add that the reason the /sys/kernel/debug directory is > created when DEBUGFS is enabled, was specifically so that tools had a > place to automatically mount it when needed. That was the entire > purpose of that directory. Makes sense! It's also true that, as you both mentioned, it makes perf more user friendly. I wasn't sure to what extent that was the purpose though! Thanks for the clarifications! 2015-09-02 3:56 GMT-04:00 Jiri Olsa : > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs) > interface that tries to mount the filesystem in case no mount is found. > > Link: http://lkml.kernel.org/n/tip-ja49vwfiq2qqkmoxx9yk2...@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/lib/api/fs/fs.c | 44 +++- > tools/lib/api/fs/fs.h | 15 +++ > 2 files changed, 50 insertions(+), 9 deletions(-) The patch is fine by me! My Reviewed-by can be added if wanted :o) Reviewed-by: Raphaël Beamonte -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 11/15] tools lib api: Add mount support for fs
2015-09-02 3:56 GMT-04:00 Jiri Olsa : > Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs) > interface that tries to mount the filesystem in case no mount is found. > > Link: http://lkml.kernel.org/n/tip-ja49vwfiq2qqkmoxx9yk2...@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/lib/api/fs/fs.c | 44 +++- > tools/lib/api/fs/fs.h | 15 +++ > 2 files changed, 50 insertions(+), 9 deletions(-) Why automatic mounting the **fs filesystems? Isn't it better to let the user decide when and where to mount it if s/he forgot to do it before? Forcing a mount is also potentially forcing to umount then mount when mounting has been forgotten before. > diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c > index ef16d2a83a27..bc93baf33fff 100644 > --- a/tools/lib/api/fs/fs.c > +++ b/tools/lib/api/fs/fs.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > > #include "debugfs.h" > #include "fs.h" > @@ -215,16 +216,49 @@ static const char *fs__mountpoint(int idx) > return fs__get_mountpoint(fs); > } > > -#define FS__MOUNTPOINT(name, idx) \ > +static const char *mount_overload(struct fs *fs) > +{ > + size_t name_len = strlen(fs->name); > + /* "PERF_" + name + "_ENVIRONMENT" + '\0' */ > + char upper_name[5 + name_len + 12 + 1]; > + > + snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name); > + mem_toupper(upper_name, name_len); > + > + return getenv(upper_name) ?: *fs->mounts; > +} > + > +static const char *fs__mount(int idx) > +{ > + struct fs *fs = &fs__entries[idx]; > + const char *mountpoint; > + > + if (fs__mountpoint(idx)) > + return (const char *)fs->path; > + > + mountpoint = mount_overload(fs); > + > + if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0) > + return NULL; > + > + return fs__check_mounts(fs) ? fs->path : NULL; > +} > + > +#define FS(name, idx) \ > const char *name##__mountpoint(void) \ > { \ > return fs__mountpoint(idx); \ > +} \ > + \ > +const char *name##__mount(void)\ > +{ \ > + return fs__mount(idx); \ > } > > -FS__MOUNTPOINT(sysfs, FS__SYSFS); > -FS__MOUNTPOINT(procfs, FS__PROCFS); > -FS__MOUNTPOINT(debugfs, FS__DEBUGFS); > -FS__MOUNTPOINT(tracefs, FS__TRACEFS); > +FS(sysfs, FS__SYSFS); > +FS(procfs, FS__PROCFS); > +FS(debugfs, FS__DEBUGFS); > +FS(tracefs, FS__TRACEFS); > > int filename__read_int(const char *filename, int *value) > { > diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h > index 9013227ae0d1..a9627ea5e6ae 100644 > --- a/tools/lib/api/fs/fs.h > +++ b/tools/lib/api/fs/fs.h > @@ -9,10 +9,17 @@ > #define PATH_MAX 4096 > #endif > > -const char *sysfs__mountpoint(void); > -const char *procfs__mountpoint(void); > -const char *debugfs__mountpoint(void); > -const char *tracefs__mountpoint(void); > +#define FS(name) \ > + const char *name##__mountpoint(void); \ > + const char *name##__mount(void); > + > +FS(sysfs) > +FS(procfs) > +FS(debugfs) > +FS(tracefs) > + > +#undef FS > + > > int filename__read_int(const char *filename, int *value); > int sysctl__read_int(const char *sysctl, int *value); > -- > 2.4.3 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
2015-09-04 9:48 GMT-04:00 Jiri Olsa : > it's not fs per say, it's 'combination,choice' of debugfs and tracefs > that provides 'path' for tracing ;-) Ok then! Makes sense :) Thanks 2015-09-02 3:56 GMT-04:00 Jiri Olsa : > Moving debugfs__strerror_open out of api/fs/debugfs.c, > because it's not debugfs specific. It'll be changed to > consider tracefs mount as well in following patches. > > Renaming it into tracing_path__strerror_open_tp to fit > into the namespace. No functional change is intended. > > Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m75...@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/lib/api/fs/debugfs.c | 52 --- > tools/lib/api/fs/tracing_path.c | 54 > + > tools/lib/api/fs/tracing_path.h | 3 +++ > tools/perf/builtin-trace.c | 5 ++-- > 4 files changed, 60 insertions(+), 54 deletions(-) Reviewed-by: Raphaël Beamonte -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object
2015-09-02 9:12 GMT-04:00 Arnaldo Carvalho de Melo : > Em Wed, Sep 02, 2015 at 09:56:35AM +0200, Jiri Olsa escreveu: > Humm, here I think that "_path" may look excessive... But tracing_path__ > better > than debugfs__, so its progress, applying, if we get a better name, we > can change this later. > > - Arnaldo I agree that "tracing_path" seems a bit heavy. Why not using tracefs here like for the previous changes? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c
2015-09-04 7:35 GMT-04:00 Matt Fleming : > On Wed, 02 Sep, at 09:56:34AM, Jiri Olsa wrote: >> Moving tracing_path interface into api/fs/tracing_path.c >> out of util.c. It seems generic enough to be used by >> others, and I couldn't think of better place. >> >> Link: http://lkml.kernel.org/n/tip-xqvrud2e3z4uynvnu3iml...@git.kernel.org >> Signed-off-by: Jiri Olsa >> --- >> tools/lib/api/fs/Build | 1 + >> tools/lib/api/fs/tracing_path.c| 83 >> ++ >> tools/lib/api/fs/tracing_path.h| 13 ++ >> tools/perf/perf.c | 2 +- >> tools/perf/util/parse-events.c | 2 +- >> tools/perf/util/trace-event-info.c | 2 +- >> tools/perf/util/trace-event.c | 1 + >> tools/perf/util/util.c | 70 >> tools/perf/util/util.h | 6 --- >> 9 files changed, 101 insertions(+), 79 deletions(-) >> create mode 100644 tools/lib/api/fs/tracing_path.c >> create mode 100644 tools/lib/api/fs/tracing_path.h > > Reviewed-by: Matt Fleming > > -- > Matt Fleming, Intel Open Source Technology Center I can get behind that too. Reviewed-by: Raphaël Beamonte -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv4 2/2] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak
The MALLOC_WILC_BUFFER() macro was using a return statement, and didn't take care of possible memory leaks and subsequent bugs when it was failing after succeeding some allocations. This patch corrects this behavior. Signed-off-by: Raphaël Beamonte --- drivers/staging/wilc1000/wilc_exported_buf.c | 31 +++- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c index 44db496..e617b77 100644 --- a/drivers/staging/wilc1000/wilc_exported_buf.c +++ b/drivers/staging/wilc1000/wilc_exported_buf.c @@ -8,13 +8,6 @@ #define LINUX_TX_SIZE (64 * 1024) #define WILC1000_FW_SIZE (4 * 1024) -#define MALLOC_WILC_BUFFER(name, size) \ - exported_ ## name = kmalloc(size, GFP_KERNEL);\ - if (!exported_ ## name) { \ - printk("fail to alloc: %s memory\n", exported_ ## name); \ - return -ENOBUFS;\ - } - /* * Add necessary buffer pointers */ @@ -46,11 +39,29 @@ static int __init wilc_module_init(void) /* * alloc necessary memory */ - MALLOC_WILC_BUFFER(g_tx_buf, LINUX_TX_SIZE) - MALLOC_WILC_BUFFER(g_rx_buf, LINUX_RX_SIZE) - MALLOC_WILC_BUFFER(g_fw_buf, WILC1000_FW_SIZE) + exported_g_tx_buf = kmalloc(LINUX_TX_SIZE, GFP_KERNEL); + if (!exported_g_tx_buf) + return -ENOMEM; + + exported_g_rx_buf = kmalloc(LINUX_RX_SIZE, GFP_KERNEL); + if (!exported_g_rx_buf) + goto free_g_tx_buf; + + exported_g_fw_buf = kmalloc(WILC1000_FW_SIZE, GFP_KERNEL); + if (!exported_g_fw_buf) + goto free_g_rx_buf; return 0; + +free_g_rx_buf: + kfree(exported_g_rx_buf); + exported_g_rx_buf = NULL; + +free_g_tx_buf: + kfree(exported_g_tx_buf); + exported_g_tx_buf = NULL; + + return -ENOMEM; } static void __exit wilc_module_deinit(void) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv4 1/2] staging: wilc1000: remove FREE_WILC_BUFFER()
It was just a wrapper around kfree(), so call that instead. Signed-off-by: Raphaël Beamonte --- drivers/staging/wilc1000/wilc_exported_buf.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c index c3f6a0a..44db496 100644 --- a/drivers/staging/wilc1000/wilc_exported_buf.c +++ b/drivers/staging/wilc1000/wilc_exported_buf.c @@ -15,9 +15,6 @@ return -ENOBUFS;\ } -#define FREE_WILC_BUFFER(name) \ - kfree(exported_ ## name); - /* * Add necessary buffer pointers */ @@ -59,9 +56,9 @@ static int __init wilc_module_init(void) static void __exit wilc_module_deinit(void) { printk("wilc_module_deinit\n"); - FREE_WILC_BUFFER(g_tx_buf) - FREE_WILC_BUFFER(g_rx_buf) - FREE_WILC_BUFFER(g_fw_buf) + kfree(exported_g_tx_buf); + kfree(exported_g_rx_buf); + kfree(exported_g_fw_buf); } MODULE_LICENSE("Dual BSD/GPL"); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv4 0/2] staging: wilc1000: code improvements
Hi, As requested, here are the two remaining ready patches of this patchset. I pulled and rebased against staging-testing just now. They should thus be usable without problem! Thanks, Raphaël Raphaël Beamonte (2): staging: wilc1000: remove FREE_WILC_BUFFER() staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak drivers/staging/wilc1000/wilc_exported_buf.c | 40 +--- 1 file changed, 24 insertions(+), 16 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] perf: fix confusing messages when not able to read trace events files
2015-08-18 7:43 GMT-04:00 Matt Fleming : >> - perror("Can't open event dir"); >> + debugfs__strerror_open( >> + errno, errbuf, sizeof(errbuf), >> + evt_path + strlen(debugfs_mountpoint) + 1); > > The way the filename is passed seems a bit hacky. What's wrong with > calling debugfs__strerror_open_tp() instead? debugfs__strerror_open_tp is using that call to form the path: snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*"); Where for add_tracepoint_multi_sys we just need the tracing/events part, and for add_tracepoint_multi_event we just need tracing/events/%s. It is thus not adapted for what we need here. Moreover, to get those paths, I have to get the tracing/events part (I didn't want to hardcode it, as the tracing_events_path contains it) and, in the second case only, the sys_name. The problem with the tracing_events variable is that it contains the debugfs mountpoint part (it's an absolute path, not relative, and is thus hardcoded even though the debugfs_mountpoint contains the debugfs mountpoint absolute path). This is why it ends up being the way it is in my patch. I think the tracing_events_path has been made that way to avoid building paths with snprintf each time we needed to access directly the tracing/events dir. I don't know if changing the tracing_events_path variable to a relative path would be acceptable? If so, it would clearly clean up the path in that debugfs__strerror_open call. Thoughts? >> - if (ret) >> + if (ret && errno != EACCES) >> parse_events_print_error(&err, str); >> > > This is not a scalable solution. As more and more errors are handled > at the caller the "if (errno != FOO)" expression will grow to be too > large. There's also another problem in that you can't be sure 'errno' > hasn't been modified by the time you reach this point, since it's a > global variable and available for any code to modify. > > This is taken straight from the errno(3) man page, > > "Its value is significant only when the return value of the call > indicated an error (i.e., -1 from most system calls; -1 or NULL from > most library functions); a function that succeeds is allowed to change > errno." > > Is there some way to pass the error message back up the stack in &err > and not call fprintf() from add_tracepoint_multi_event() etc? The err variable doesn't go down to the add_tracepoint_multi_event() call. It actually stops in parse_events_parse() where parse_events_add_tracepoint is being called using only the idx part of data (util/parse-events.y:389). I think it would be possible to pass the whole data variable (struct parse_events_evlist) down those variables to still have access to &err, but it would imply quite a lot of changes in there. I'm up to it though, if it seems that's the right thing to do! What is your take on >> switch (parse_short_opt(ctx, options)) { >> case -1: >> + /* If the error is an access error, we should >> already have >> + * taken care of it, and the usage information >> will provide >> + * no help to the user. >> + */ >> + if (errno == EACCES) >> + return -1; >> return parse_options_usage(usagestr, options, >> arg, 1); >> case -2: >> goto unknown; > > Same comment applies here about using errno. Maybe what we want is a > new return code to signal "the caller has already printed informative > messages, so just return", if none of the existing values make sense? Would also need code refactoring: parse_short_opt calls get_value that calls parse_events_option, but unfortunately get_value drops the return code of parse_events_option to return only -1 on fail and 0 on success (parse-options.c:142 in the case OPTION_CALLBACK). I think it's mostly to prevent mistakes with the callback function return code and the get_value/parse_short_opt return codes (0, -1, -3 for get_value, -2 or the get_value return code for parse_short_opt). How would you see a good manner of refactoring that? Catch only a specific return code in get_value that could be returned instead of -1 when it is met ? For instance: ret = (*opt->callback)(opt, NULL, 0); if (ret == -4) return ret; return (ret) ? (-1) : 0; Thanks! Raphaël -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv3] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak
2015-08-18 5:15 GMT-04:00 Dan Carpenter : > To be honest, I have lost track of this patchset. If you are planning > to redo the other patches can you send it in a new thread? Actually, Greg already included the "return statement" and "DECLARE_WILC_BUFFER" ones. The replacement of printk by netdev_* needs more work on my side to get the net_device to be able to use the netdev_* functions. And apparently Greg already received another patch with the "FREE_WILC_BUFFER" replacement, though I don't see it in the staging-testing tree yet. So, I think this patch is the last one of this patchset that has to be treated! That's why I rebased it on top of the current staging-testing tree on my last send. Thanks, Raphaël -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 02/19] staging: rtl8192u: r8192U_core: fix space before close parenthesis code style error
A space existed before the close parenthesis of an if statement. This patch removes it to follow the kernel code style. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 915493d..6137a04 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3221,7 +3221,7 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work) //to get busy traffic condition if (ieee->state == IEEE80211_LINKED) { if (ieee->LinkDetectInfo.NumRxOkInPeriod > 666 || - ieee->LinkDetectInfo.NumTxOkInPeriod > 666 ) { + ieee->LinkDetectInfo.NumTxOkInPeriod > 666) { bBusyTraffic = true; } ieee->LinkDetectInfo.NumRxOkInPeriod = 0; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 00/19] staging: rtl8192u: r8192U_core: fix all checkpatch.pl reports
Hi, Here is an update of the patches fixing all the checkpatch warnings and errors for the file drivers/staging/rtl8192u/r8192U_core.c, thanks to Sudop Mukherjee's remarks and advices. As a reminder, here is the checkpatch.pl tailed output before patches: total: 334 errors, 402 warnings, 4909 lines checked And after patches: total: 0 errors, 0 warnings, 5379 lines checked Please let me know if there is anything else I can do to improve these patches! Thanks, Raphaël Raphaël Beamonte (19): staging: rtl8192u: r8192U_core: fix switch and case indent code style error staging: rtl8192u: r8192U_core: fix space before close parenthesis code style error staging: rtl8192u: r8192U_core: fix code indent using spaces code style error staging: rtl8192u: r8192U_core: fix else following close brace code style error staging: rtl8192u: r8192U_core: fix missing struct leading to consistent spacing code style error staging: rtl8192u: r8192U_core: whitespace neatening to fix consistent spacing code style errors staging: rtl8192u: r8192U_core: clean C99 // comments staging: rtl8192u: r8192U_core: include linux/uaccess.h instead of asm/uaccess.h staging: rtl8192u: r8192U_core: remove return statement of void function staging: rtl8192u: r8192U_core: fix unecessary braces code style issue staging: rtl8192u: r8192U_core: remove forward declarations in .c file staging: rtl8192u: r8192U_core: fix unnecessary check before kfree code style issue staging: rtl8192u: r8192U_core: fix unnecessary parentheses code style issue staging: rtl8192u: r8192U_core: fix unnecessary else after return code style issue staging: rtl8192u: r8192U_core: fix unnecessary whitespace code style issue staging: rtl8192u: r8192U_core: fix missing blank line after declarations code style issue staging: rtl8192u: r8192U_core: fix quoted string split across lines code style issue staging: rtl8192u: r8192U_core: fix use ether_addr_copy() over memcpy() code style issue staging: rtl8192u: r8192U_core: fix line over 80 characters code style issue drivers/staging/rtl8192u/r8192U.h |4 +- drivers/staging/rtl8192u/r8192U_core.c | 2262 +++- 2 files changed, 1368 insertions(+), 898 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 07/19] staging: rtl8192u: r8192U_core: clean C99 // comments
Replace C99 // comments by /* comments */ to follow the kernel code style. Remove some unuseful comments. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 636 - 1 file changed, 316 insertions(+), 320 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index e0832d1..9a658b4 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -64,7 +64,7 @@ double __extendsfdf2(float a) #include "r8190_rtl8256.h" /* RTL8225 Radio frontend */ #include "r8180_93cx6.h" /* Card EEPROM */ #include "r8192U_wx.h" -#include "r819xU_phy.h" //added by WB 4.30.2008 +#include "r819xU_phy.h" #include "r819xU_phyreg.h" #include "r819xU_cmdpkt.h" #include "r8192U_dm.h" @@ -72,13 +72,13 @@ double __extendsfdf2(float a) #include #include #include -// FIXME: check if 2.6.7 is ok +/* FIXME: check if 2.6.7 is ok */ #include "dot11d.h" -//set here to open your trace code. //WB +/* set here to open your trace code. */ u32 rt_global_debug_component = COMP_DOWN | COMP_SEC| - COMP_ERR; //always open err flags on + COMP_ERR; /* always open err flags on */ #define TOTAL_CAM_ENTRY 32 #define CAM_CONTENT_COUNT 8 @@ -109,7 +109,7 @@ MODULE_DEVICE_TABLE(usb, rtl8192_usb_id_tbl); MODULE_DESCRIPTION("Linux driver for Realtek RTL8192 USB WiFi cards"); static char *ifname = "wlan%d"; -static int hwwep = 1; //default use hw. set 0 to use software security +static int hwwep = 1; /* default use hw. set 0 to use software security */ static int channels = 0x3fff; @@ -143,17 +143,17 @@ 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 //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. //+YJ, 080626 + {{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. */ }; static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) @@ -173,7 +173,7 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv) case COUNTRY_CODE_MIC: Dot11d_Init(ieee); ieee->bGlobalDomain = false; - //actually 8225 & 8256 rf chips only support B,G,24N mode +
[PATCHv2 05/19] staging: rtl8192u: r8192U_core: fix missing struct leading to consistent spacing code style error
A missing struct keyword in variable declaration triggered a need consistent spacing around '*' code style error. The struct keyword thus has been added everywhere for the rtl8192_rx_info struct, and therefore its typedef removed as not needed anymore. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U.h | 4 ++-- drivers/staging/rtl8192u/r8192U_core.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index 785fd02..a76748e 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -335,11 +335,11 @@ typedef struct _tx_fwinfo_819x_usb { u32 PacketID:13; } tx_fwinfo_819x_usb, *ptx_fwinfo_819x_usb; -typedef struct rtl8192_rx_info { +struct rtl8192_rx_info { struct urb *urb; struct net_device *dev; u8 out_pipe; -} rtl8192_rx_info ; +}; typedef struct rx_desc_819x_usb { /* DOWRD 0 */ diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index bdb8e4f..e786237 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4191,7 +4191,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, rx_drvinfo_819x_usb *pdrvinfo) { // TODO: We must only check packet for current MAC address. Not finish - rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; + struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; struct net_device *dev = info->dev; struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); bool bpacket_match_bssid, bpacket_toself; @@ -4379,7 +4379,7 @@ static void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats, bool bIsRxAggrSubframe) { - rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; + struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; struct net_device *dev = info->dev; struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); rx_drvinfo_819x_usb *driver_info = NULL; @@ -4470,7 +4470,7 @@ static void query_rxdesc_status(struct sk_buff *skb, static void rtl8192_rx_nomal(struct sk_buff *skb) { - rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; + struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; struct net_device *dev = info->dev; struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); struct ieee80211_rx_stats stats = { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 09/19] staging: rtl8192u: r8192U_core: remove return statement of void function
void function return statement was not useful in this case. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 2ab0a98..90c5907 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1481,7 +1481,6 @@ static u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc) static void tx_zero_isr(struct urb *tx_urb) { - return; } /* -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 04/19] staging: rtl8192u: r8192U_core: fix else following close brace code style error
Fix "else should follow close brace" checkpatch error. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 3c20731..bdb8e4f 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2585,8 +2585,7 @@ static void rtl8192_hwconfig(struct net_device *dev) regBwOpMode = BW_OPMODE_20MHZ; regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; - } - else + } else #endif { regBwOpMode = BW_OPMODE_20MHZ; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 14/19] staging: rtl8192u: r8192U_core: fix unnecessary else after return code style issue
An else statement is not useful after a return. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 31 ++- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 88108fb..21173b1 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -988,8 +988,6 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) skb_push(skb, USB_HWDESC_HEADER_LEN); rtl819xU_tx_cmd(dev, skb); ret = 1; - spin_unlock_irqrestore(&priv->tx_lock, flags); - return ret; } else { skb_push(skb, priv->ieee80211->tx_headroom); ret = rtl8192_tx(dev, skb); @@ -1300,12 +1298,11 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) status = usb_submit_urb(tx_urb, GFP_ATOMIC); - if (!status) { + if (!status) return 0; - } else { - DMESGE("Error TX CMD URB, error %d", status); - return -1; - } + + DMESGE("Error TX CMD URB, error %d", status); + return -1; } /* @@ -1644,11 +1641,11 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) dev->trans_start = jiffies; atomic_inc(&priv->tx_pending[tcb_desc->queue_index]); return 0; - } else { - RT_TRACE(COMP_ERR, "Error TX URB %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), -status); - return -1; } + + RT_TRACE(COMP_ERR, "Error TX URB %d, error %d", atomic_read(&priv->tx_pending[tcb_desc->queue_index]), +status); + return -1; } static short rtl8192_usb_initendpoints(struct net_device *dev) @@ -2924,20 +2921,20 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev) (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 && priv->undecorated_smoothed_pwdb >= RateAdaptiveTH_Low_20M))) { if (rx_chk_cnt < 2) return bStuck; - else - rx_chk_cnt = 0; + + rx_chk_cnt = 0; } else if (((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20 && priv->undecorated_smoothed_pwdb < RateAdaptiveTH_Low_40M) || (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 && priv->undecorated_smoothed_pwdb < RateAdaptiveTH_Low_20M)) && priv->undecorated_smoothed_pwdb >= VeryLowRSSI) { if (rx_chk_cnt < 4) return bStuck; - else - rx_chk_cnt = 0; + + rx_chk_cnt = 0; } else { if (rx_chk_cnt < 8) return bStuck; - else - rx_chk_cnt = 0; + + rx_chk_cnt = 0; } if (priv->RxCounter == RegRxCounter) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 11/19] staging: rtl8192u: r8192U_core: remove forward declarations in .c file
Checkpatch was giving a "externs should be avoided in .c files" because of these forward declarations. As these were not useful in this case, they have been removed. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 4425335..cd14c0a 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1000,9 +1000,6 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) return ret; } - -void rtl8192_try_wake_queue(struct net_device *dev, int pri); - static void rtl8192_tx_isr(struct urb *tx_urb) { struct sk_buff *skb = (struct sk_buff *)tx_urb->context; @@ -1223,9 +1220,6 @@ inline u8 rtl8192_IsWirelessBMode(u16 rate) return 0; } -u16 N_DBPSOfRate(u16 DataRate); - - u16 N_DBPSOfRate(u16 DataRate) { u16 N_DBPS = 24; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 15/19] staging: rtl8192u: r8192U_core: fix unnecessary whitespace code style issue
Whitespaces are not necessary before a quoted newline. Remove those. 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 21173b1..b471b33 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1350,7 +1350,7 @@ static u8 MapHwQueueToFirmwareQueue(u8 QueueID) break; default: - RT_TRACE(COMP_ERR, "TransmitTCB(): Impossible Queue Selection: %d \n", QueueID); + RT_TRACE(COMP_ERR, "TransmitTCB(): Impossible Queue Selection: %d\n", QueueID); break; } return QueueSelect; @@ -1880,7 +1880,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, if ((network->qos_data.active == 1) && (active_network == 1)) { queue_work(priv->priv_wq, &priv->qos_activate); - RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate \n"); + RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate\n"); } network->qos_data.active = 0; network->qos_data.supported = 0; @@ -2895,7 +2895,7 @@ static RESET_TYPE TxCheckStuck(struct net_device *dev) } if (bCheckFwTxCnt) { if (HalTxCheckStuck819xUsb(dev)) { - RT_TRACE(COMP_RESET, "TxCheckStuck(): Fw indicates no Tx condition! \n"); + RT_TRACE(COMP_RESET, "TxCheckStuck(): Fw indicates no Tx condition!\n"); return RESET_TYPE_SILENT; } } @@ -3032,7 +3032,7 @@ static void CamRestoreAllEntry(struct net_device *dev) static u8 CAM_CONST_BROAD[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - RT_TRACE(COMP_SEC, "CamRestoreAllEntry: \n"); + RT_TRACE(COMP_SEC, "CamRestoreAllEntry:\n"); if ((priv->ieee80211->pairwise_key_type == KEY_TYPE_WEP40) || @@ -3107,7 +3107,7 @@ static void rtl819x_ifsilentreset(struct net_device *dev) if (priv->ResetProgress == RESET_TYPE_NORESET) { RESET_START: - RT_TRACE(COMP_RESET, "=>Reset progress!! \n"); + RT_TRACE(COMP_RESET, "=>Reset progress!!\n"); /* Set the variable for reset. */ priv->ResetProgress = RESET_TYPE_SILENT; @@ -3783,7 +3783,7 @@ static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer, ((priv->stats.rx_rssi_percentage[rfpath] * (Rx_Smooth_Factor - 1)) + (pprevious_stats->RxMIMOSignalStrength[rfpath])) / (Rx_Smooth_Factor); } - RT_TRACE(COMP_DBG, "priv->stats.rx_rssi_percentage[rfPath] = %d \n", priv->stats.rx_rssi_percentage[rfpath]); + RT_TRACE(COMP_DBG, "priv->stats.rx_rssi_percentage[rfPath] = %d\n", priv->stats.rx_rssi_percentage[rfpath]); } } -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 10/19] staging: rtl8192u: r8192U_core: fix unecessary braces code style issue
braces {} are not necessary for any arm of a statement containing one statement on each side. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 90c5907..4425335 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2304,11 +2304,10 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) wEPROM_ID = eprom_read(dev, 0); /* first read EEPROM ID out; */ RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID); - if (wEPROM_ID != RTL8190_EEPROM_ID) { + if (wEPROM_ID != RTL8190_EEPROM_ID) RT_TRACE(COMP_ERR, "EEPROM ID is invalid(is 0x%x(should be 0x%x)\n", wEPROM_ID, RTL8190_EEPROM_ID); - } else { + else bLoad_From_EEPOM = true; - } if (bLoad_From_EEPOM) { tmpValue = eprom_read(dev, EEPROM_VID >> 1); @@ -2496,11 +2495,10 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) } - if (priv->rf_type == RF_1T2R) { + if (priv->rf_type == RF_1T2R) RT_TRACE(COMP_EPROM, "\n1T2R config\n"); - } else { + else RT_TRACE(COMP_EPROM, "\n2T4R config\n"); - } /* We can only know RF type in the function. So we have to init * DIG RATR table again. -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 12/19] staging: rtl8192u: r8192U_core: fix unnecessary check before kfree code style issue
kfree(NULL) is safe and the checks were not required. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index cd14c0a..d0020f1 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1724,10 +1724,9 @@ static void rtl8192_usb_deleteendpoints(struct net_device *dev) } kfree(priv->oldaddr); priv->oldaddr = NULL; - if (priv->pp_rxskb) { - kfree(priv->pp_rxskb); - priv->pp_rxskb = NULL; - } + + kfree(priv->pp_rxskb); + priv->pp_rxskb = NULL; } #else void rtl8192_usb_deleteendpoints(struct net_device *dev) @@ -1752,11 +1751,9 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev) priv->rx_urb = NULL; kfree(priv->oldaddr); priv->oldaddr = NULL; - if (priv->pp_rxskb) { - kfree(priv->pp_rxskb); - priv->pp_rxskb = 0; - } + kfree(priv->pp_rxskb); + priv->pp_rxskb = 0; #endif } -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 06/19] staging: rtl8192u: r8192U_core: whitespace neatening to fix consistent spacing code style errors
Clean-up the file by using a cleaner spacing around symbols and words. Mostly use the automatic checkpatch whitespacing fixes. This takes care of the consistent spacing errors reported by checkpatch. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 288 - 1 file changed, 144 insertions(+), 144 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index e786237..e0832d1 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -37,17 +37,17 @@ unsigned int __fixunsdfsi(double d) double __adddf3(double a, double b) { - return a+b; + return a + b; } double __addsf3(float a, float b) { - return a+b; + return a + b; } double __subdf3(double a, double b) { - return a-b; + return a - b; } double __extendsfdf2(float a) @@ -114,9 +114,9 @@ static int channels = 0x3fff; -module_param(ifname, charp, S_IRUGO|S_IWUSR); -module_param(hwwep, int, S_IRUGO|S_IWUSR); -module_param(channels, int, S_IRUGO|S_IWUSR); +module_param(ifname, charp, S_IRUGO | S_IWUSR); +module_param(hwwep, int, S_IRUGO | S_IWUSR); +module_param(channels, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(ifname, " Net interface name, wlan%d=default"); MODULE_PARM_DESC(hwwep, " Try to use hardware security support. "); @@ -212,7 +212,7 @@ static void CamResetAllEntry(struct net_device *dev) //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. - ulcommand |= BIT31|BIT30; + ulcommand |= BIT31 | BIT30; write_nic_dword(dev, RWCAM, ulcommand); } @@ -221,14 +221,14 @@ static void CamResetAllEntry(struct net_device *dev) void write_cam(struct net_device *dev, u8 addr, u32 data) { write_nic_dword(dev, WCAMI, data); - write_nic_dword(dev, RWCAM, BIT31|BIT16|(addr&0xff)); + write_nic_dword(dev, RWCAM, BIT31 | BIT16 | (addr & 0xff)); } u32 read_cam(struct net_device *dev, u8 addr) { u32 data; - write_nic_dword(dev, RWCAM, 0x8000|(addr&0xff)); + write_nic_dword(dev, RWCAM, 0x8000 | (addr & 0xff)); read_nic_dword(dev, 0xa8, &data); return data; } @@ -241,7 +241,7 @@ void write_nic_byte_E(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|0xfe00, 0, &data, 1, HZ / 2); +indx | 0xfe00, 0, &data, 1, HZ / 2); if (status < 0) netdev_err(dev, "write_nic_byte_E TimeOut! status: %d\n", status); @@ -255,7 +255,7 @@ int read_nic_byte_E(struct net_device *dev, int indx, u8 *data) status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, -indx|0xfe00, 0, data, 1, HZ / 2); +indx | 0xfe00, 0, data, 1, HZ / 2); if (status < 0) { netdev_err(dev, "%s failure status: %d\n", __func__, status); @@ -274,7 +274,7 @@ 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); @@ -293,7 +293,7 @@ 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, &data, 2, HZ / 2); if (status < 0) netdev_err(dev, "write_nic_word TimeOut! status: %d\n", status); @@ -311,7 +311,7 @@ void write_nic_dword(struct net_device *dev, int indx, u32 data) status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -(indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 4, HZ / 2); +
[PATCHv2 13/19] staging: rtl8192u: r8192U_core: fix unnecessary parentheses code style issue
Two sets of parentheses were used to contain the same statement. In those cases, one of them has been removed, as unnecessary. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index d0020f1..88108fb 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1859,7 +1859,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, if (priv->ieee80211->state != IEEE80211_LINKED) return ret; - if ((priv->ieee80211->iw_mode != IW_MODE_INFRA)) + if (priv->ieee80211->iw_mode != IW_MODE_INFRA) return ret; if (network->flags & NETWORK_HAS_QOS_MASK) { @@ -1923,7 +1923,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, if (priv->ieee80211->state != IEEE80211_LINKED) return 0; - if ((priv->ieee80211->iw_mode != IW_MODE_INFRA)) + if (priv->ieee80211->iw_mode != IW_MODE_INFRA) return 0; spin_lock_irqsave(&priv->ieee80211->lock, flags); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 16/19] staging: rtl8192u: r8192U_core: fix missing blank line after declarations code style issue
Adds whitespaces to separate the variables declarations and the function content. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 44 +++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index b471b33..88b11e8 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -160,6 +160,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; + switch (channel_plan) { case COUNTRY_CODE_FCC: case COUNTRY_CODE_IC: @@ -428,6 +429,7 @@ static int proc_get_stats_ap(struct seq_file *m, void *v) list_for_each_entry(target, &ieee->network_list, list) { const char *wpa = "non_WPA"; + if (target->wpa_ie_len > 0 || target->rsn_ie_len > 0) wpa = "WPA"; @@ -674,6 +676,7 @@ void rtl8192_update_msr(struct net_device *dev) void rtl8192_set_chan(struct net_device *dev, short ch) { struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); + RT_TRACE(COMP_CH, "=>%s()ch:%d\n", __func__, ch); priv->chan = ch; @@ -879,8 +882,10 @@ static void rtl8192_rx_isr(struct urb *urb) struct r8192_priv *priv = ieee80211_priv(dev); int out_pipe = info->out_pipe; int err; + if (!priv->up) return; + if (unlikely(urb->status)) { info->urb = NULL; priv->stats.rxstaterr++; @@ -1058,6 +1063,7 @@ static void rtl8192_config_rate(struct net_device *dev, u16 *rate_config) struct r8192_priv *priv = ieee80211_priv(dev); struct ieee80211_network *net; u8 i = 0, basic_rate = 0; + net = &priv->ieee80211->current_network; for (i = 0; i < net->rates_len; i++) { @@ -1153,6 +1159,7 @@ static void rtl8192_update_cap(struct net_device *dev, u16 cap) u32 tmp = 0; struct r8192_priv *priv = ieee80211_priv(dev); struct ieee80211_network *net = &priv->ieee80211->current_network; + priv->short_preamble = cap & WLAN_CAPABILITY_SHORT_PREAMBLE; tmp = priv->basic_rate; if (priv->short_preamble) @@ -1161,6 +1168,7 @@ static void rtl8192_update_cap(struct net_device *dev, u16 cap) if (net->mode & (IEEE_G | IEEE_N_24G)) { u8 slot_time = 0; + if ((cap & WLAN_CAPABILITY_SHORT_SLOT) && (!priv->ieee80211->pHTInfo->bCurrentRT2RTLongSlotTime)) /* short slot time */ slot_time = SHORT_SLOT_TIME; else /* long slot time */ @@ -1177,6 +1185,7 @@ static void rtl8192_net_update(struct net_device *dev) struct ieee80211_network *net; u16 BcnTimeCfg = 0, BcnCW = 6, BcnIFS = 0xf; u16 rate_config = 0; + net = &priv->ieee80211->current_network; rtl8192_config_rate(dev, &rate_config); @@ -1490,6 +1499,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) int status; struct urb *tx_urb = NULL, *tx_urb_zero = NULL; unsigned int idx_pipe; + pend = atomic_read(&priv->tx_pending[tcb_desc->queue_index]); /* we are locked here so the two atomic_read and inc are executed * without interleaves @@ -1616,6 +1626,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) */ bool bSend0Byte = false; u8 zero = 0; + if (udev->speed == USB_SPEED_HIGH) { if (skb->len > 0 && skb->len % 512 == 0) bSend0Byte = true; @@ -1761,6 +1772,7 @@ static void rtl8192_link_change(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); struct ieee80211_device *ieee = priv->ieee80211; + if (ieee->state == IEEE80211_LINKED) { rtl8192_net_update(dev); rtl8192_update_ratr_table(dev); @@ -1774,6 +1786,7 @@ static void rtl8192_link_change(struct net_device *dev) /*update timing params*/ if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC) { u32 reg = 0; + read_nic_dword(dev, RCR, ®); if (priv->ieee80211->state == IEEE80211_LINKED) priv->ReceiveConfig = reg |= RCR_CBSSID; @@ -1959,6 +1972,7 @@ static int rtl8192_handle_assoc_response(struct net_device *dev, struct ieee80211_network *network) { struct r8192_priv *priv = ieee80211_priv(dev); +
[PATCHv2 19/19] staging: rtl8192u: r8192U_core: fix line over 80 characters code style issue
Light code refactoring to keep the lines under 80 characters to follow the kernel code style. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 1248 ++-- 1 file changed, 850 insertions(+), 398 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index b143b36..c103990 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -143,22 +143,61 @@ 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) { - int i, max_chan = -1, min_chan = -1; + int i, max_chan = -1, min_chan = -1, chan = -1; struct ieee80211_device *ieee = priv->ieee80211; switch (channel_plan) { @@ -179,22 +218,29 @@ 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++) {
[PATCHv2 18/19] staging: rtl8192u: r8192U_core: fix use ether_addr_copy() over memcpy() code style issue
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 76255cb..b143b36 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3469,7 +3469,7 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac) down(&priv->wx_sem); - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); + ether_addr_copy(dev->dev_addr, addr->sa_data); schedule_work(&priv->reset_wq); up(&priv->wx_sem); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 08/19] staging: rtl8192u: r8192U_core: include linux/uaccess.h instead of asm/uaccess.h
Use #include instead of Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 9a658b4..2ab0a98 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -58,7 +58,7 @@ double __extendsfdf2(float a) #define CONFIG_RTL8192_IO_MAP -#include +#include #include "r8192U_hw.h" #include "r8192U.h" #include "r8190_rtl8256.h" /* RTL8225 Radio frontend */ -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 17/19] staging: rtl8192u: r8192U_core: fix quoted string split across lines code style issue
Quoted strings should not be split to help text grep in the source. All quoted strings that were split have thus been merged to one unique quoted string each to follow the code style. 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 88b11e8..76255cb 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -611,8 +611,8 @@ static void rtl8192_proc_init_one(struct net_device *dev) for (f = rtl8192_proc_files; f->name[0]; f++) { if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir, &rtl8192_proc_fops, f->show)) { - RT_TRACE(COMP_ERR, "Unable to initialize " -"/proc/net/rtl8192/%s/%s\n", + RT_TRACE(COMP_ERR, +"Unable to initialize /proc/net/rtl8192/%s/%s\n", dev->name, f->name); return; } @@ -1884,8 +1884,8 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, network->qos_data.old_param_count = network->qos_data.param_count; queue_work(priv->priv_wq, &priv->qos_activate); - RT_TRACE(COMP_QOS, "QoS parameters change call " -"qos_activate\n"); + RT_TRACE(COMP_QOS, +"QoS parameters change call qos_activate\n"); } } else { memcpy(&priv->ieee80211->current_network.qos_data.parameters, -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 03/19] staging: rtl8192u: r8192U_core: fix code indent using spaces code style error
Fix "code indent should use tabs where possible" checkpatch error Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 6137a04..3c20731 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1542,7 +1542,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) 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); + (tcb_desc->bRTSUseShortGI ? 1 : 0); /* Set Bandwidth and sub-channel settings. */ if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20_40) { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 01/19] staging: rtl8192u: r8192U_core: fix switch and case indent code style error
Some switch and case were not be at the same indent level. Signed-off-by: Raphaël Beamonte --- drivers/staging/rtl8192u/r8192U_core.c | 190 - 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 6f6fe38..915493d 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3536,107 +3536,107 @@ static u8 HwRateToMRate90(bool bIsHT, u8 rate) if (!bIsHT) { switch (rate) { - case DESC90_RATE1M: - ret_rate = MGN_1M; - break; - case DESC90_RATE2M: - ret_rate = MGN_2M; - break; - case DESC90_RATE5_5M: - ret_rate = MGN_5_5M; - break; - case DESC90_RATE11M: - ret_rate = MGN_11M; - break; - case DESC90_RATE6M: - ret_rate = MGN_6M; - break; - case DESC90_RATE9M: - ret_rate = MGN_9M; - break; - case DESC90_RATE12M: - ret_rate = MGN_12M; - break; - case DESC90_RATE18M: - ret_rate = MGN_18M; - break; - case DESC90_RATE24M: - ret_rate = MGN_24M; - break; - case DESC90_RATE36M: - ret_rate = MGN_36M; - break; - case DESC90_RATE48M: - ret_rate = MGN_48M; - break; - case DESC90_RATE54M: - ret_rate = MGN_54M; - break; + case DESC90_RATE1M: + ret_rate = MGN_1M; + break; + case DESC90_RATE2M: + ret_rate = MGN_2M; + break; + case DESC90_RATE5_5M: + ret_rate = MGN_5_5M; + break; + case DESC90_RATE11M: + ret_rate = MGN_11M; + break; + case DESC90_RATE6M: + ret_rate = MGN_6M; + break; + case DESC90_RATE9M: + ret_rate = MGN_9M; + break; + case DESC90_RATE12M: + ret_rate = MGN_12M; + break; + case DESC90_RATE18M: + ret_rate = MGN_18M; + break; + case DESC90_RATE24M: + ret_rate = MGN_24M; + break; + case DESC90_RATE36M: + ret_rate = MGN_36M; + break; + case DESC90_RATE48M: + ret_rate = MGN_48M; + break; + case DESC90_RATE54M: + ret_rate = MGN_54M; + break; - default: - ret_rate = 0xff; - RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported Rate [%x], bIsHT = %d!!!\n", rate, bIsHT); - break; + default: + ret_rate = 0xff; + RT_TRACE(COMP_RECV, "HwRateToMRate90(): Non supported Rate [%x], bIsHT = %d!!!\n", rate, bIsHT); + break; } } else { switch (rate) { - case DESC90_RATEMCS0: - ret_rate = MGN_MCS0; - break; - case DESC90_RATEMCS1: - ret_rate = MGN_MCS1; - break; - case DESC90_RATEMCS2: - ret_rate = MGN_MCS2; - break; - case DESC90_RATEMCS3: - ret_rate = MGN_MCS3; - break; - case DESC90_RATEMCS4: - ret_rate = MGN_MCS4; - break; - case DESC90_RATEMCS5: - ret_rate = MGN_MCS5; - break; - case DESC90_RATEMCS6: -
Re: [PATCH 02/20] staging: rtl8192u: r8192U_core: fix consistent spacing code style error
2015-08-18 1:44 GMT-04:00 Sudip Mukherjee : > I think that will be better, since you are sending the patch for > consistent spacing. Actually, going through the bunch of patches, it seems that the whitespace neatening one is taking care of that. That one patch was mostly about taking care of the checkpatch "consistent spacing" warning. Two solutions here: (1) I can merge both patches and make a general whitespace neatening one, taking care of that too. (2) I can clarify the commit messages of each patches to explain the aim of each. Of course, in (1) too I'd take care of explaining the whole point of the commit. What do you think would be the best approach at this point? > And some of your patches are not having any commit message. Greg will > not accept such patches. So while you are sending take care of that > also. Ok! Thanks again! Raphaël -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 12/20] staging: rtl8192u: r8192U_core: fix externs in .c file code style issue
2015-08-18 1:30 GMT-04:00 Sudip Mukherjee : > These are not externs. These are forward declarations. I copied the message from checkpatch. Will edit that to make it more accurate! Thanks, Raphaël -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 02/20] staging: rtl8192u: r8192U_core: fix consistent spacing code style error
2015-08-18 1:02 GMT-04:00 Sudip Mukherjee : > since you are modifying these lines for consistent spacing, it will be > better to have: > (priv->ShortRetryLimit << TCR_SRL_OFFSET) | // Short retry limit > This should be: > priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID>>1)) >> 8; Are you talking about spacing around the << and >> ? If so, shouldn't that last line be: priv->eeprom_CustomerID = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8; And should I thus apply that to the whole file? Thanks! Raphaël -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv3] staging: wilc1000: use netdev_* instead of printk
2015-08-18 0:24 GMT-04:00 Sudip Mukherjee : >> + netdev_err("[Sendconfigpkt]Get Timed out\n"); > This will not compile. you can not just replace printk with > netdev_*, you need to mention a net_device. You're right! I'm making a lot of mistakes. It seems I called the make command in the wrong git tree... Thanks for catching that, and taking time to review! I just saw there isn't any netdev_debug available. Do you know the reason for that? Is there a replacement besides pr_debug? Also, it seems that in all the functions where it's another netdev that's available that I could use, I don't have access to the net_device struct. Is there a general way to get that device information? I saw an old lkml post talking about dev_*() functions to do that? Would you have some hint on the matter? Thanks a lot! Raphaël -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCHv2 5/5] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak
2015-08-17 15:41 GMT-04:00 Arend van Spriel : > Probable MACRO_WILC_BUFFER should be MALLOC_WILC_BUFFER here. Good catch! > There is really no need to print an error message here. kmalloc will blurb > enough info when it fails. Ok! > So these buffers are globals? So does this driver support multiple devices, > ie. how are these used when two wilc1000 supported devices are present. Not sure. I mostly did code refactoring to have a clearer source code and try to respect the kernel code style. I don't have a compatible device to try and test it unfortunately. Thanks for the feedback. I just sent a revised version of the patch taking your comments into account. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv3] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak
The MALLOC_WILC_BUFFER() macro was using a return statement, and didn't take care of possible memory leaks and subsequent bugs when it was failing after succeeding some allocations. This patch corrects this behavior. Signed-off-by: Raphaël Beamonte --- drivers/staging/wilc1000/wilc_exported_buf.c | 31 +++- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c index c3f6a0a..ec8d8e5 100644 --- a/drivers/staging/wilc1000/wilc_exported_buf.c +++ b/drivers/staging/wilc1000/wilc_exported_buf.c @@ -8,13 +8,6 @@ #define LINUX_TX_SIZE (64 * 1024) #define WILC1000_FW_SIZE (4 * 1024) -#define MALLOC_WILC_BUFFER(name, size) \ - exported_ ## name = kmalloc(size, GFP_KERNEL);\ - if (!exported_ ## name) { \ - printk("fail to alloc: %s memory\n", exported_ ## name); \ - return -ENOBUFS;\ - } - #define FREE_WILC_BUFFER(name) \ kfree(exported_ ## name); @@ -49,11 +42,29 @@ static int __init wilc_module_init(void) /* * alloc necessary memory */ - MALLOC_WILC_BUFFER(g_tx_buf, LINUX_TX_SIZE) - MALLOC_WILC_BUFFER(g_rx_buf, LINUX_RX_SIZE) - MALLOC_WILC_BUFFER(g_fw_buf, WILC1000_FW_SIZE) + exported_g_tx_buf = kmalloc(LINUX_TX_SIZE, GFP_KERNEL); + if (!exported_g_tx_buf) + return -ENOMEM; + + exported_g_rx_buf = kmalloc(LINUX_RX_SIZE, GFP_KERNEL); + if (!exported_g_rx_buf) + goto free_g_tx_buf; + + exported_g_fw_buf = kmalloc(WILC1000_FW_SIZE, GFP_KERNEL); + if (!exported_g_fw_buf) + goto free_g_rx_buf; return 0; + +free_g_rx_buf: + kfree(exported_g_rx_buf); + exported_g_rx_buf = NULL; + +free_g_tx_buf: + kfree(exported_g_tx_buf); + exported_g_tx_buf = NULL; + + return -ENOMEM; } static void __exit wilc_module_deinit(void) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv3] staging: wilc1000: use netdev_* instead of printk
Signed-off-by: Raphaël Beamonte --- drivers/staging/wilc1000/coreconfigurator.c | 4 ++-- drivers/staging/wilc1000/linux_wlan.c| 8 drivers/staging/wilc1000/linux_wlan_common.h | 28 ++-- drivers/staging/wilc1000/linux_wlan_sdio.c | 2 +- drivers/staging/wilc1000/linux_wlan_spi.c| 2 +- drivers/staging/wilc1000/wilc_debugfs.c | 16 drivers/staging/wilc1000/wilc_exported_buf.c | 2 -- 7 files changed, 30 insertions(+), 32 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 16a0abc..9a36b78 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -2001,7 +2001,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, pstrWIDs[counter].u16WIDid, (counter == u32WIDsCount - 1), drvHandler)) { ret = -1; - printk("[Sendconfigpkt]Get Timed out\n"); + netdev_err("[Sendconfigpkt]Get Timed out\n"); break; } } @@ -2023,7 +2023,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, pstrWIDs[counter].s32ValueSize, (counter == u32WIDsCount - 1), drvHandler)) { ret = -1; - printk("[Sendconfigpkt]Set Timed out\n"); + netdev_err("[Sendconfigpkt]Set Timed out\n"); break; } } diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index b3cc9f5..7903572 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1306,7 +1306,7 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic) if (g_linux_wlan->wilc1000_initialized) { - printk("Deinitializing wilc1000 ...\n"); + netdev_debug("Deinitializing wilc1000 ...\n"); if (nic == NULL) { PRINT_ER("nic is NULL\n"); @@ -2565,8 +2565,8 @@ static int __init init_wilc_driver(void) } #endif - printk("IN INIT FUNCTION\n"); - printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n"); + netdev_debug("IN INIT FUNCTION\n"); + netdev_info("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n"); linux_wlan_device_power(1); msleep(100); @@ -2662,7 +2662,7 @@ static void __exit exit_wilc_driver(void) kfree(g_linux_wlan); g_linux_wlan = NULL; } - printk("Module_exit Done.\n"); + netdev_debug("Module_exit Done.\n"); #if defined(WILC_DEBUGFS) wilc_debugfs_remove(); diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h index e6ebf3e..7f53d8c 100644 --- a/drivers/staging/wilc1000/linux_wlan_common.h +++ b/drivers/staging/wilc1000/linux_wlan_common.h @@ -63,8 +63,8 @@ extern atomic_t DEBUG_LEVEL; do {\ if ((atomic_read(&DEBUG_LEVEL) & INFO) && \ ((atomic_read(®ION)) & (region))) { \ - printk("INFO [%s]", __func__); \ - printk(__VA_ARGS__);\ + netdev_info("INFO [%s]", __func__); \ + netdev_info(__VA_ARGS__); \ } \ } while (0) @@ -72,16 +72,16 @@ extern atomic_t DEBUG_LEVEL; do {\ if ((atomic_read(&DEBUG_LEVEL) & WRN) &&\ ((atomic_read(®ION)) & (region))) { \ - printk("WRN [%s: %d]", __func__, __LINE__); \ - printk(__VA_ARGS__);\ + netdev_warning("WRN [%s: %d]", __func__, __LINE__); \ + netdev_warning(__VA_ARGS__); \ } \ } while (0) #define PRINT_ER(...) \
[PATCHv2 3/5] staging: wilc1000: remove DECLARE_WILC_BUFFER()
It was just a wrapper to initialize a variable. Initialize it directly instead. Signed-off-by: Raphaël Beamonte --- drivers/staging/wilc1000/wilc_exported_buf.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c index 55b6232..148d608 100644 --- a/drivers/staging/wilc1000/wilc_exported_buf.c +++ b/drivers/staging/wilc1000/wilc_exported_buf.c @@ -8,9 +8,6 @@ #define LINUX_TX_SIZE (64 * 1024) #define WILC1000_FW_SIZE (4 * 1024) -#define DECLARE_WILC_BUFFER(name) \ - void *exported_ ## name = NULL; - #define MALLOC_WILC_BUFFER(name, size) \ exported_ ## name = kmalloc(size, GFP_KERNEL);\ if (!exported_ ## name) { \ @@ -24,9 +21,9 @@ /* * Add necessary buffer pointers */ -DECLARE_WILC_BUFFER(g_tx_buf) -DECLARE_WILC_BUFFER(g_rx_buf) -DECLARE_WILC_BUFFER(g_fw_buf) +void *exported_g_tx_buf; +void *exported_g_rx_buf; +void *exported_g_fw_buf; void *get_tx_buffer(void) { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 5/5] staging: wilc1000: replace MALLOC_WILC_BUFFER() macro to avoid possible memory leak
The MACRO_WILC_BUFFER() macro was using a return statement, and didn't take care of possible memory leaks and subsequent bugs when it was failing after succeeding some allocations. This patch corrects this behavior. Signed-off-by: Raphaël Beamonte --- drivers/staging/wilc1000/wilc_exported_buf.c | 37 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c index c9a5943..0f3bdad 100644 --- a/drivers/staging/wilc1000/wilc_exported_buf.c +++ b/drivers/staging/wilc1000/wilc_exported_buf.c @@ -8,13 +8,6 @@ #define LINUX_TX_SIZE (64 * 1024) #define WILC1000_FW_SIZE (4 * 1024) -#define MALLOC_WILC_BUFFER(name, size) \ - exported_ ## name = kmalloc(size, GFP_KERNEL);\ - if (!exported_ ## name) { \ - printk("fail to alloc: %s memory\n", exported_ ## name); \ - return -ENOBUFS;\ - } - /* * Add necessary buffer pointers */ @@ -45,11 +38,35 @@ static int __init wilc_module_init(void) /* * alloc necessary memory */ - MALLOC_WILC_BUFFER(g_tx_buf, LINUX_TX_SIZE) - MALLOC_WILC_BUFFER(g_rx_buf, LINUX_RX_SIZE) - MALLOC_WILC_BUFFER(g_fw_buf, WILC1000_FW_SIZE) + exported_g_tx_buf = kmalloc(LINUX_TX_SIZE, GFP_KERNEL); + if (!exported_g_tx_buf) { + pr_err("fail to alloc tx buf"); + return -ENOMEM; + } + + exported_g_rx_buf = kmalloc(LINUX_RX_SIZE, GFP_KERNEL); + if (!exported_g_rx_buf) { + pr_err("fail to alloc rx buf"); + goto free_g_tx_buf; + } + + exported_g_fw_buf = kmalloc(WILC1000_FW_SIZE, GFP_KERNEL); + if (!exported_g_fw_buf) { + pr_err("fail to alloc fw buf"); + goto free_g_rx_buf; + } return 0; + +free_g_rx_buf: + kfree(exported_g_rx_buf); + exported_g_rx_buf = NULL; + +free_g_tx_buf: + kfree(exported_g_tx_buf); + exported_g_tx_buf = NULL; + + return -ENOMEM; } static void __exit wilc_module_deinit(void) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 1/5] staging: wilc1000: remove void function return statements that are not useful
Signed-off-by: Raphaël Beamonte --- drivers/staging/wilc1000/host_interface.c| 4 drivers/staging/wilc1000/linux_wlan.c| 1 - drivers/staging/wilc1000/wilc_exported_buf.c | 4 +--- drivers/staging/wilc1000/wilc_wlan.c | 3 --- drivers/staging/wilc1000/wilc_wlan_cfg.c | 2 -- 5 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c473877..0cfc97d 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -6782,9 +6782,6 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error); - - - return; } /** @@ -6848,7 +6845,6 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) /*BugID_5348*/ up(&hSemHostIntDeinit); - return; } /** diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 7eacc2f..e6e8a20 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1385,7 +1385,6 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic) } else { PRINT_D(INIT_DBG, "wilc1000 is not initialized\n"); } - return; } int wlan_init_locks(linux_wlan_t *p_nic) diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c index 5294578..deba6bd 100644 --- a/drivers/staging/wilc1000/wilc_exported_buf.c +++ b/drivers/staging/wilc1000/wilc_exported_buf.c @@ -65,12 +65,10 @@ static void __exit wilc_module_deinit(void) FREE_WILC_BUFFER(g_tx_buf) FREE_WILC_BUFFER(g_rx_buf) FREE_WILC_BUFFER(g_fw_buf) - - return; } MODULE_LICENSE("Dual BSD/GPL"); MODULE_AUTHOR("Tony Cho"); MODULE_DESCRIPTION("WILC1xxx Memory Manager"); pure_initcall(wilc_module_init); -module_exit(wilc_module_deinit); \ No newline at end of file +module_exit(wilc_module_deinit); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index fac16db..7c53a2b 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -124,8 +124,6 @@ static void wilc_debug(uint32_t flag, char *fmt, ...) if (g_wlan.os_func.os_debug) g_wlan.os_func.os_debug(buf); } - - return; } static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP; @@ -1325,7 +1323,6 @@ static void wilc_wlan_handle_rxq(void) p->rxq_exit = 1; PRINT_D(RX_DBG, "THREAD: Exiting RX thread\n"); - return; } / diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index c10dffe..e2842d3 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -363,8 +363,6 @@ static void wilc_wlan_parse_response_frame(uint8_t *info, int size) size -= (2 + len); info += (2 + len); } - - return; } static int wilc_wlan_parse_info_frame(uint8_t *info, int size) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/