Skip to contentSkip to conversation

net/islpci_dev: replace

PATCH In review Nishanth Aravamudan 7 participants 26 messages Sep 23, 2004 – Oct 31, 2004

Subsystems (10)
lore
Share & tools
lore
#0 lore raw

PATCH 17/38 net/islpci_dev: replace

Any comments would be appreciated.

Description: Use msleep() instead of schedule_timeout()
to guarantee the task delays as expected. Also set_current_state() is inserted before schedule_timeout(). If the for-loop were to execute twice, the second time would not set the state before sleeping in the current code; this causes schedule_timeout() to return immediately.

drivers/net/wireless/prism54/islpci_dev.c +2 -2
@@ -436,8 +436,7 @@ prism54_bring_down(islpci_private *priv)
 	wmb();
 
 	/* wait a while for the device to reset */
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(50*HZ/1000);
+	msleep(50);
 
 	return 0;
 }
@@ -489,6 +488,7 @@ islpci_reset_if(islpci_private *priv)
 		/* The software reset acknowledge needs about 220 msec here.
 		 * Be conservative and wait for up to one second. */
 	
+		set_current_state(TASK_UNINTERRUPTIBLE);
 		remaining = schedule_timeout(HZ);
 
 		if(remaining > 0) {

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

Re: [PATCH 2.6.9-rc2 17/38] net/islpci_dev: replace schedule_timeout() with msleep()

Quoted 23 lines · Nishanth Aravamudan

Any comments would be appreciated.

Description: Use msleep() instead of schedule_timeout()
to guarantee the task delays as expected. Also set_current_state() is inserted before schedule_timeout(). If the for-loop were to execute twice, the second time would not set the state before sleeping in the current code; this causes schedule_timeout() to return immediately.

drivers/net/wireless/prism54/islpci_dev.c +1 -2
@@ -436,8 +436,7 @@ prism54_bring_down(islpci_private *priv)
 	wmb();
 
 	/* wait a while for the device to reset */
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(50*HZ/1000);
+	msleep(50);
 
 	return 0;
 }

drivers/net/wireless/prism54/islpci_dev.c islpci_reset_if(islpci_private *priv) · line 494

Quoted 7 lines
drivers/net/wireless/prism54/islpci_dev.c +1 -0
@@ -489,6 +488,7 @@ islpci_reset_if(islpci_private *priv)
 		/* The software reset acknowledge needs about 220 msec here.
 		 * Be conservative and wait for up to one second. */
 
+		set_current_state(TASK_UNINTERRUPTIBLE);
 		remaining = schedule_timeout(HZ);
 
 		if(remaining > 0) {

Looks good to me. IIRC Margit had something to say about this last time this popped around -- CC'ing her to see if there are any outstanding comments.

PS. For future prism54 patches please feel free to CC prism54-devel and netdev.

Luis

Signature · 1 line
GnuPG Key fingerprint = 113F B290 C6D2 0251 4D84  A34A 6ADD 4937 E20A 525E

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

Re: [PATCH 2.6.9-rc2 17/38] net/islpci_dev: replace schedule_timeout() with msleep()

Hi Nish,
At 18:55 23.09.2004 -0400, Luis scribeth:

Quoted 32 lines · Nishanth Aravamudan
Quoted 11 lines

Any comments would be appreciated.

Description: Use msleep() instead of schedule_timeout()
to guarantee the task delays as expected. Also set_current_state() is inserted before schedule_timeout(). If the for-loop were to execute twice, the second time would not set the state before sleeping in the current code; this causes schedule_timeout() to return immediately.

---

2.6.9-rc2-vanilla/drivers/net/wireless/prism54/islpci_dev.c 2004-09-13 17:15:41.000000000 -0700

Quoted 1 line

+++

2.6.9-rc2/drivers/net/wireless/prism54/islpci_dev.c 2004-09-23 13:58:42.000000000 -0700

Quoted 17 lines
drivers/net/wireless/prism54/islpci_dev.c +2 -2
@@ -436,8 +436,7 @@ prism54_bring_down(islpci_private *priv)
      wmb();
 
      /* wait a while for the device to reset */
-     set_current_state(TASK_UNINTERRUPTIBLE);
-     schedule_timeout(50*HZ/1000);
+     msleep(50);
 
      return 0;
 }
@@ -489,6 +488,7 @@ islpci_reset_if(islpci_private *priv)
              /* The software reset acknowledge needs about 220 msec here.
              * Be conservative and wait for up to one second. */
 
+             set_current_state(TASK_UNINTERRUPTIBLE);
              remaining = schedule_timeout(HZ);
 
Quoted 6 lines

