aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2012-07-13 14:30:33 -0700
committerKalimochoAz <calimochoazucarado@gmail.com>2012-07-27 01:33:01 +0200
commit724487046a9fbf51843d58e454e348d410b698e3 (patch)
tree7450bb67335eb958e0bf0bbf237f6198f99d9c58
parent2b055393ddad4d1f540739b8ac0822ad271a5214 (diff)
downloadkernel_samsung_crespo-724487046a9fbf51843d58e454e348d410b698e3.zip
kernel_samsung_crespo-724487046a9fbf51843d58e454e348d410b698e3.tar.gz
kernel_samsung_crespo-724487046a9fbf51843d58e454e348d410b698e3.tar.bz2
net: wireless: bcmdhd: Use proper jiffie-related functions
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com> Conflicts: drivers/net/wireless/bcmdhd/wl_cfg80211.c drivers/net/wireless/bcmdhd/wl_iw.c
-rw-r--r--drivers/net/wireless/bcmdhd/dhd.h4
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_cfg80211.c4
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_linux.c22
-rw-r--r--drivers/net/wireless/bcmdhd/include/linux_osl.h2
-rw-r--r--drivers/net/wireless/bcmdhd/wl_cfg80211.c10
-rw-r--r--drivers/net/wireless/bcmdhd/wl_iw.c18
6 files changed, 26 insertions, 34 deletions
diff --git a/drivers/net/wireless/bcmdhd/dhd.h b/drivers/net/wireless/bcmdhd/dhd.h
index f047c8e..b35b24a 100644
--- a/drivers/net/wireless/bcmdhd/dhd.h
+++ b/drivers/net/wireless/bcmdhd/dhd.h
@@ -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)
diff --git a/drivers/net/wireless/bcmdhd/dhd_cfg80211.c b/drivers/net/wireless/bcmdhd/dhd_cfg80211.c
index bc1be94..970216e 100644
--- a/drivers/net/wireless/bcmdhd/dhd_cfg80211.c
+++ b/drivers/net/wireless/bcmdhd/dhd_cfg80211.c
@@ -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;
diff --git a/drivers/net/wireless/bcmdhd/dhd_linux.c b/drivers/net/wireless/bcmdhd/dhd_linux.c
index 3aede87..cebfe98 100644
--- a/drivers/net/wireless/bcmdhd/dhd_linux.c
+++ b/drivers/net/wireless/bcmdhd/dhd_linux.c
@@ -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);
diff --git a/drivers/net/wireless/bcmdhd/include/linux_osl.h b/drivers/net/wireless/bcmdhd/include/linux_osl.h
index 830d351..7f92966 100644
--- a/drivers/net/wireless/bcmdhd/include/linux_osl.h
+++ b/drivers/net/wireless/bcmdhd/include/linux_osl.h
@@ -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>
diff --git a/drivers/net/wireless/bcmdhd/wl_cfg80211.c b/drivers/net/wireless/bcmdhd/wl_cfg80211.c
index 3537138..2365bdd 100644
--- a/drivers/net/wireless/bcmdhd/wl_cfg80211.c
+++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.c
@@ -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);
diff --git a/drivers/net/wireless/bcmdhd/wl_iw.c b/drivers/net/wireless/bcmdhd/wl_iw.c
index 095dc86..d60c21c 100644
--- a/drivers/net/wireless/bcmdhd/wl_iw.c
+++ b/drivers/net/wireless/bcmdhd/wl_iw.c
@@ -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;