* [PATCH V2 RESEND] net: hamradio: use time_is_after_jiffies() instead of open coding it
@ 2022-03-02 2:29 Qing Wang
2022-03-02 2:55 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Qing Wang @ 2022-03-02 2:29 UTC (permalink / raw)
To: Joerg Reuter, David S. Miller, Jakub Kicinski, linux-hams,
netdev, linux-kernel
Cc: Wang Qing
From: Wang Qing <wangqing@vivo.com>
Use the helper function time_is_{before,after}_jiffies() to improve
code readability.
V2:
add missing ")" at line 1357 which will cause compliation error.
Signed-off-by: Wang Qing <wangqing@vivo.com>
---
drivers/net/hamradio/dmascc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index 7e52749..6e7d17a
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -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 {
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2 RESEND] net: hamradio: use time_is_after_jiffies() instead of open coding it
2022-03-02 2:29 [PATCH V2 RESEND] net: hamradio: use time_is_after_jiffies() instead of open coding it Qing Wang
@ 2022-03-02 2:55 ` Jakub Kicinski
2022-03-02 2:58 ` 王擎
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-03-02 2:55 UTC (permalink / raw)
To: Qing Wang; +Cc: Joerg Reuter, David S. Miller, linux-hams, netdev, linux-kernel
On Tue, 1 Mar 2022 18:29:31 -0800 Qing Wang wrote:
> From: Wang Qing <wangqing@vivo.com>
>
> Use the helper function time_is_{before,after}_jiffies() to improve
> code readability.
>
> V2:
> add missing ")" at line 1357 which will cause compliation error.
I see :S So since the v1 was already applied could you please send
a patch that only adds the missing bracket based on this tree:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/
? We can't discard the old patch, we need an incremental fix.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH V2 RESEND] net: hamradio: use time_is_after_jiffies() instead of open coding it
2022-03-02 2:55 ` Jakub Kicinski
@ 2022-03-02 2:58 ` 王擎
0 siblings, 0 replies; 3+ messages in thread
From: 王擎 @ 2022-03-02 2:58 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Joerg Reuter, David S. Miller, linux-hams, netdev, linux-kernel
>>On Tue, 1 Mar 2022 18:29:31 -0800 Qing Wang wrote:
>> From: Wang Qing <wangqing@vivo.com>
>>
>> Use the helper function time_is_{before,after}_jiffies() to improve
>> code readability.
>>
>> V2:
>> add missing ")" at line 1357 which will cause compliation error.
>
>I see :S So since the v1 was already applied could you please send
>a patch that only adds the missing bracket based on this tree:
>
>https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/
>
>? We can't discard the old patch, we need an incremental fix.
>
>Thanks!
Sure, it's my mistake.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-02 2:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 2:29 [PATCH V2 RESEND] net: hamradio: use time_is_after_jiffies() instead of open coding it Qing Wang
2022-03-02 2:55 ` Jakub Kicinski
2022-03-02 2:58 ` 王擎
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.