drivers/net/wireless/prism54/islpci_dev.c islpci_reset_if(islpci_private *priv) · line 494

Quoted 1 line
drivers/net/wireless/prism54/islpci_dev.c +0 -0
              if(remaining > 0) {

Looks good to me. IIRC Margit had something to say about this last time this popped around -- CC'ing her to see if there are any outstanding comments.

You bet she has.

The patch has wrong line numbers. Doesn't take into account the stacked up netdev changes. (Therefore CC'ing Jeff Garzik)

This breaks 2.4 compatibility.
So either backport to 2.4 or Nish can take over prism54 2.4 maintenance ;-)

Don't say a backport is not possible/reasonable, it happened with netdev_priv(). (In 2.4.27; At least there, we have HAVE_NETDEV_PRIV).

If this is going to be forced, can we at least have a define HAVE_MSLEEP in delay.h ?

I am somewhat confused by the second part of the patch.
What has that got to do with msleep ?
Actually, the fix would appear to be correct, but that is a seperate issue and nothing to do with msleep.
(Prims54 developers -> I'll take a look over the weekend)

I am sceptical about the whole msleep patchset as, by their own admission, the janitors have/can not (no hardware) test the majority of the changes. Even more worrying is that incorrect code has directly appeared in mainline kernel BK.

Margit

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw

Re: [Kernel-janitors] [PATCH 2.6.9-rc2 17/38] net/islpci_dev: replace schedule_timeout() with msleep()

On Fri, 24 Sep 2004, Margit Schubert-While wrote:
..

Quoted 2 lines

The patch has wrong line numbers. Doesn't take into account the stacked up netdev changes. (Therefore CC'ing Jeff Garzik)

sure the kj patches are against mainline.

Quoted 2 lines

This breaks 2.4 compatibility.
So either backport to 2.4 or Nish can take over prism54 2.4 maintenance ;-)

can't remember the last time when Randy submitted janitorial patches to 2.4.x, but it's long ago. 2.4 is in maintenance mode.

Quoted 3 lines

Don't say a backport is not possible/reasonable, it happened with netdev_priv().
(In 2.4.27; At least there, we have HAVE_NETDEV_PRIV).

there must have been serious reasons for that.

Quoted 5 lines

If this is going to be forced, can we at least have a define HAVE_MSLEEP in delay.h ?

I am somewhat confused by the second part of the patch. What has that got to do with msleep ?

basically a lot, because as prism54 lots of drivers forgo/et to set there state when calling schedule_timeout().

Quoted 3 lines

Actually, the fix would appear to be correct, but that is a seperate issue and nothing to do with msleep.
(Prims54 developers -> I'll take a look over the weekend)

great, please also remove the unused TRACE macro. (patch was sent to netdev on 3. Sept).
the kj mailing list got another submission to correct the __FUNCTION__ use their. :)

Quoted 4 lines

I am sceptical about the whole msleep patchset as, by their own admission, the janitors have/can not (no hardware) test the majority of the changes. Even more worrying is that incorrect code has directly appeared in mainline kernel BK.

the named small errors were quickly corrected. it's up to the driver MAINTAINER to prove us wrong. we got lots of ack in between.

--
maks
kernel janitor http://janitor.kernelnewbies.org/

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#6 lore raw

Re: [Kernel-janitors] Re: [PATCH 2.6.9-rc2 17/38] net/islpci_dev: replace schedule_timeout() with msleep()

Quoted 7 lines · Margit Schubert-While

At 00:15 01.10.2004 -0400, Jeff scribeth:

Quoted 1 line

I would rather see an msleep implementation in 2.4.x...

Hear, hear.
And can we PLEASE have a
"#define HAVE_MSLEEP" in delay.h ?!!!
(2.4. AND 2.6)

No, this is not how the kernel source tree works, sorry.

greg k-h

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#7 lore raw

Re: [Kernel-janitors] Re: [PATCH 2.6.9-rc2 17/38] net/islpci_dev: replace schedule_timeout() with msleep()

At 09:55 01.10.2004 -0700, Greg scribeth:

Quoted 10 lines · Margit Schubert-While
Quoted 7 lines

At 00:15 01.10.2004 -0400, Jeff scribeth:

Quoted 1 line

I would rather see an msleep implementation in 2.4.x...

Hear, hear.
And can we PLEASE have a
"#define HAVE_MSLEEP" in delay.h ?!!!
(2.4. AND 2.6)

No, this is not how the kernel source tree works, sorry.

Well it happened with netdev_priv ;-)
(HAVE_NETDEV_PRIV)

Margit

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#8 lore raw

Re: [Kernel-janitors] Re: [PATCH 2.6.9-rc2 17/38] net/islpci_dev: replace schedule_timeout() with msleep()

