net: wireless: bcmdhd: Use proper jiffie-related functions
authorDmitry Shmidt <dimitrysh@google.com>
Fri, 13 Jul 2012 21:30:33 +0000 (14:30 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Tue, 17 Jul 2012 19:53:28 +0000 (12:53 -0700)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Conflicts:

drivers/net/wireless/bcmdhd/wl_cfg80211.c
drivers/net/wireless/bcmdhd/wl_iw.c

drivers/net/wireless/bcmdhd/dhd.h
drivers/net/wireless/bcmdhd/dhd_cfg80211.c
drivers/net/wireless/bcmdhd/dhd_linux.c
drivers/net/wireless/bcmdhd/include/linux_osl.h
drivers/net/wireless/bcmdhd/wl_cfg80211.c
drivers/net/wireless/bcmdhd/wl_iw.c

index f047c8efa8bc3bbc457a6932d5bb36c317396bf6..b35b24a8aa144e834f376c970ed5e40f2d46df39 100644 (file)
@@ -251,7 +251,7 @@ typedef struct dhd_cmn {
                        SMP_RD_BARRIER_DEPENDS(); \
                        while (dhd_mmc_suspend && retry++ != b) { \
                                SMP_RD_BARRIER_DEPENDS(); \
-                               wait_event_interruptible_timeout(a, !dhd_mmc_suspend, HZ/100); \
+                               wait_event_interruptible_timeout(a, !dhd_mmc_suspend, 1); \
                        } \
                } while (0)
        #define DHD_PM_RESUME_WAIT(a)           _DHD_PM_RESUME_WAIT(a, 200)
@@ -263,7 +263,7 @@ typedef struct dhd_cmn {
        #define SPINWAIT_SLEEP(a, exp, us) do { \
                uint countdown = (us) + 9999; \
                while ((exp) && (countdown >= 10000)) { \
-                       wait_event_interruptible_timeout(a, FALSE, HZ/100); \
+                       wait_event_interruptible_timeout(a, FALSE, 1); \
                        countdown -= 10000; \
                } \
        } while (0)
index bc1be94802b4a63292f4eacb07d14a8d571cb2f0..970216efc7a7a4dbd6c2e0ef26fe5aae8c5351eb 100644 (file)
@@ -433,7 +433,7 @@ static void wl_cfg80211_bt_handler(struct work_struct *work)
                                __FUNCTION__));
                        btcx_inf->bt_state = BT_DHCP_OPPR_WIN;
                        mod_timer(&btcx_inf->timer,
-                               jiffies + BT_DHCP_OPPR_WIN_TIME*HZ/1000);
+                               jiffies + msecs_to_jiffies(BT_DHCP_OPPR_WIN_TIME));
                        btcx_inf->timer_on = 1;
                        break;
 
@@ -453,7 +453,7 @@ static void wl_cfg80211_bt_handler(struct work_struct *work)
                                wl_cfg80211_bt_setflag(btcx_inf->dev, TRUE);
                        btcx_inf->bt_state = BT_DHCP_FLAG_FORCE_TIMEOUT;
                        mod_timer(&btcx_inf->timer,
-                               jiffies + BT_DHCP_FLAG_FORCE_TIME*HZ/1000);
+                               jiffies + msecs_to_jiffies(BT_DHCP_FLAG_FORCE_TIME));
                        btcx_inf->timer_on = 1;
                        break;
 
index 3aede87731924b6954d293965bd8f106fbb1c1ba..cebfe98310765cb87ebd4c5ffd3bfa05a15d55af 100644 (file)
@@ -646,7 +646,7 @@ dhd_timeout_start(dhd_timeout_t *tmo, uint usec)
        tmo->limit = usec;
        tmo->increment = 0;
        tmo->elapsed = 0;
-       tmo->tick = 1000000 / HZ;
+       tmo->tick = jiffies_to_usecs(1);
 }
 
 int
@@ -1692,7 +1692,7 @@ dhd_watchdog_thread(void *data)
                                /* Reschedule the watchdog */
                                if (dhd->wd_timer_valid)
                                        mod_timer(&dhd->timer,
-                                       jiffies + dhd_watchdog_ms * HZ / 1000);
+                                       jiffies + msecs_to_jiffies(dhd_watchdog_ms));
                                dhd_os_spin_unlock(&dhd->pub, flags);
                        }
                        dhd_os_sdunlock(&dhd->pub);
@@ -1733,7 +1733,7 @@ static void dhd_watchdog(ulong data)
 
        /* Reschedule the watchdog */
        if (dhd->wd_timer_valid)
