Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / asm-ia64 / semaphore.h
index 3a2f0f3..f483eeb 100644 (file)
@@ -24,8 +24,6 @@ struct semaphore {
        .wait           = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait)    \
 }
 
-#define __MUTEX_INITIALIZER(name)      __SEMAPHORE_INITIALIZER(name,1)
-
 #define __DECLARE_SEMAPHORE_GENERIC(name,count)                                        \
        struct semaphore name = __SEMAPHORE_INITIALIZER(name, count)
 
@@ -63,7 +61,7 @@ static inline void
 down (struct semaphore *sem)
 {
        might_sleep();
-       if (atomic_dec_return(&sem->count) < 0)
+       if (ia64_fetchadd(-1, &sem->count.counter, acq) < 1)
                __down(sem);
 }
 
@@ -77,7 +75,7 @@ down_interruptible (struct semaphore * sem)
        int ret = 0;
 
        might_sleep();
-       if (atomic_dec_return(&sem->count) < 0)
+       if (ia64_fetchadd(-1, &sem->count.counter, acq) < 1)
                ret = __down_interruptible(sem);
        return ret;
 }
@@ -87,7 +85,7 @@ down_trylock (struct semaphore *sem)
 {
        int ret = 0;
 
-       if (atomic_dec_return(&sem->count) < 0)
+       if (ia64_fetchadd(-1, &sem->count.counter, acq) < 1)
                ret = __down_trylock(sem);
        return ret;
 }
@@ -95,7 +93,7 @@ down_trylock (struct semaphore *sem)
 static inline void
 up (struct semaphore * sem)
 {
-       if (atomic_inc_return(&sem->count) <= 0)
+       if (ia64_fetchadd(1, &sem->count.counter, rel) <= -1)
                __up(sem);
 }