Quoted 11 lines · Margit Schubert-While

At 09:55 01.10.2004 -0700, Greg scribeth:

Quoted 9 lines · Margit Schubert-While
Quoted 7 lines

At 00:15 01.10.2004 -0400, Jeff scribeth:

Quoted 1 line

I would rather see an msleep implementation in 2.4.x...

Hear, hear.
And can we PLEASE have a
"#define HAVE_MSLEEP" in delay.h ?!!!
(2.4. AND 2.6)

Quoted 5 lines
Quoted 1 line

No, this is not how the kernel source tree works, sorry.

Well it happened with netdev_priv ;-)
(HAVE_NETDEV_PRIV)

Net driver API is intentionally more friendly to cross-version kernel compat than the kernel as a whole ;-)

Jeff

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#9 lore raw

PATCH 1/1 back port msleep(), msleep_interruptible()

In reply to Jeff Garzik
Quoted 1 line · Jeff Garzik

I would rather see an msleep implementation in 2.4.x...

thanks for Domen Puncer at helping out.

msleep() and msleep_interruptible() as found in current 2.6 to 2.4. therefor also adds the helper functions ssleep(), jiffies_to_msecs(), jiffies_to_usecs(), msecs_to_jiffies().

compile and boot tested.

---

 include/linux/delay.h |    8 ++++++
 include/linux/time.h  |   41 +++++++++++++++++++++++++++++++++
 kernel/Makefile       |    3 +-
 kernel/timer.c        |   33 ++++++++++++++++++++++++++
 4 files changed, 84 insertions(+), 1 deletion(-)
kernel/Makefile renamed from kernel/Makefile~add-msleep-2.4 +2 -1
diff -puN kernel/Makefile~add-msleep-2.4 kernel/Makefile
@@ -9,7 +9,8 @@
 
 O_TARGET := kernel.o
 
-export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o printk.o
+export-objs   = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o \
+		printk.o timer.o
 
 obj-y     = sched.o dma.o fork.o exec_domain.o panic.o printk.o \
 	    module.o exit.o itimer.o info.o time.o softirq.o resource.o \
kernel/timer.c renamed from kernel/timer.c~add-msleep-2.4 +33 -0
diff -puN kernel/timer.c~add-msleep-2.4 kernel/timer.c
@@ -22,6 +22,7 @@
 #include <linux/smp_lock.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
+#include <linux/module.h>
 
 #include <asm/uaccess.h>
 
@@ -874,3 +875,35 @@ asmlinkage long sys_nanosleep(struct tim
 	return 0;
 }
 
+/**
+ * msleep - sleep safely even with waitqueue interruptions
+ * @msecs: Time in milliseconds to sleep for
+ */
+void msleep(unsigned int msecs)
+{
+	unsigned long timeout = msecs_to_jiffies(msecs) + 1;
+
+	while (timeout) {
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		timeout = schedule_timeout(timeout);
+	}
+}
+
+EXPORT_SYMBOL(msleep);
+
+/**
+ * msleep_interruptible - sleep waiting for waitqueue interruptions
+ * @msecs: Time in milliseconds to sleep for
+ */
+unsigned long msleep_interruptible(unsigned int msecs)
+{
+	unsigned long timeout = msecs_to_jiffies(msecs) + 1;
+
+	while (timeout && !signal_pending(current)) {
+		set_current_state(TASK_INTERRUPTIBLE);
+		timeout = schedule_timeout(timeout);
+	}
+	return jiffies_to_msecs(timeout);
+}
+
+EXPORT_SYMBOL(msleep_interruptible);
include/linux/delay.h renamed from include/linux/delay.h~add-msleep-2.4 +8 -0
diff -puN include/linux/delay.h~add-msleep-2.4 include/linux/delay.h
@@ -34,4 +34,12 @@ extern unsigned long loops_per_jiffy;
 	({unsigned long msec=(n); while (msec--) udelay(1000);}))
 #endif
 
+void msleep(unsigned int msecs);
+unsigned long msleep_interruptible(unsigned int msecs);
+
+static inline void ssleep(unsigned int seconds)
+{
+	msleep(seconds * 1000);
+}
+
 #endif /* defined(_LINUX_DELAY_H) */
include/linux/time.h renamed from include/linux/time.h~add-msleep-2.4 +41 -0

45 lines not on this page · raw message

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#10 lore raw

Re: [patch 2.4] back port msleep(), msleep_interruptible()

Quoted 11 lines · maximilian attems

diff -puN include/linux/delay.h~add-msleep-2.4 include/linux/delay.h

