fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / asm-s390 / semaphore.h
index 702cf43..dbce058 100644 (file)
@@ -37,7 +37,8 @@ struct semaphore {
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
-       *sem = (struct semaphore) __SEMAPHORE_INITIALIZER((*sem),val);
+       atomic_set(&sem->count, val);
+       init_waitqueue_head(&sem->wait);
 }
 
 static inline void init_MUTEX (struct semaphore *sem)
@@ -84,17 +85,17 @@ static inline int down_trylock(struct semaphore * sem)
         *       sem->count.counter = --new_val;
         * In the ppc code this is called atomic_dec_if_positive.
         */
-       __asm__ __volatile__ (
-               "   l    %0,0(%3)\n"
-               "0: ltr  %1,%0\n"
-               "   jle  1f\n"
-               "   ahi  %1,-1\n"
-               "   cs   %0,%1,0(%3)\n"
-               "   jl   0b\n"
+       asm volatile(
+               "       l       %0,0(%3)\n"
+               "0:     ltr     %1,%0\n"
+               "       jle     1f\n"
+               "       ahi     %1,-1\n"
+               "       cs      %0,%1,0(%3)\n"
+               "       jl      0b\n"
                "1:"
                : "=&d" (old_val), "=&d" (new_val), "=m" (sem->count.counter)
                : "a" (&sem->count.counter), "m" (sem->count.counter)
-               : "cc", "memory" );
+               : "cc", "memory");
        return old_val <= 0;
 }