Skip to contentSkip to conversation

Staging: rtl8712: Use mod_timer

PATCH Superseded Vaishali Thakkar 2 participants 3 messages Feb 22, 2015 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8712: Use mod_timer

This patch introduces the use of API function mod_timer instead of driver specific function as it is a more efficient way to update the expire field of an active timer.

---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +4 -3
index 9bb364f..71ef0de 100644
@@ -129,7 +129,8 @@ static inline void handle_pairwise_key(struct sta_info *psta,
 		memcpy(psta->tkiprxmickey. skey, &(param->u.crypt.
 			key[24]), 8);
 		padapter->securitypriv. busetkipkey = false;
-		_set_timer(&padapter->securitypriv.tkip_timer, 50);
+		mod_timer(&padapter->securitypriv.tkip_timer,
+			(jiffies+msecs_to_jiffies(50)));
 	}
 	r8712_setstakey_cmd(padapter, (unsigned char *)psta, true);
 }
@@ -153,8 +154,8 @@ static inline void handle_group_key(struct ieee_param *param,
 		if (padapter->registrypriv.power_mgnt > PS_MODE_ACTIVE) {
 			if (padapter->registrypriv.power_mgnt != padapter->
 			    pwrctrlpriv.pwr_mode)
-				_set_timer(&(padapter->mlmepriv.dhcp_timer),
-					   60000);
+				mod_timer(&(padapter->mlmepriv.dhcp_timer),
+					   (jiffies+msecs_to_jiffies(60000)));
 		}
 	}
 }
Signature · 1 line
1.9.1
#1 lore raw
Quoted 4 lines · Vaishali Thakkar

This patch introduces the use of API function mod_timer instead of driver specific function as it is a more efficient way to update the expire field of an active timer.

Is it really more efficient, or just more standard?

Quoted 10 lines
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +0 -0
index 9bb364f..71ef0de 100644

drivers/staging/rtl8712/rtl871x_ioctl_linux.c static inline void handle_pairwise_key(struct sta_info *psta, · line 133

Quoted 6 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +2 -1
@@ -129,7 +129,8 @@ static inline void handle_pairwise_key(struct sta_info *psta,
 		memcpy(psta->tkiprxmickey. skey, &(param->u.crypt.
 			key[24]), 8);
 		padapter->securitypriv. busetkipkey = false;
-		_set_timer(&padapter->securitypriv.tkip_timer, 50);
+		mod_timer(&padapter->securitypriv.tkip_timer,
+			(jiffies+msecs_to_jiffies(50)));

You don't need the parentheses around the second argument. The second argument would look nicer lined up with the first one.

Other similar code puts spaces around the +, eg in drivers/iio/common/ssp_sensors/ssp_dev.c

drivers/staging/rtl8712/rtl871x_ioctl_linux.c static inline void handle_group_key(struct ieee_param *param, · line 158

Quoted 11 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +2 -2
 	}
 	r8712_setstakey_cmd(padapter, (unsigned char *)psta, true);
 }
@@ -153,8 +154,8 @@ static inline void handle_group_key(struct ieee_param *param,
 		if (padapter->registrypriv.power_mgnt > PS_MODE_ACTIVE) {
 			if (padapter->registrypriv.power_mgnt != padapter->
 			    pwrctrlpriv.pwr_mode)
-				_set_timer(&(padapter->mlmepriv.dhcp_timer),
-					   60000);
+				mod_timer(&(padapter->mlmepriv.dhcp_timer),
+					   (jiffies+msecs_to_jiffies(60000)));

Likewise here.

julia

Quoted 13 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +0 -1
 		}
 	}
 }
--

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/20150222161321.GA3033%40vaishali-Ideapad-Z570.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 8 lines · Julia Lawall
Quoted 4 lines · Vaishali Thakkar

This patch introduces the use of API function mod_timer instead of driver specific function as it is a more efficient way to update the expire field of an active timer.

Is it really more efficient, or just more standard?

According to mod_timer definition it is an efficient way but here its my mistake . It should be efficient and standard I guess. I will send v2.

Quoted 20 lines
Quoted 10 lines
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +0 -0
index 9bb364f..71ef0de 100644

drivers/staging/rtl8712/rtl871x_ioctl_linux.c static inline void handle_pairwise_key(struct sta_info *psta, · line 133

Quoted 6 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +2 -1
@@ -129,7 +129,8 @@ static inline void handle_pairwise_key(struct sta_info *psta,
              memcpy(psta->tkiprxmickey. skey, &(param->u.crypt.
                      key[24]), 8);
              padapter->securitypriv. busetkipkey = false;
-             _set_timer(&padapter->securitypriv.tkip_timer, 50);
+             mod_timer(&padapter->securitypriv.tkip_timer,
+                     (jiffies+msecs_to_jiffies(50)));

You don't need the parentheses around the second argument. The second argument would look nicer lined up with the first one.

Quoted 2 lines

Other similar code puts spaces around the +, eg in drivers/iio/common/ssp_sensors/ssp_dev.c

Oh. Yes. These parenthesis are unnecessary. I will apply both of these changes in v2 at both places.

Thanks

Quoted 28 lines

drivers/staging/rtl8712/rtl871x_ioctl_linux.c static inline void handle_group_key(struct ieee_param *param, · line 158

Quoted 11 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +2 -2
      }
      r8712_setstakey_cmd(padapter, (unsigned char *)psta, true);
 }
@@ -153,8 +154,8 @@ static inline void handle_group_key(struct ieee_param *param,
              if (padapter->registrypriv.power_mgnt > PS_MODE_ACTIVE) {
                      if (padapter->registrypriv.power_mgnt != padapter->
                          pwrctrlpriv.pwr_mode)
-                             _set_timer(&(padapter->mlmepriv.dhcp_timer),
-                                        60000);
+                             mod_timer(&(padapter->mlmepriv.dhcp_timer),
+                                        (jiffies+msecs_to_jiffies(60000)));

Likewise here.
julia

Quoted 13 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +0 -1
              }
      }
 }
--

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/20150222161321.GA3033%40vaishali-Ideapad-Z570.
For more options, visit https://groups.google.com/d/optout.

Signature · 1 line
Vaishali