include/linux/delay.h renamed from include/linux/delay.h~add-msleep-2.4 +4 -0
@@ -34,4 +34,12 @@ extern unsigned long loops_per_jiffy;
 	({unsigned long msec=(n); while (msec--) udelay(1000);}))
 #endif
 
+void msleep(unsigned int msecs);
+unsigned long msleep_interruptible(unsigned int msecs);
+
+static inline void ssleep(unsigned int seconds)

[...]

include/linux/delay.h

Quoted 5 lines
include/linux/delay.h renamed from include/linux/delay.h~add-msleep-2.4 +3 -0
+static inline unsigned int jiffies_to_msecs(const unsigned long j)
 
+static inline unsigned int jiffies_to_usecs(const unsigned long j)
 
+static inline unsigned long msecs_to_jiffies(const unsigned int m)

I'm pretty sure more than one of these symbols clashes with a symbol defined locally in a driver. I like the patch but we can't apply it until the impact on existing code is evaluated.

Jeff

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#11 lore raw

Re: [KJ] Re: [patch 2.4] back port msleep(), msleep_interruptible()

Quoted 15 lines · Jeff Garzik
Quoted 11 lines · maximilian attems

diff -puN include/linux/delay.h~add-msleep-2.4 include/linux/delay.h

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +4 -0
@@ -34,4 +34,12 @@ extern unsigned long loops_per_jiffy;
      ({unsigned long msec=(n); while (msec--) udelay(1000);}))
 #endif
 
+void msleep(unsigned int msecs);
+unsigned long msleep_interruptible(unsigned int msecs);
+
+static inline void ssleep(unsigned int seconds)

[...]

Quoted 1 line

+static inline unsigned int jiffies_to_msecs(const unsigned long j)

Quoted 8 lines

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200

Quoted 3 lines
include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +2 -0
+static inline unsigned int jiffies_to_usecs(const unsigned long j)
 
+static inline unsigned long msecs_to_jiffies(const unsigned int m)

I'm pretty sure more than one of these symbols clashes with a symbol defined locally in a driver. I like the patch but we can't apply it until the impact on existing code is evaluated.

More than likely much of the code cleanup that was done before I began my patches, like removing custom msleep()s from drivers will need to be done again, as Jeff points out.

-Nish

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#12 lore raw

Re: [KJ] Re: [patch 2.4] back port msleep(), msleep_interruptible()

Quoted 25 lines · Nish Aravamudan
Quoted 15 lines · Jeff Garzik
Quoted 11 lines · maximilian attems

diff -puN include/linux/delay.h~add-msleep-2.4 include/linux/delay.h

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +4 -0
@@ -34,4 +34,12 @@ extern unsigned long loops_per_jiffy;
      ({unsigned long msec=(n); while (msec--) udelay(1000);}))
 #endif
 
+void msleep(unsigned int msecs);
+unsigned long msleep_interruptible(unsigned int msecs);
+
+static inline void ssleep(unsigned int seconds)

[...]

Quoted 1 line

+static inline unsigned int jiffies_to_msecs(const unsigned long j)

Quoted 8 lines

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200

Quoted 3 lines
include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +2 -0
+static inline unsigned int jiffies_to_usecs(const unsigned long j)
 
+static inline unsigned long msecs_to_jiffies(const unsigned int m)

I'm pretty sure more than one of these symbols clashes with a symbol defined locally in a driver. I like the patch but we can't apply it until the impact on existing code is evaluated.

Quoted 5 lines

More than likely much of the code cleanup that was done before I began my patches, like removing custom msleep()s from drivers will need to be done again, as Jeff points out.

-Nish

thanks Jeff for your quick response,
ooh i seee libata is defining an msleep().
so there seems to be need for it.

ok we'll come up with tougher patchset.

--
maks
kernel janitor http://janitor.kernelnewbies.org/

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#13 lore raw

Re: [KJ] Re: [patch 2.4] back port msleep(), msleep_interruptible()

In reply to Nish Aravamudan
Quoted 25 lines · Nish Aravamudan
Quoted 15 lines · Jeff Garzik
Quoted 11 lines · maximilian attems

diff -puN include/linux/delay.h~add-msleep-2.4 include/linux/delay.h

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +4 -0
@@ -34,4 +34,12 @@ extern unsigned long loops_per_jiffy;
      ({unsigned long msec=(n); while (msec--) udelay(1000);}))
 #endif
 
+void msleep(unsigned int msecs);
+unsigned long msleep_interruptible(unsigned int msecs);
+
+static inline void ssleep(unsigned int seconds)

[...]

Quoted 1 line

+static inline unsigned int jiffies_to_msecs(const unsigned long j)

Quoted 8 lines

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200

