diff options
author | Larry Finger | 2011-08-25 18:48:12 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2011-08-25 19:05:09 +0200 |
commit | 0dd565069b21ae20f4916cf305b64268bb3f9d3f (patch) | |
tree | 1d715cabc712363936a110a7a3c4b7db0103e16b /drivers/staging/rtl8192e/rtllib_softmac.c | |
parent | staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part I (diff) | |
download | kernel-qcow2-linux-0dd565069b21ae20f4916cf305b64268bb3f9d3f.tar.gz kernel-qcow2-linux-0dd565069b21ae20f4916cf305b64268bb3f9d3f.tar.xz kernel-qcow2-linux-0dd565069b21ae20f4916cf305b64268bb3f9d3f.zip |
staging: rtl8192e: Modify time handling
In several places, the driver keeps times (in jiffies) in two 32-bit
quantities. In the rtl8192_hw_to_sleep(), there is an error in the
calculation of the difference between two 64-bit quantities. Rather
than fix that error, I have converted to a single 64-bit number. That
makes the code be much cleaner and clearer.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rtl8192e/rtllib_softmac.c')
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_softmac.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 11433c61bdaf..29277d18f021 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2037,7 +2037,7 @@ void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee) } -short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u32 *time_h, u32 *time_l) +static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) { int timeout = ieee->ps_timeout; u8 dtim; @@ -2074,7 +2074,7 @@ short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u32 *time_h, u32 *time_l) (ieee->mgmt_queue_tail != ieee->mgmt_queue_head)) return 0; - if (time_l){ + if (time){ if (ieee->bAwakePktSent == true) { pPSC->LPSAwakeIntvl = 1; } else { @@ -2107,17 +2107,11 @@ short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u32 *time_h, u32 *time_l) LPSAwakeIntvl_tmp = pPSC->LPSAwakeIntvl; } - *time_l = ieee->current_network.last_dtim_sta_time[0] + *time = ieee->current_network.last_dtim_sta_time + MSECS(ieee->current_network.beacon_interval * LPSAwakeIntvl_tmp); } } - if (time_h) { - *time_h = ieee->current_network.last_dtim_sta_time[1]; - if (time_l && *time_l < ieee->current_network.last_dtim_sta_time[0]) - *time_h += 1; - } - return 1; @@ -2126,7 +2120,7 @@ short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u32 *time_h, u32 *time_l) inline void rtllib_sta_ps(struct rtllib_device *ieee) { - u32 th,tl; + u64 time; short sleep; unsigned long flags,flags2; @@ -2146,7 +2140,7 @@ inline void rtllib_sta_ps(struct rtllib_device *ieee) spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); } - sleep = rtllib_sta_ps_sleep(ieee,&th, &tl); + sleep = rtllib_sta_ps_sleep(ieee, &time); /* 2 wake, 1 sleep, 0 do nothing */ if (sleep == 0) { @@ -2154,7 +2148,7 @@ inline void rtllib_sta_ps(struct rtllib_device *ieee) } if (sleep == 1){ if (ieee->sta_sleep == LPS_IS_SLEEP){ - ieee->enter_sleep_state(ieee->dev,th,tl); + ieee->enter_sleep_state(ieee->dev, time); } else if (ieee->sta_sleep == LPS_IS_WAKE){ @@ -2164,8 +2158,7 @@ inline void rtllib_sta_ps(struct rtllib_device *ieee) ieee->sta_sleep = LPS_WAIT_NULL_DATA_SEND; ieee->ack_tx_to_ieee = 1; rtllib_sta_ps_send_null_frame(ieee,1); - ieee->ps_th = th; - ieee->ps_tl = tl; + ieee->ps_time = time; } spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); @@ -2241,7 +2234,7 @@ void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success) /* Null frame with PS bit set */ if (success){ ieee->sta_sleep = LPS_IS_SLEEP; - ieee->enter_sleep_state(ieee->dev,ieee->ps_th,ieee->ps_tl); + ieee->enter_sleep_state(ieee->dev, ieee->ps_time); } /* if the card report not success we can't be sure the AP * has not RXed so we can't assume the AP believe us awake |