Skip to contentSkip to conversation

staging: rtl8192u: ieee80211: ieee80211_softmac: Replace MSECS with msecs_to_jiffies

PATCH Superseded Amitoj Kaur Chawla 2 participants 4 messages Feb 12, 2016 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 staging: rtl8192u: ieee80211: ieee80211_softmac: Replace MSECS with msecs_to_jiffies

Replace driver specific macro MSECS with msecs_to_jiffies().

This was found using the following Coccinelle semantic patch:

//<smpl>
@@
expression e;
@@

- MSECS(e)
+ msecs_to_jiffies(e)
//</smpl>

---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +6 -3
index 21ee410..6d85648 100644
@@ -380,7 +380,8 @@ static void ieee80211_send_beacon(struct ieee80211_device *ieee)
 	if (ieee->beacon_txing && ieee->ieee_up) {
 //		if(!timer_pending(&ieee->beacon_timer))
 //			add_timer(&ieee->beacon_timer);
-		mod_timer(&ieee->beacon_timer,jiffies+(MSECS(ieee->current_network.beacon_interval-5)));
+		mod_timer(&ieee->beacon_timer,
+			  jiffies + msecs_to_jiffies(ieee->current_network.beacon_interval-5));
 	}
 	//spin_unlock_irqrestore(&ieee->beacon_lock,flags);
 }
@@ -1735,10 +1736,12 @@ static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h,
 	if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
 		return 2;
 
-	if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
+	if(!time_after(jiffies,
+		       ieee->dev->trans_start + msecs_to_jiffies(timeout)))
 		return 0;
 
-	if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
+	if(!time_after(jiffies,
+		       ieee->last_rx_ps_time + msecs_to_jiffies(timeout)))
 		return 0;
 
 	if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
Signature · 1 line
1.9.1
#1 lore raw
Quoted 23 lines · Amitoj Kaur Chawla

Replace driver specific macro MSECS with msecs_to_jiffies().

This was found using the following Coccinelle semantic patch:

//<smpl>
@@
expression e;
@@

- MSECS(e)
+ msecs_to_jiffies(e)
//</smpl>

---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0
index 21ee410..6d85648 100644

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c static void ieee80211_send_beacon(struct ieee80211_device *ieee) · line 382

Quoted 3 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0
@@ -380,7 +380,8 @@ static void ieee80211_send_beacon(struct ieee80211_device *ieee)
 	if (ieee->beacon_txing && ieee->ieee_up) {
 //		if(!timer_pending(&ieee->beacon_timer))
 //			add_timer(&ieee->beacon_timer);

The above comment doesn't seem necessary. It would be for a different patch than this issue.

julia

Quoted 31 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +6 -4
-		mod_timer(&ieee->beacon_timer,jiffies+(MSECS(ieee->current_network.beacon_interval-5)));
+		mod_timer(&ieee->beacon_timer,
+			  jiffies + msecs_to_jiffies(ieee->current_network.beacon_interval-5));
 	}
 	//spin_unlock_irqrestore(&ieee->beacon_lock,flags);
 }
@@ -1735,10 +1736,12 @@ static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h,
 	if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
 		return 2;
 
-	if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
+	if(!time_after(jiffies,
+		       ieee->dev->trans_start + msecs_to_jiffies(timeout)))
 		return 0;
 
-	if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
+	if(!time_after(jiffies,
+		       ieee->last_rx_ps_time + msecs_to_jiffies(timeout)))
 		return 0;
 
 	if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160212144017.GA1301%40amitoj-Inspiron-3542.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 10 lines · Julia Lawall

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c static void ieee80211_send_beacon(struct ieee80211_device *ieee) · line 382

Quoted 4 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0
@@ -380,7 +380,8 @@ static void ieee80211_send_beacon(struct ieee80211_device *ieee)
      if (ieee->beacon_txing && ieee->ieee_up) {
 //           if(!timer_pending(&ieee->beacon_timer))
 //                   add_timer(&ieee->beacon_timer);

The above comment doesn't seem necessary. It would be for a different patch than this issue.

julia

Yes, while working on this patchset I found a whole lot of coding style issues with the driver and a lot of code is commented out. I can send cleanup patches later for this.

Amitoj

#3 lore raw
Quoted 9 lines · Amitoj Kaur Chawla
Quoted 8 lines · Julia Lawall

drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c static void ieee80211_send_beacon(struct ieee80211_device *ieee) · line 382

Quoted 4 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +0 -0
@@ -380,7 +380,8 @@ static void ieee80211_send_beacon(struct ieee80211_device *ieee)
      if (ieee->beacon_txing && ieee->ieee_up) {
 //           if(!timer_pending(&ieee->beacon_timer))
 //                   add_timer(&ieee->beacon_timer);

The above comment doesn't seem necessary. It would be for a different patch than this issue.

Quoted 5 lines
Quoted 2 lines

julia

Yes, while working on this patchset I found a whole lot of coding style issues with the driver and a lot of code is commented out. I can send cleanup patches later for this.

OK.

julia