Quoted 3 lines
include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +2 -0
+static inline unsigned int jiffies_to_usecs(const unsigned long j)
 
+static inline unsigned long msecs_to_jiffies(const unsigned int m)

I'm pretty sure more than one of these symbols clashes with a symbol defined locally in a driver. I like the patch but we can't apply it until the impact on existing code is evaluated.

Quoted 5 lines

More than likely much of the code cleanup that was done before I began my patches, like removing custom msleep()s from drivers will need to be done again, as Jeff points out.

-Nish

thanks Jeff for your quick response,
ooh i seee libata is defining an msleep().
so there seems to be need for it.

ok we'll come up with tougher patchset.

--
maks
kernel janitor http://janitor.kernelnewbies.org/

#14 lore raw

Re: [KJ] Re: [patch 2.4] back port msleep(), msleep_interruptible()

In reply to Nish Aravamudan
Quoted 25 lines · Nish Aravamudan
Quoted 15 lines · Jeff Garzik
Quoted 11 lines · maximilian attems

diff -puN include/linux/delay.h~add-msleep-2.4 include/linux/delay.h

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +4 -0
@@ -34,4 +34,12 @@ extern unsigned long loops_per_jiffy;
      ({unsigned long msec=(n); while (msec--) udelay(1000);}))
 #endif
 
+void msleep(unsigned int msecs);
+unsigned long msleep_interruptible(unsigned int msecs);
+
+static inline void ssleep(unsigned int seconds)

[...]

Quoted 1 line

+static inline unsigned int jiffies_to_msecs(const unsigned long j)

Quoted 8 lines

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200

Quoted 3 lines
include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +2 -0
+static inline unsigned int jiffies_to_usecs(const unsigned long j)
 
+static inline unsigned long msecs_to_jiffies(const unsigned int m)

I'm pretty sure more than one of these symbols clashes with a symbol defined locally in a driver. I like the patch but we can't apply it until the impact on existing code is evaluated.

Quoted 5 lines

More than likely much of the code cleanup that was done before I began my patches, like removing custom msleep()s from drivers will need to be done again, as Jeff points out.

-Nish

thanks Jeff for your quick response,
ooh i seee libata is defining an msleep().
so there seems to be need for it.

ok we'll come up with tougher patchset.

--
maks
kernel janitor http://janitor.kernelnewbies.org/

#15 lore raw

Re: [KJ] Re: [patch 2.4] back port msleep(), msleep_interruptible()

In reply to Jeff Garzik
Quoted 15 lines · Jeff Garzik
Quoted 11 lines · maximilian attems

diff -puN include/linux/delay.h~add-msleep-2.4 include/linux/delay.h

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +4 -0
@@ -34,4 +34,12 @@ extern unsigned long loops_per_jiffy;
      ({unsigned long msec=(n); while (msec--) udelay(1000);}))
 #endif
 
+void msleep(unsigned int msecs);
+unsigned long msleep_interruptible(unsigned int msecs);
+
+static inline void ssleep(unsigned int seconds)

[...]

Quoted 1 line

+static inline unsigned int jiffies_to_msecs(const unsigned long j)

Quoted 8 lines

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200

Quoted 3 lines
include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +2 -0
+static inline unsigned int jiffies_to_usecs(const unsigned long j)
 
+static inline unsigned long msecs_to_jiffies(const unsigned int m)

I'm pretty sure more than one of these symbols clashes with a symbol defined locally in a driver. I like the patch but we can't apply it until the impact on existing code is evaluated.

More than likely much of the code cleanup that was done before I began my patches, like removing custom msleep()s from drivers will need to be done again, as Jeff points out.

-Nish

#16 lore raw

Re: [KJ] Re: [patch 2.4] back port msleep(), msleep_interruptible()

In reply to Jeff Garzik
Quoted 15 lines · Jeff Garzik
Quoted 11 lines · maximilian attems

diff -puN include/linux/delay.h~add-msleep-2.4 include/linux/delay.h

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +4 -0
@@ -34,4 +34,12 @@ extern unsigned long loops_per_jiffy;
      ({unsigned long msec=(n); while (msec--) udelay(1000);}))
 #endif
 
+void msleep(unsigned int msecs);
+unsigned long msleep_interruptible(unsigned int msecs);
+
+static inline void ssleep(unsigned int seconds)

[...]

Quoted 1 line

+static inline unsigned int jiffies_to_msecs(const unsigned long j)

Quoted 8 lines

include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200

Quoted 3 lines
include/linux/delay.h 2004-10-30 22:48:46.000000000 +0200 renamed from include/linux/delay.h~add-msleep-2.4 2004-10-30 22:48:46.000000000 +0200 +2 -0
+static inline unsigned int jiffies_to_usecs(const unsigned long j)
 
