Linux HAM/Amateur Radio development
 help / color / mirror / Atom feed
* [patch 1/1] drivers/net/hamradio/ : Use of time_after_eq macro
@ 2005-07-14 22:21 domen
  0 siblings, 0 replies; only message in thread
From: domen @ 2005-07-14 22:21 UTC (permalink / raw)
  To: t.sailer; +Cc: linux-hams, Marcelo Feitoza Parisi, domen

[-- Attachment #1: time_after-drivers_net_hamradio_baycom_epp --]
[-- Type: text/plain, Size: 3786 bytes --]

From: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>


Use of the time_after_eq() macro, defined at linux/jiffies.h, which deal
with wrapping correctly and are nicer to read.

Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
Signed-off-by: Domen Puncer <domen@coderock.org>

---
 baycom_epp.c     |    3 ++-
 baycom_par.c     |    3 ++-
 baycom_ser_fdx.c |    3 ++-
 baycom_ser_hdx.c |    3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

Index: quilt/drivers/net/hamradio/baycom_epp.c
===================================================================
--- quilt.orig/drivers/net/hamradio/baycom_epp.c
+++ quilt/drivers/net/hamradio/baycom_epp.c
@@ -54,6 +54,7 @@
 #include <linux/kmod.h>
 #include <linux/hdlcdrv.h>
 #include <linux/baycom.h>
+#include <linux/jiffies.h>
 #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
 /* prototypes for ax25_encapsulate and ax25_rebuild_header */
 #include <net/ax25.h> 
@@ -287,7 +288,7 @@ static inline void baycom_int_freq(struc
 	 * measure the interrupt frequency
 	 */
 	bc->debug_vals.cur_intcnt++;
-	if ((cur_jiffies - bc->debug_vals.last_jiffies) >= HZ) {
+	if (time_after_eq(cur_jiffies, bc->debug_vals.last_jiffies + HZ)) {
 		bc->debug_vals.last_jiffies = cur_jiffies;
 		bc->debug_vals.last_intcnt = bc->debug_vals.cur_intcnt;
 		bc->debug_vals.cur_intcnt = 0;
Index: quilt/drivers/net/hamradio/baycom_par.c
===================================================================
--- quilt.orig/drivers/net/hamradio/baycom_par.c
+++ quilt/drivers/net/hamradio/baycom_par.c
@@ -84,6 +84,7 @@
 #include <linux/baycom.h>
 #include <linux/parport.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 
 #include <asm/bug.h>
 #include <asm/system.h>
@@ -165,7 +166,7 @@ static void __inline__ baycom_int_freq(s
 	 * measure the interrupt frequency
 	 */
 	bc->debug_vals.cur_intcnt++;
-	if ((cur_jiffies - bc->debug_vals.last_jiffies) >= HZ) {
+	if (time_after_eq(cur_jiffies, bc->debug_vals.last_jiffies + HZ)) {
 		bc->debug_vals.last_jiffies = cur_jiffies;
 		bc->debug_vals.last_intcnt = bc->debug_vals.cur_intcnt;
 		bc->debug_vals.cur_intcnt = 0;
Index: quilt/drivers/net/hamradio/baycom_ser_fdx.c
===================================================================
--- quilt.orig/drivers/net/hamradio/baycom_ser_fdx.c
+++ quilt/drivers/net/hamradio/baycom_ser_fdx.c
@@ -79,6 +79,7 @@
 #include <asm/io.h>
 #include <linux/hdlcdrv.h>
 #include <linux/baycom.h>
+#include <linux/jiffies.h>
 
 /* --------------------------------------------------------------------- */
 
@@ -159,7 +160,7 @@ static inline void baycom_int_freq(struc
 	 * measure the interrupt frequency
 	 */
 	bc->debug_vals.cur_intcnt++;
-	if ((cur_jiffies - bc->debug_vals.last_jiffies) >= HZ) {
+	if (time_after_eq(cur_jiffies, bc->debug_vals.last_jiffies + HZ)) {
 		bc->debug_vals.last_jiffies = cur_jiffies;
 		bc->debug_vals.last_intcnt = bc->debug_vals.cur_intcnt;
 		bc->debug_vals.cur_intcnt = 0;
Index: quilt/drivers/net/hamradio/baycom_ser_hdx.c
===================================================================
--- quilt.orig/drivers/net/hamradio/baycom_ser_hdx.c
+++ quilt/drivers/net/hamradio/baycom_ser_hdx.c
@@ -69,6 +69,7 @@
 #include <asm/io.h>
 #include <linux/hdlcdrv.h>
 #include <linux/baycom.h>
+#include <linux/jiffies.h>
 
 /* --------------------------------------------------------------------- */
 
@@ -150,7 +151,7 @@ static inline void baycom_int_freq(struc
 	 * measure the interrupt frequency
 	 */
 	bc->debug_vals.cur_intcnt++;
-	if ((cur_jiffies - bc->debug_vals.last_jiffies) >= HZ) {
+	if (time_after_eq(cur_jiffies, bc->debug_vals.last_jiffies + HZ)) {
 		bc->debug_vals.last_jiffies = cur_jiffies;
 		bc->debug_vals.last_intcnt = bc->debug_vals.cur_intcnt;
 		bc->debug_vals.cur_intcnt = 0;

--

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-07-14 22:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-14 22:21 [patch 1/1] drivers/net/hamradio/ : Use of time_after_eq macro domen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox