linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* semaphores in 2.3.3
@ 1999-05-24 18:15 Oliver Neukum
  1999-05-24 17:00 ` Martin Costabel
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 1999-05-24 18:15 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 606 bytes --]

Hi,

as you may have noticed linux-2.3.3  doesn't compile on powerpc due to
changes in semaphores and waitqueues. This means that ppc is again at a
disadvantage.
I hope for ppc to become one of the stable ports.
I've attached a patch that ports the basic change from i386 to ppc.
As yet, the kernel will not compile. It needs to include semaphore.h at a
few places. In addition i've found ide-pmac.c and adbmouse.c to be broken.

People, this can't be that hard.

Regards

Oliver Neukum

PS: It assumes the changes needed to compile 2.2.8 have been made.

PPS:What is the reason IrDA isn't there for ppc ?

[-- Attachment #2: ppc233patch --]
[-- Type: application/octet-stream, Size: 1900 bytes --]

--- include/asm-ppc/semaphore.h.alt	Mon May 24 15:16:03 1999
+++ include/asm-ppc/semaphore.h	Mon May 24 17:16:08 1999
@@ -9,6 +9,7 @@
  */
 
 #include <asm/atomic.h>
+#include <linux/wait.h>
 
 struct semaphore {
 	atomic_t count;
@@ -16,17 +17,42 @@
 	wait_queue_head_t wait;
 };
 
-#define sema_init(sem, val)	atomic_set(&((sem)->count), (val))
-
-#define MUTEX		((struct semaphore) \
-			 { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL })
-#define MUTEX_LOCKED	((struct semaphore) \
-			 { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL })
+#define __SEM_DEBUG_INIT(name)
 
 extern void __down(struct semaphore * sem);
 extern int  __down_interruptible(struct semaphore * sem);
 extern int  __down_trylock(struct semaphore * sem);
 extern void __up(struct semaphore * sem);
+
+#define __SEMAPHORE_INITIALIZER(name,count) \
+{ ATOMIC_INIT(count), 0,__WAITQUEUE_HEAD_INITIALIZER((name).wait) \
+	__SEM_DEBUG_INIT(name) }
+
+#define __MUTEX_INITIALIZER(name) \
+	__SEMAPHORE_INITIALIZER(name,1)
+
+#define __DECLARE_SEMAPHORE_GENERIC(name,count) \
+	struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
+
+#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
+#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
+
+extern inline void sema_init (struct semaphore *sem, int val)
+{
+atomic_set(&sem->count, val);
+atomic_set(&sem->waking, 0);
+init_waitqueue_head(&sem->wait);
+}
+
+static inline void init_MUTEX (struct semaphore *sem)
+{
+	sema_init(sem, 1);
+}
+
+static inline void init_MUTEX_LOCKED (struct semaphore *sem)
+{
+	sema_init(sem, 0);
+}
 
 extern inline void down(struct semaphore * sem)
 {
--- kernel/fork.c.alt	Mon May 24 15:01:26 1999
+++ kernel/fork.c	Mon May 24 17:10:47 1999
@@ -21,6 +21,7 @@
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
 #include <asm/uaccess.h>
+#include <asm/semaphore.h>
 
 /* The idle tasks do not count.. */
 int nr_tasks=0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-05-24 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-05-24 18:15 semaphores in 2.3.3 Oliver Neukum
1999-05-24 17:00 ` Martin Costabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).