+static inline unsigned long msecs_to_jiffies(const unsigned int m)

I'm pretty sure more than one of these symbols clashes with a symbol defined locally in a driver. I like the patch but we can't apply it until the impact on existing code is evaluated.

More than likely much of the code cleanup that was done before I began my patches, like removing custom msleep()s from drivers will need to be done again, as Jeff points out.

-Nish

#17 lore raw

Re: [patch 2.4] back port msleep(), msleep_interruptible()

In reply to Jeff Garzik
Quoted 5 lines · Jeff Garzik

I'm pretty sure more than one of these symbols clashes with a symbol defined locally in a driver. I like the patch but we can't apply it until the impact on existing code is evaluated.

Jeff

current 2.4 has no ssleep() nor jiffies_to_usecs() nor jiffies_to_msecs() users. so no namespace conflicts on them.

i found a strange unsupported "msleep" syscall in
./arch/parisc/hpux/sys_hpux.c

left this one appart, i resend the msleep patch + 5 cleanup patches. they remove duplicate msleep() or msecs_to_jiffies() definitions. they are all compile tested, but the one touching drivers/char/shwdt.c please show me if i forgot something.

--
maks
kernel janitor http://janitor.kernelnewbies.org/

ps dropped [email protected] from cc as this ml rejects my mails.

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#18 lore raw

Re: [patch 2.4] back port msleep(), msleep_interruptible()

In reply to Jeff Garzik
Quoted 5 lines · Jeff Garzik

I'm pretty sure more than one of these symbols clashes with a symbol defined locally in a driver. I like the patch but we can't apply it until the impact on existing code is evaluated.

Jeff

current 2.4 has no ssleep() nor jiffies_to_usecs() nor jiffies_to_msecs() users. so no namespace conflicts on them.

i found a strange unsupported "msleep" syscall in
./arch/parisc/hpux/sys_hpux.c

left this one appart, i resend the msleep patch + 5 cleanup patches. they remove duplicate msleep() or msecs_to_jiffies() definitions. they are all compile tested, but the one touching drivers/char/shwdt.c please show me if i forgot something.

--
maks
kernel janitor http://janitor.kernelnewbies.org/

ps dropped [email protected] from cc as this ml rejects my mails.

#19 lore raw

Re: [patch 2.4] back port msleep(), msleep_interruptible()

In reply to Jeff Garzik
Quoted 5 lines · Jeff Garzik

I'm pretty sure more than one of these symbols clashes with a symbol defined locally in a driver. I like the patch but we can't apply it until the impact on existing code is evaluated.

Jeff

current 2.4 has no ssleep() nor jiffies_to_usecs() nor jiffies_to_msecs() users. so no namespace conflicts on them.

i found a strange unsupported "msleep" syscall in
./arch/parisc/hpux/sys_hpux.c

left this one appart, i resend the msleep patch + 5 cleanup patches. they remove duplicate msleep() or msecs_to_jiffies() definitions. they are all compile tested, but the one touching drivers/char/shwdt.c please show me if i forgot something.

--
maks
kernel janitor http://janitor.kernelnewbies.org/

ps dropped [email protected] from cc as this ml rejects my mails.

#20 lore raw

PATCH 1/6 back port msleep(), msleep_interruptible()

In reply to Jeff Garzik

Backport suggested by prism54 folks. idea acked by Jeff. thanks for Domen Puncer at helping out.

Belows patch adds msleep() and msleep_interruptible() as found in current 2.6 to 2.4.
therefor adds the helper functions ssleep(), jiffies_to_msecs(), jiffies_to_usecs(), msecs_to_jiffies().

The namespace clashes for msleep() and msecs_to_jiffies() are cleanup by the next 5 patches.

---

 linux-2.4.28-rc1-max/include/linux/delay.h |    8 +++++
 linux-2.4.28-rc1-max/include/linux/time.h  |   41 +++++++++++++++++++++++++++++
 linux-2.4.28-rc1-max/kernel/Makefile       |    3 +-
 linux-2.4.28-rc1-max/kernel/timer.c        |   33 +++++++++++++++++++++++
 4 files changed, 84 insertions(+), 1 deletion(-)
kernel/Makefile renamed from kernel/Makefile~add-msleep-2.4 +2 -1
diff -puN kernel/Makefile~add-msleep-2.4 kernel/Makefile
@@ -9,7 +9,8 @@
 
 O_TARGET := kernel.o
 
-export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o printk.o
+export-objs   = signal.o sys.o kmod.o context.o ksyms.o pm.o exec_domain.o \
+		printk.o timer.o
 
 obj-y     = sched.o dma.o fork.o exec_domain.o panic.o printk.o \
 	    module.o exit.o itimer.o info.o time.o softirq.o resource.o \
