From 7c26d76be7c33990c02991bff46289c4ded20f4f Mon Sep 17 00:00:00 2001 From: Andrew Miller Date: Wed, 14 Mar 2012 10:36:51 -0400 Subject: Staging: rtl8187se: r8180_core.c: Cleaned up if statement clean up the if statement's conditions to make them more readable fix the if statement's body indention, one tab stop to many. Signed-off-by: Andrew Miller Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/r8180_core.c | 50 ++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'drivers/staging/rtl8187se/r8180_core.c') diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 04c23919f4d6..e6e39c8e6ce9 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -1615,35 +1615,39 @@ void rtl8180_rx(struct net_device *dev) fc = le16_to_cpu(hdr->frame_ctl); type = WLAN_FC_GET_TYPE(fc); - if ((IEEE80211_FTYPE_CTL != type) && - (eqMacAddr(priv->ieee80211->current_network.bssid, (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : hdr->addr3)) - && (!bHwError) && (!bCRC) && (!bICV)) { - /* Perform signal smoothing for dynamic - * mechanism on demand. This is different - * with PerformSignalSmoothing8185 in smoothing - * fomula. No dramatic adjustion is apply - * because dynamic mechanism need some degree - * of correctness. */ - PerformUndecoratedSignalSmoothing8185(priv, bCckRate); - - /* For good-looking singal strength. */ - SignalStrengthIndex = NetgearSignalStrengthTranslate( - priv->LastSignalStrengthInPercent, - priv->SignalStrength); - - priv->LastSignalStrengthInPercent = SignalStrengthIndex; - priv->Stats_SignalStrength = TranslateToDbm8185((u8)SignalStrengthIndex); + if (IEEE80211_FTYPE_CTL != type && + !bHwError && !bCRC && !bICV && + eqMacAddr(priv->ieee80211->current_network.bssid, + fc & IEEE80211_FCTL_TODS ? hdr->addr1 : + fc & IEEE80211_FCTL_FROMDS ? hdr->addr2 : + hdr->addr3)) { + + /* Perform signal smoothing for dynamic + * mechanism on demand. This is different + * with PerformSignalSmoothing8185 in smoothing + * fomula. No dramatic adjustion is apply + * because dynamic mechanism need some degree + * of correctness. */ + PerformUndecoratedSignalSmoothing8185(priv, bCckRate); + + /* For good-looking singal strength. */ + SignalStrengthIndex = NetgearSignalStrengthTranslate( + priv->LastSignalStrengthInPercent, + priv->SignalStrength); + + priv->LastSignalStrengthInPercent = SignalStrengthIndex; + priv->Stats_SignalStrength = TranslateToDbm8185((u8)SignalStrengthIndex); /* * We need more correct power of received packets and the "SignalStrength" of RxStats is beautified, * so we record the correct power here. */ - priv->Stats_SignalQuality = (long)(priv->Stats_SignalQuality * 5 + (long)priv->SignalQuality + 5) / 6; - priv->Stats_RecvSignalPower = (long)(priv->Stats_RecvSignalPower * 5 + priv->RecvSignalPower - 1) / 6; + priv->Stats_SignalQuality = (long)(priv->Stats_SignalQuality * 5 + (long)priv->SignalQuality + 5) / 6; + priv->Stats_RecvSignalPower = (long)(priv->Stats_RecvSignalPower * 5 + priv->RecvSignalPower - 1) / 6; /* Figure out which antenna that received the lasted packet. */ - priv->LastRxPktAntenna = Antenna ? 1 : 0; /* 0: aux, 1: main. */ - SwAntennaDiversityRxOk8185(dev, priv->SignalStrength); - } + priv->LastRxPktAntenna = Antenna ? 1 : 0; /* 0: aux, 1: main. */ + SwAntennaDiversityRxOk8185(dev, priv->SignalStrength); + } if (first) { if (!priv->rx_skb_complete) { -- cgit v1.2.3-59-g8ed1b From cd6868080efcef7df4ffef860b54994be6d268a9 Mon Sep 17 00:00:00 2001 From: Andrew Miller Date: Wed, 14 Mar 2012 18:26:57 -0400 Subject: Staging: rtl8187se: r8180_core.c: Removed trailing spaces Cleaned up some trailing spaces Signed-off-by: Andrew Miller Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/r8180_core.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/staging/rtl8187se/r8180_core.c') diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index e6e39c8e6ce9..d1a3e65747e8 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -1619,9 +1619,9 @@ void rtl8180_rx(struct net_device *dev) !bHwError && !bCRC && !bICV && eqMacAddr(priv->ieee80211->current_network.bssid, fc & IEEE80211_FCTL_TODS ? hdr->addr1 : - fc & IEEE80211_FCTL_FROMDS ? hdr->addr2 : + fc & IEEE80211_FCTL_FROMDS ? hdr->addr2 : hdr->addr3)) { - + /* Perform signal smoothing for dynamic * mechanism on demand. This is different * with PerformSignalSmoothing8185 in smoothing @@ -1658,7 +1658,7 @@ void rtl8180_rx(struct net_device *dev) } /* support for prism header has been originally added by Christian */ if (priv->prism_hdr && priv->ieee80211->iw_mode == IW_MODE_MONITOR) { - + } else { priv->rx_skb = dev_alloc_skb(len+2); if (!priv->rx_skb) @@ -1770,7 +1770,7 @@ void rtl8180_data_hard_resume(struct net_device *dev) rtl8180_set_mode(dev, EPROM_CMD_NORMAL); } -/* +/* * This function TX data frames when the ieee80211 stack requires this. * It checks also if we need to stop the ieee tx queue, eventually do it */ @@ -1814,7 +1814,7 @@ rate) { spin_unlock_irqrestore(&priv->tx_lock, flags); } -/* +/* * This is a rough attempt to TX a frame * This is called by the ieee 80211 stack to TX management frames. * If the ring is full packet are dropped (for data frame the queue @@ -1920,7 +1920,7 @@ void rtl8180_prepare_beacon(struct net_device *dev) } } -/* +/* * This function do the real dirty work: it enqueues a TX command * descriptor in the ring buffer, copyes the frame in a TX buffer * and kicks the NIC to ensure it does the DMA transfer. @@ -2188,7 +2188,7 @@ short rtl8180_tx(struct net_device *dev, u8* txbuf, int len, int priority, priv->txhpbufstail = buflist; break; case BEACON_PRIORITY: - /* + /* * The HW seems to be happy with the 1st * descriptor filled and the 2nd empty... * So always update descriptor 1 and never @@ -2308,13 +2308,13 @@ void rtl8180_hw_sleep(struct net_device *dev, u32 th, u32 tl) spin_lock_irqsave(&priv->ps_lock, flags); - /* + /* * Writing HW register with 0 equals to disable * the timer, that is not really what we want */ tl -= MSECS(4+16+7); - /* + /* * If the interval in witch we are requested to sleep is too * short then give up and remain awake */ @@ -2332,7 +2332,7 @@ void rtl8180_hw_sleep(struct net_device *dev, u32 th, u32 tl) queue_delayed_work(priv->ieee80211->wq, &priv->ieee80211->hw_wakeup_wq, tmp); /* as tl may be less than rb */ } - /* + /* * If we suspect the TimerInt is gone beyond tl * while setting it, then give up */ @@ -3172,7 +3172,7 @@ void rtl8180_adapter_start(struct net_device *dev) netif_start_queue(dev); } -/* +/* * This configures registers for beacon tx and enables it via * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might * be used to stop beacon transmission @@ -3843,7 +3843,7 @@ void rtl8180_tx_isr(struct net_device *dev, int pri, short error) return; } - /* + /* * We check all the descriptors between the head and the nic, * but not the currently pointed by the nic (the next to be txed) * and the previous of the pointed (might be in process ??) @@ -3881,7 +3881,7 @@ void rtl8180_tx_isr(struct net_device *dev, int pri, short error) head += 8; } - /* + /* * The head has been moved to the last certainly TXed * (or at least processed by the nic) packet. * The driver take forcefully owning of all these packets -- cgit v1.2.3-59-g8ed1b From 24a39f702b0f5a997018c76b7730bb416a53e7bb Mon Sep 17 00:00:00 2001 From: Andrew Miller Date: Wed, 14 Mar 2012 18:26:58 -0400 Subject: Staging: rtl8187se: r8180_core.c: Fix some spacing issues Removed spaces before tabs and moved while statement in front of '}' Signed-off-by: Andrew Miller Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/r8180_core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'drivers/staging/rtl8187se/r8180_core.c') diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index d1a3e65747e8..42307a3f3824 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -439,8 +439,7 @@ void buffer_free(struct net_device *dev, struct buffer **buffer, int len, short } kfree(tmp); tmp = next; - } - while (next != *buffer); + } while (next != *buffer); *buffer = NULL; } @@ -1618,9 +1617,9 @@ void rtl8180_rx(struct net_device *dev) if (IEEE80211_FTYPE_CTL != type && !bHwError && !bCRC && !bICV && eqMacAddr(priv->ieee80211->current_network.bssid, - fc & IEEE80211_FCTL_TODS ? hdr->addr1 : - fc & IEEE80211_FCTL_FROMDS ? hdr->addr2 : - hdr->addr3)) { + fc & IEEE80211_FCTL_TODS ? hdr->addr1 : + fc & IEEE80211_FCTL_FROMDS ? hdr->addr2 : + hdr->addr3)) { /* Perform signal smoothing for dynamic * mechanism on demand. This is different @@ -3736,7 +3735,7 @@ static int __init rtl8180_pci_module_init(void) DMESG("Wireless extensions version %d", WIRELESS_EXT); rtl8180_proc_module_init(); - if (pci_register_driver(&rtl8180_pci_driver)) { + if (pci_register_driver(&rtl8180_pci_driver)) { DMESG("No device found"); return -ENODEV; } -- cgit v1.2.3-59-g8ed1b From dec3a003bd2870caa8769a752a49102776af3a25 Mon Sep 17 00:00:00 2001 From: Andrew Miller Date: Wed, 14 Mar 2012 18:26:59 -0400 Subject: Staging: rtl8187se: r8180_core.c: Fix some long line issues Fix some lines that where fairly long judging off the code around it. Signed-off-by: Andrew Miller Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/r8180_core.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'drivers/staging/rtl8187se/r8180_core.c') diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 42307a3f3824..e4ade550cfe5 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -1391,11 +1391,13 @@ void PerformUndecoratedSignalSmoothing8185(struct r8180_priv *priv, priv->bCurCCKPkt = bCckRate; if (priv->UndecoratedSmoothedSS >= 0) - priv->UndecoratedSmoothedSS = ((priv->UndecoratedSmoothedSS * 5) + (priv->SignalStrength * 10)) / 6; + priv->UndecoratedSmoothedSS = ((priv->UndecoratedSmoothedSS * 5) + + (priv->SignalStrength * 10)) / 6; else priv->UndecoratedSmoothedSS = priv->SignalStrength * 10; - priv->UndercorateSmoothedRxPower = ((priv->UndercorateSmoothedRxPower * 50) + (priv->RxPower * 11)) / 60; + priv->UndercorateSmoothedRxPower = ((priv->UndercorateSmoothedRxPower * 50) + + (priv->RxPower * 11)) / 60; if (bCckRate) priv->CurCCKRSSI = priv->RSSI; @@ -1606,8 +1608,11 @@ void rtl8180_rx(struct net_device *dev) /* printk("==========================>rx : RXAGC is %d,signalstrength is %d\n",RXAGC,stats.signalstrength); */ stats.rssi = priv->wstats.qual.qual = priv->SignalQuality; stats.noise = priv->wstats.qual.noise = 100 - priv->wstats.qual.qual; - bHwError = (((*(priv->rxringtail)) & (0x00000fff)) == 4080) | (((*(priv->rxringtail)) & (0x04000000)) != 0) - | (((*(priv->rxringtail)) & (0x08000000)) != 0) | (((~(*(priv->rxringtail))) & (0x10000000)) != 0) | (((~(*(priv->rxringtail))) & (0x20000000)) != 0); + bHwError = (((*(priv->rxringtail)) & (0x00000fff)) == 4080) | + (((*(priv->rxringtail)) & (0x04000000)) != 0) | + (((*(priv->rxringtail)) & (0x08000000)) != 0) | + (((~(*(priv->rxringtail))) & (0x10000000)) != 0) | + (((~(*(priv->rxringtail))) & (0x20000000)) != 0); bCRC = ((*(priv->rxringtail)) & (0x00002000)) >> 13; bICV = ((*(priv->rxringtail)) & (0x00001000)) >> 12; hdr = (struct ieee80211_hdr_4addr *)priv->rxbuffer->buf; @@ -2005,7 +2010,8 @@ short rtl8180_tx(struct net_device *dev, u8* txbuf, int len, int priority, bRTSEnable = 0; bCTSEnable = 0; - ThisFrameTime = ComputeTxTime(len + sCrcLng, rtl8180_rate2rate(rate), 0, bUseShortPreamble); + ThisFrameTime = ComputeTxTime(len + sCrcLng, rtl8180_rate2rate(rate), + 0, bUseShortPreamble); TxDescDuration = ThisFrameTime; } else { /* Unicast packet */ u16 AckTime; @@ -2043,7 +2049,8 @@ short rtl8180_tx(struct net_device *dev, u8* txbuf, int len, int priority, bRTSEnable = 0; RtsDur = 0; - ThisFrameTime = ComputeTxTime(len + sCrcLng, rtl8180_rate2rate(rate), 0, bUseShortPreamble); + ThisFrameTime = ComputeTxTime(len + sCrcLng, rtl8180_rate2rate(rate), + 0, bUseShortPreamble); TxDescDuration = ThisFrameTime + aSifsTime + AckTime; } @@ -2328,8 +2335,8 @@ void rtl8180_hw_sleep(struct net_device *dev, u32 th, u32 tl) u32 tmp = (tl > rb) ? (tl-rb) : (rb-tl); priv->DozePeriodInPast2Sec += jiffies_to_msecs(tmp); - - queue_delayed_work(priv->ieee80211->wq, &priv->ieee80211->hw_wakeup_wq, tmp); /* as tl may be less than rb */ + /* as tl may be less than rb */ + queue_delayed_work(priv->ieee80211->wq, &priv->ieee80211->hw_wakeup_wq, tmp); } /* * If we suspect the TimerInt is gone beyond tl @@ -3089,7 +3096,8 @@ void rtl8185_set_rate(struct net_device *dev) max_rr_rate = ieeerate2rtlrate(240); write_nic_byte(dev, RESP_RATE, - max_rr_rate<bLeisurePs) { if (priv->ieee80211->ps == IEEE80211_PS_DISABLED) - MgntActSet_802_11_PowerSaveMode(priv, IEEE80211_PS_MBCAST|IEEE80211_PS_UNICAST); /* IEEE80211_PS_ENABLE */ + /* IEEE80211_PS_ENABLE */ + MgntActSet_802_11_PowerSaveMode(priv, IEEE80211_PS_MBCAST|IEEE80211_PS_UNICAST); } } @@ -3302,7 +3311,10 @@ void rtl8180_watch_dog(struct net_device *dev) u16 SlotIndex = 0; u16 i = 0; if (priv->ieee80211->actscanning == false) { - if ((priv->ieee80211->iw_mode != IW_MODE_ADHOC) && (priv->ieee80211->state == IEEE80211_NOLINK) && (priv->ieee80211->beinretry == false) && (priv->eRFPowerState == eRfOn)) + if ((priv->ieee80211->iw_mode != IW_MODE_ADHOC) && + (priv->ieee80211->state == IEEE80211_NOLINK) && + (priv->ieee80211->beinretry == false) && + (priv->eRFPowerState == eRfOn)) IPSEnter(dev); } /* YJ,add,080828,for link state check */ -- cgit v1.2.3-59-g8ed1b From 70834d3070c3f3015ab5c05176d54bd4a0100546 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Fri, 23 Mar 2012 15:02:46 -0700 Subject: usermodehelper: use UMH_WAIT_PROC consistently A few call_usermodehelper() callers use the hardcoded constant instead of the proper UMH_WAIT_PROC, fix them. Reported-by: Tetsuo Handa Signed-off-by: Oleg Nesterov Cc: Lars Ellenberg Cc: Greg Kroah-Hartman Cc: Michal Januszewski Cc: Florian Tobias Schandinat Cc: Kentaro Takeda Cc: Tetsuo Handa Cc: James Morris Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/drbd/drbd_nl.c | 2 +- drivers/staging/rtl8187se/r8180_core.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 ++-- drivers/video/uvesafb.c | 2 +- security/tomoyo/load_policy.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging/rtl8187se/r8180_core.c') diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index e09f9cebbb20..abfaacaaf346 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -179,7 +179,7 @@ int drbd_khelper(struct drbd_conf *mdev, char *cmd) dev_info(DEV, "helper command: %s %s %s\n", usermode_helper, cmd, mb); drbd_bcast_ev_helper(mdev, cmd); - ret = call_usermodehelper(usermode_helper, argv, envp, 1); + ret = call_usermodehelper(usermode_helper, argv, envp, UMH_WAIT_PROC); if (ret) dev_warn(DEV, "helper command: %s %s %s exit code %u (0x%x)\n", usermode_helper, cmd, mb, diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index e4ade550cfe5..4fe52f6b0034 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -4159,7 +4159,7 @@ void GPIOChangeRFWorkItemCallBack(struct work_struct *work) argv[0] = RadioPowerPath; argv[2] = NULL; - call_usermodehelper(RadioPowerPath, argv, envp, 1); + call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC); } } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index a7fa9aad6f2d..f026b7171f62 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -208,7 +208,7 @@ static void dm_check_ac_dc_power(struct net_device *dev) if (priv->rtllib->state != RTLLIB_LINKED) return; - call_usermodehelper(ac_dc_check_script_path, argv, envp, 1); + call_usermodehelper(ac_dc_check_script_path, argv, envp, UMH_WAIT_PROC); return; }; @@ -2296,7 +2296,7 @@ void dm_CheckRfCtrlGPIO(void *data) argv[0] = RadioPowerPath; argv[2] = NULL; - call_usermodehelper(RadioPowerPath, argv, envp, 1); + call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC); } } diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index 9db3de3a8418..260cca7ddb41 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c @@ -121,7 +121,7 @@ static int uvesafb_helper_start(void) NULL, }; - return call_usermodehelper(v86d_path, argv, envp, 1); + return call_usermodehelper(v86d_path, argv, envp, UMH_WAIT_PROC); } /* diff --git a/security/tomoyo/load_policy.c b/security/tomoyo/load_policy.c index 67975405140f..078fac0bb4c5 100644 --- a/security/tomoyo/load_policy.c +++ b/security/tomoyo/load_policy.c @@ -102,7 +102,7 @@ void tomoyo_load_policy(const char *filename) envp[0] = "HOME=/"; envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; envp[2] = NULL; - call_usermodehelper(argv[0], argv, envp, 1); + call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); tomoyo_check_profile(); } -- cgit v1.2.3-59-g8ed1b