2001-11-06 21:10:37

by Tim Schmielau

[permalink] [raw]
Subject: [PATCH] slip.c jiffies cleanup

On Tue, 6 Nov 2001, Jeff Garzik wrote:

> would you wind CC'ing drivers/net/* stuff to me?
>

Sorry for not keeping you informed. Please also drop a note if I shall
not yet Cc: Linus and Alan. While I have read lkml archives for many years
now, I am not yet used to Cc:ing policy as this information is not
kept the archives.

I could not find a maintainer for slip.c, which is the last of my network
patches for now.

Tim

--- ../linux-2.4.14-pre6/drivers/net/slip.c Sun Sep 30 21:26:07 2001
+++ drivers/net/slip.c Tue Nov 6 19:56:48 2001
@@ -483,7 +483,7 @@
* 14 Oct 1994 Dmitry Gorodchanin.
*/
#ifdef SL_CHECK_TRANSMIT
- if (jiffies - dev->trans_start < 20 * HZ) {
+ if (time_before(jiffies, dev->trans_start + 20 * HZ)) {
/* 20 sec timeout not reached */
goto out;
}
@@ -1387,7 +1387,7 @@
int i;

if (slip_ctrls != NULL) {
- unsigned long start = jiffies;
+ unsigned long timeout = jiffies + HZ;
int busy = 0;

/* First of all: check for active disciplines and hangup them.
@@ -1412,7 +1412,7 @@
spin_unlock(&slc->ctrl.lock);
}
local_bh_enable();
- } while (busy && jiffies - start < 1*HZ);
+ } while (busy && time_before(jiffies, timeout);

busy = 0;
for (i = 0; i < slip_maxdev; i++) {




2001-11-06 22:59:08

by Tim Schmielau

[permalink] [raw]
Subject: Re: [PATCH] slip.c jiffies cleanup

On Tue, 6 Nov 2001, Tim Schmielau wrote:

> --- ../linux-2.4.14-pre6/drivers/net/slip.c Sun Sep 30 21:26:07 2001
> +++ drivers/net/slip.c Tue Nov 6 19:56:48 2001
[...]

> @@ -1412,7 +1412,7 @@
> spin_unlock(&slc->ctrl.lock);
> }
> local_bh_enable();
> - } while (busy && jiffies - start < 1*HZ);
> + } while (busy && time_before(jiffies, timeout);
>
> busy = 0;
> for (i = 0; i < slip_maxdev; i++) {
>


Sorry all, I screwed up.
While I did compile before sending the patch,
somehow I must have missed the error message.
Patch must be

> - } while (busy && jiffies - start < 1*HZ);
> + } while (busy && time_before(jiffies, timeout));

New patch appended.

Tim



--- ../linux-2.4.14-pre6/drivers/net/slip.c Sun Sep 30 21:26:07 2001
+++ drivers/net/slip.c Tue Nov 6 19:56:48 2001
@@ -483,7 +483,7 @@
* 14 Oct 1994 Dmitry Gorodchanin.
*/
#ifdef SL_CHECK_TRANSMIT
- if (jiffies - dev->trans_start < 20 * HZ) {
+ if (time_before(jiffies, dev->trans_start + 20 * HZ)) {
/* 20 sec timeout not reached */
goto out;
}
@@ -1387,7 +1387,7 @@
int i;

if (slip_ctrls != NULL) {
- unsigned long start = jiffies;
+ unsigned long timeout = jiffies + HZ;
int busy = 0;

/* First of all: check for active disciplines and hangup them.
@@ -1412,7 +1412,7 @@
spin_unlock(&slc->ctrl.lock);
}
local_bh_enable();
- } while (busy && jiffies - start < 1*HZ);
+ } while (busy && time_before(jiffies, timeout));

busy = 0;
for (i = 0; i < slip_maxdev; i++) {