kernel/timer.c renamed from kernel/timer.c~add-msleep-2.4 +33 -0
diff -puN kernel/timer.c~add-msleep-2.4 kernel/timer.c
@@ -22,6 +22,7 @@
 #include <linux/smp_lock.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
+#include <linux/module.h>
 
 #include <asm/uaccess.h>
 
@@ -874,3 +875,35 @@ asmlinkage long sys_nanosleep(struct tim
 	return 0;
 }
 
+/**
+ * msleep - sleep safely even with waitqueue interruptions
+ * @msecs: Time in milliseconds to sleep for
+ */
+void msleep(unsigned int msecs)
+{
+	unsigned long timeout = msecs_to_jiffies(msecs) + 1;
+
+	while (timeout) {
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		timeout = schedule_timeout(timeout);
+	}
+}
+
+EXPORT_SYMBOL(msleep);
+
+/**
+ * msleep_interruptible - sleep waiting for waitqueue interruptions
+ * @msecs: Time in milliseconds to sleep for
+ */
+unsigned long msleep_interruptible(unsigned int msecs)
+{
+	unsigned long timeout = msecs_to_jiffies(msecs) + 1;
+
+	while (timeout && !signal_pending(current)) {
+		set_current_state(TASK_INTERRUPTIBLE);
+		timeout = schedule_timeout(timeout);
+	}
+	return jiffies_to_msecs(timeout);
+}
+
+EXPORT_SYMBOL(msleep_interruptible);
include/linux/delay.h renamed from include/linux/delay.h~add-msleep-2.4 +8 -0
diff -puN include/linux/delay.h~add-msleep-2.4 include/linux/delay.h
@@ -34,4 +34,12 @@ extern unsigned long loops_per_jiffy;
 	({unsigned long msec=(n); while (msec--) udelay(1000);}))
 #endif
 
+void msleep(unsigned int msecs);
+unsigned long msleep_interruptible(unsigned int msecs);
+
+static inline void ssleep(unsigned int seconds)
+{
+	msleep(seconds * 1000);
+}
+
 #endif /* defined(_LINUX_DELAY_H) */
include/linux/time.h renamed from include/linux/time.h~add-msleep-2.4 +41 -0

45 lines not on this page · raw message

_

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#21 lore raw

PATCH 2/6 libata remove duplicate definition msecs_to_jiffies()

In reply to Jeff Garzik

remove duplicate definition of msecs_to_jiffies(). already includes delay.h

---

 linux-2.4.28-rc1-max/include/linux/libata.h |    5 -----
 1 files changed, 5 deletions(-)