-               mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
+               mod_timer(&dhd->timer, jiffies + msecs_to_jiffies(dhd_watchdog_ms));
        dhd_os_spin_unlock(&dhd->pub, flags);
        dhd_os_sdunlock(&dhd->pub);
        DHD_OS_WAKE_UNLOCK(&dhd->pub);
@@ -3937,14 +3937,10 @@ int
 dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool *pending)
 {
        dhd_info_t * dhd = (dhd_info_t *)(pub->info);
-       int timeout = dhd_ioctl_timeout_msec;
+       int timeout;
 
        /* Convert timeout in millsecond to jiffies */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
-       timeout = msecs_to_jiffies(timeout);
-#else
-       timeout = timeout * HZ / 1000;
-#endif
+       timeout = msecs_to_jiffies(dhd_ioctl_timeout_msec);
 
        timeout = wait_event_timeout(dhd->ioctl_resp_wait, (*condition), timeout);
        return timeout;
@@ -3994,7 +3990,7 @@ dhd_os_wd_timer(void *bus, uint wdtick)
        if (wdtick) {
                dhd_watchdog_ms = (uint)wdtick;
                /* Re arm the timer, at last watchdog period */
-               mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
+               mod_timer(&dhd->timer, jiffies + msecs_to_jiffies(dhd_watchdog_ms));
                dhd->wd_timer_valid = TRUE;
        }
        dhd_os_spin_unlock(pub, flags);
@@ -4305,11 +4301,7 @@ void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar)
 {
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
        struct dhd_info *dhdinfo =  dhd->info;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
        int timeout = msecs_to_jiffies(2000);
-#else
-       int timeout = 2 * HZ;
-#endif
        dhd_os_sdunlock(dhd);
        wait_event_timeout(dhdinfo->ctrl_wait, (*lockvar == FALSE), timeout);
        dhd_os_sdlock(dhd);
@@ -4634,7 +4626,7 @@ int
 dhd_wait_pend8021x(struct net_device *dev)
 {
        dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
-       int timeout = 10 * HZ / 1000;
+       int timeout = msecs_to_jiffies(10);
        int ntimes = MAX_WAIT_FOR_8021X_TX;
        int pend = dhd_get_pend_8021x_cnt(dhd);
 
index 830d351d882b446931e73a24c5b66b59e2e96f46..7f92966d977e4b53261f06d696351265b0313530 100644 (file)
@@ -163,7 +163,7 @@ extern int osl_error(int bcmerror);
 
 
 
-#define OSL_SYSUPTIME()                ((uint32)jiffies * (1000 / HZ))
+#define OSL_SYSUPTIME()                ((uint32)jiffies_to_msecs(jiffies))
 #define        printf(fmt, args...)    printk(fmt , ## args)
 #include <linux/kernel.h>      
 #include <linux/string.h>      
index 353713880bb3d5fbfc433a5b0c13068001540727..2365bdd4a540a09c2a47e20810b9c11bf2a7249b 100644 (file)
@@ -1355,7 +1355,7 @@ static s32 wl_do_iscan(struct wl_priv *wl, struct cfg80211_scan_request *request
        }
        wl->iscan_kickstart = true;
        wl_run_iscan(iscan, request, WL_SCAN_ACTION_START);
-       mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
+       mod_timer(&iscan->timer, jiffies + msecs_to_jiffies(iscan->timer_ms));
        iscan->timer_on = 1;
 
        return err;
@@ -1578,7 +1578,7 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
        }
 
        /* Arm scan timeout timer */
-       mod_timer(&wl->scan_timeout, jiffies + WL_SCAN_TIMER_INTERVAL_MS * HZ / 1000);
+       mod_timer(&wl->scan_timeout, jiffies + msecs_to_jiffies(WL_SCAN_TIMER_INTERVAL_MS));
        iscan_req = false;
        wl->scan_request = request;
        if (request) {          /* scan bss */
@@ -6088,7 +6088,7 @@ static s32 wl_iscan_pending(struct wl_priv *wl)
        s32 err = 0;
 
        /* Reschedule the timer */
-       mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
+       mod_timer(&iscan->timer, jiffies + msecs_to_jiffies(iscan->timer_ms));
        iscan->timer_on = 1;
 
        return err;
@@ -6104,7 +6104,7 @@ static s32 wl_iscan_inprogress(struct wl_priv *wl)
        wl_run_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE);
        mutex_unlock(&wl->usr_sync);
        /* Reschedule the timer */
-       mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
+       mod_timer(&iscan->timer, jiffies + msecs_to_jiffies(iscan->timer_ms));
        iscan->timer_on = 1;
 
        return err;
@@ -7551,7 +7551,7 @@ static void wl_init_eq_lock(struct wl_priv *wl)
 
 static void wl_delay(u32 ms)
 {
-       if (in_atomic() || ms < 1000 / HZ) {
+       if (in_atomic() || (ms < jiffies_to_msecs(1))) {
                mdelay(ms);
        } else {
                msleep(ms);
index 095dc86b08e7d0aedaa15a2e82e0090dcb0be821..d60c21c03671b612aa049ad6ad7e7a3fdd565f6d 100644 (file)
@@ -64,7 +64,7 @@ typedef const struct si_pub  si_t;
 #endif
 
 
-#define JF2MS ((((jiffies / HZ) * 1000) + ((jiffies % HZ) * 1000) / HZ))
+#define JF2MS jiffies_to_msecs(jiffies)
 
 #ifdef COEX_DBG       
 #define WL_TRACE_COEX(x) printf("TS:%lu ", JF2MS); \
@@ -3284,7 +3284,7 @@ _iscan_sysioc_thread(void *data)
                                rtnl_unlock();
 #endif
                                
-                               mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000);
+                               mod_timer(&iscan->timer, jiffies + msecs_to_jiffies(iscan->timer_ms));
                                iscan->timer_on = 1;
                                break;
                        case WL_SCAN_RESULTS_SUCCESS:
@@ -3295,7 +3295,7 @@ _iscan_sysioc_thread(void *data)
                        case WL_SCAN_RESULTS_PENDING:
                                WL_TRACE(("iscanresults pending\n"));
                                
-                               mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000);
+                               mod_timer(&iscan->timer, jiffies + msecs_to_jiffies(iscan->timer_ms));
                                iscan->timer_on = 1;
                                break;
                        case WL_SCAN_RESULTS_ABORTED:
@@ -3395,9 +3395,9 @@ wl_iw_run_ss_cache_timer(int kick_off)
        if (*timer) {
                if (kick_off) {
 #ifdef CONFIG_PRESCANNED
-                       (*timer)->expires = jiffies + 70000 * HZ / 1000;
+                       (*timer)->expires = jiffies + msecs_to_jiffies(70000);
 #else
-                       (*timer)->expires = jiffies + 30000 * HZ / 1000;        
+                       (*timer)->expires = jiffies + msecs_to_jiffies(30000);
 #endif
                        add_timer(*timer);
                        WL_TRACE(("%s : timer starts \n", __FUNCTION__));
@@ -3715,7 +3715,7 @@ wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag)
                rtnl_unlock();
 #endif
 
-       mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000);
+       mod_timer(&iscan->timer, jiffies + msecs_to_jiffies(iscan->timer_ms));
 
        iscan->timer_on = 1;
 
@@ -6007,7 +6007,7 @@ wl_iw_combined_scan_set(struct net_device *dev, wlc_ssid_t* ssids_local, int nss
        iscan->list_cur = iscan->list_hdr;
        iscan->iscan_state = ISCAN_STATE_SCANING;
        wl_iw_set_event_mask(dev);
-       mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000);
+       mod_timer(&iscan->timer, jiffies + msecs_to_jiffies(iscan->timer_ms));
 
        iscan->timer_on = 1;
 
@@ -8639,7 +8639,7 @@ _bt_dhcp_sysioc_thread(void *data)
                                WL_TRACE_COEX(("%s bt_dhcp stm: started \n", __FUNCTION__));
                                g_bt->bt_state = BT_DHCP_OPPORTUNITY_WINDOW;
                                mod_timer(&g_bt->timer,
-                                         jiffies + BT_DHCP_OPPORTUNITY_WINDOW_TIME*HZ/1000);
+                                         jiffies + msecs_to_jiffies(BT_DHCP_OPPORTUNITY_WINDOW_TIME));
                                g_bt->timer_on = 1;
                                break;
 
@@ -8656,7 +8656,7 @@ _bt_dhcp_sysioc_thread(void *data)
                                
                                if (g_bt->dev) wl_iw_bt_flag_set(g_bt->dev, TRUE);
                                g_bt->bt_state = BT_DHCP_FLAG_FORCE_TIMEOUT;
-                               mod_timer(&g_bt->timer, jiffies + BT_DHCP_FLAG_FORCE_TIME*HZ/1000);
+                               mod_timer(&g_bt->timer, jiffies + msecs_to_jiffies(BT_DHCP_FLAG_FORCE_TIME));
                                g_bt->timer_on = 1;
                                break;