]> git.karo-electronics.de Git - linux-beck.git/commitdiff
rtlwifi: Change long delays to sleeps
authorLarry Finger <Larry.Finger@lwfinger.net>
Mon, 15 Feb 2016 22:12:07 +0000 (16:12 -0600)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 7 Mar 2016 12:12:49 +0000 (14:12 +0200)
Routine rtl_addr_delay() uses delay statements in code that can
sleep. To improve system responsiveness, the various delay statements
are changed.

In addition, routines rtl_rfreg_delay() and rtl_bb_delay() are
rewritten to use the code in rtl_addr_delay() for most of their
input values.

Suggested-by: Byeoungwook Kim <quddnr145@gmail.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/core.c

index 16bb57ccf90e2e87f4b6644672ea90fe800de1f1..0f48048b865407fe8d984b1057bd262ccd28dc7f 100644 (file)
@@ -54,59 +54,39 @@ EXPORT_SYMBOL(channel5g_80m);
 void rtl_addr_delay(u32 addr)
 {
        if (addr == 0xfe)
-               mdelay(50);
+               msleep(50);
        else if (addr == 0xfd)
-               mdelay(5);
+               msleep(5);
        else if (addr == 0xfc)
-               mdelay(1);
+               msleep(1);
        else if (addr == 0xfb)
-               udelay(50);
+               usleep_range(50, 100);
        else if (addr == 0xfa)
-               udelay(5);
+               usleep_range(5, 10);
        else if (addr == 0xf9)
-               udelay(1);
+               usleep_range(1, 2);
 }
 EXPORT_SYMBOL(rtl_addr_delay);
 
 void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr,
                     u32 mask, u32 data)
 {
-       if (addr == 0xfe) {
-               mdelay(50);
-       } else if (addr == 0xfd) {
-               mdelay(5);
-       } else if (addr == 0xfc) {
-               mdelay(1);
-       } else if (addr == 0xfb) {
-               udelay(50);
-       } else if (addr == 0xfa) {
-               udelay(5);
-       } else if (addr == 0xf9) {
-               udelay(1);
+       if (addr >= 0xf9 && addr <= 0xfe) {
+               rtl_addr_delay(addr);
        } else {
                rtl_set_rfreg(hw, rfpath, addr, mask, data);
-               udelay(1);
+               usleep_range(1, 2);
        }
 }
 EXPORT_SYMBOL(rtl_rfreg_delay);
 
 void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data)
 {
-       if (addr == 0xfe) {
-               mdelay(50);
-       } else if (addr == 0xfd) {
-               mdelay(5);
-       } else if (addr == 0xfc) {
-               mdelay(1);
-       } else if (addr == 0xfb) {
-               udelay(50);
-       } else if (addr == 0xfa) {
-               udelay(5);
-       } else if (addr == 0xf9) {
-               udelay(1);
+       if (addr >= 0xf9 && addr <= 0xfe) {
+               rtl_addr_delay(addr);
        } else {
                rtl_set_bbreg(hw, addr, MASKDWORD, data);
-               udelay(1);
+               usleep_range(1, 2);
        }
 }
 EXPORT_SYMBOL(rtl_bb_delay);