include/linux/libata.h renamed from include/linux/libata.h~remove-msecs_to_jiffies-libata.h +0 -5
diff -puN include/linux/libata.h~remove-msecs_to_jiffies-libata.h include/linux/libata.h
@@ -419,11 +419,6 @@ extern int ata_std_bios_param(Disk * dis
 extern void libata_msleep(unsigned long msecs);
 
 
-static inline unsigned long msecs_to_jiffies(unsigned long msecs)
-{
-	return ((HZ * msecs + 999) / 1000);
-}
-
 static inline unsigned int ata_tag_valid(unsigned int tag)
 {
 	return (tag < ATA_MAX_QUEUE) ? 1 : 0;

_

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#22 lore raw

PATCH 3/6 sx8 remove duplicate definition msleep(), msecs_to_jiffies()

In reply to Jeff Garzik

remove duplicate definition msleep(), msecs_to_jiffies(). delay.h already included.

---

 linux-2.4.28-rc1-max/drivers/block/sx8.c |   11 -----------
 1 files changed, 11 deletions(-)
drivers/block/sx8.c renamed from drivers/block/sx8.c~remove-msleep+msecs_to_jiffies-drivers_block_sx8 +0 -11
diff -puN drivers/block/sx8.c~remove-msleep+msecs_to_jiffies-drivers_block_sx8 drivers/block/sx8.c
@@ -548,17 +548,6 @@ static int carm_bdev_ioctl(struct inode 
 	return -EOPNOTSUPP;
 }
 
-static inline unsigned long msecs_to_jiffies(unsigned long msecs)
-{
-	return ((HZ * msecs + 999) / 1000);
-}
-
-static void msleep(unsigned long msecs)
-{
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(msecs) + 1);
-}
-
 static const u32 msg_sizes[] = { 32, 64, 128, CARM_MSG_SIZE };
 
 static inline int carm_lookup_bucket(u32 msg_size)

_

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#23 lore raw

PATCH 4/6 char/shwdt remove duplicate msecs_to_jiffies()

In reply to Jeff Garzik

remove duplicate msecs_to_jiffies() definition.
add include <delay.h>.

---

 linux-2.4.28-rc1-max/drivers/char/shwdt.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/char/shwdt.c renamed from drivers/char/shwdt.c~remove-msecs_to_jiffies-drivers_char_shwdt +1 -1
diff -puN drivers/char/shwdt.c~remove-msecs_to_jiffies-drivers_char_shwdt drivers/char/shwdt.c
@@ -27,6 +27,7 @@
 #include <linux/reboot.h>
 #include <linux/notifier.h>
 #include <linux/ioport.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -113,7 +114,6 @@
  */
 static int clock_division_ratio = WTCSR_CKS_4096;
 
-#define msecs_to_jiffies(msecs)	(jiffies + (HZ * msecs + 9999) / 10000)
 #define next_ping_period(cks)	msecs_to_jiffies(cks - 4)
 
 static unsigned long shwdt_is_open;

_

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#24 lore raw

PATCH 5/6 sata_promise remove duplicate msleep() definition

In reply to Jeff Garzik

remove now duplicate define.
driver already includes delay.

---

 linux-2.4.28-rc1-max/drivers/scsi/sata_promise.c |    2 --
 1 files changed, 2 deletions(-)
drivers/scsi/sata_promise.c renamed from drivers/scsi/sata_promise.c~remove-msleep-drivers_scsi_sata_promise +0 -2
diff -puN drivers/scsi/sata_promise.c~remove-msleep-drivers_scsi_sata_promise drivers/scsi/sata_promise.c
@@ -42,8 +42,6 @@
 #define DRV_NAME	"sata_promise"
 #define DRV_VERSION	"1.00"
 
-#define msleep libata_msleep	/* 2.4-specific */
-
 enum {
 	PDC_PKT_SUBMIT		= 0x40, /* Command packet pointer addr */
 	PDC_INT_SEQMASK		= 0x40,	/* Mask of asserted SEQ INTs */

_

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#25 lore raw

PATCH 6/6 libata remove msleep_libata()

In reply to Jeff Garzik

remove msleep_libata(), now that msleep() is backported. also remove duplicate msleep() definition. delay.h is already included.

---

 linux-2.4.28-rc1-max/drivers/scsi/libata-core.c |   23 -----------------------
 linux-2.4.28-rc1-max/include/linux/libata.h     |    1 -
 2 files changed, 24 deletions(-)
drivers/scsi/libata-core.c renamed from drivers/scsi/libata-core.c~remove-libata_msleep +0 -23
diff -puN drivers/scsi/libata-core.c~remove-libata_msleep drivers/scsi/libata-core.c
@@ -67,28 +67,6 @@ MODULE_DESCRIPTION("Library module for A
 MODULE_LICENSE("GPL");
 
 /**
- *	msleep - sleep for a number of milliseconds
- *	@msecs: number of milliseconds to sleep
- *
- *	Issues schedule_timeout call for the specified number
- *	of milliseconds.
- *
- *	LOCKING:
- *	None.
- */
-
-static void msleep(unsigned long msecs)
-{
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(msecs) + 1);
-}
-
-void libata_msleep(unsigned long msecs)
-{
-	msleep(msecs);
-}
-
-/**
  *	ata_tf_load - send taskfile registers to host controller
  *	@ap: Port to which output is sent
  *	@tf: ATA taskfile register set
@@ -3697,7 +3675,6 @@ EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
 EXPORT_SYMBOL_GPL(ata_scsi_error);
 EXPORT_SYMBOL_GPL(ata_scsi_detect);
 EXPORT_SYMBOL_GPL(ata_add_to_probe_list);
-EXPORT_SYMBOL_GPL(libata_msleep);
 EXPORT_SYMBOL_GPL(ata_scsi_release);
 EXPORT_SYMBOL_GPL(ata_host_intr);
 EXPORT_SYMBOL_GPL(ata_dev_classify);
include/linux/libata.h renamed from include/linux/libata.h~remove-libata_msleep +0 -1
diff -puN include/linux/libata.h~remove-libata_msleep include/linux/libata.h
@@ -416,7 +416,6 @@ extern void ata_qc_complete(struct ata_q
 extern void ata_eng_timeout(struct ata_port *ap);
 extern void ata_add_to_probe_list (struct ata_probe_ent *probe_ent);
 extern int ata_std_bios_param(Disk * disk, kdev_t dev, int *ip);
-extern void libata_msleep(unsigned long msecs);
 
 
 static inline unsigned int ata_tag_valid(unsigned int tag)

_

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors