Skip to contentSkip to conversation

net: hamradio: use time_is_after_jiffies() instead of open coding it

PATCH Applied Qing Wang 2 participants 2 messages Feb 28, 2022

Subsystems (2)
lore
Share & tools
lore

Qing Wang

author
#0 lore raw

PATCH 1/1 net: hamradio: use time_is_after_jiffies() instead of open coding it

From: Wang Qing <[email protected]>

Use the helper function time_is_{before,after}_jiffies() to improve code readability.

---
 drivers/net/hamradio/dmascc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/hamradio/dmascc.c +4 -3
index 7e52749..6e7d17a
@@ -28,6 +28,7 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <linux/uaccess.h>
+#include <linux/jiffies.h>
 #include <net/ax25.h>
 #include "z8530.h"
 
@@ -377,7 +378,7 @@ static int __init dmascc_init(void)
 		udelay(2000000 / TMR_0_HZ);
 
 		/* Timing loop */
-		while (jiffies - time < 13) {
+		while (time_is_after_jiffies(time + 13)) {
 			for (i = 0; i < hw[h].num_devs; i++)
 				if (base[i] && counting[i]) {
 					/* Read back Timer 1: latch; read LSB; read MSB */
@@ -525,7 +526,7 @@ static int __init setup_adapter(int card_base, int type, int n)
 
 	/* Wait and detect IRQ */
 	time = jiffies;
-	while (jiffies - time < 2 + HZ / TMR_0_HZ);
+	while (time_is_after_jiffies(time + 2 + HZ / TMR_0_HZ));
 	irq = probe_irq_off(irqs);
 
 	/* Clear pending interrupt, disable interrupts */
@@ -1353,7 +1354,7 @@ static void es_isr(struct scc_priv *priv)
 		/* Switch state */
 		write_scc(priv, R15, 0);
 		if (priv->tx_count &&
-		    (jiffies - priv->tx_start) < priv->param.txtimeout) {
+		    time_is_after_jiffies(priv->tx_start + priv->param.txtimeout) {
 			priv->state = TX_PAUSE;
 			start_timer(priv, priv->param.txpause, 0);
 		} else {
Signature · 1 line
2.7.4
#1 lore raw
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 8 lines · On Sun, 27 Feb 2022 19:13:31 -0800 you wrote:

From: Wang Qing <[email protected]>

Use the helper function time_is_{before,after}_jiffies() to improve code readability.

[...]

Here is the summary with links:
- net: hamradio: use time_is_after_jiffies() instead of open coding it

    https://git.kernel.org/netdev/net-next/c/61c4fb9c4d09

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html