patch-2.4.4 linux/arch/mips/kernel/semaphore.c

Next file: linux/arch/mips/kernel/setup.c
Previous file: linux/arch/mips/kernel/r6000_fpu.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.3/linux/arch/mips/kernel/semaphore.c linux/arch/mips/kernel/semaphore.c
@@ -127,112 +127,3 @@
 {
 	return waking_non_zero_trylock(sem);
 }
-
-/*
- * RW Semaphores
- */
-void
-__down_read(struct rw_semaphore *sem, int count)
-{
-	DOWN_VAR;
-
- retry_down:
-	if (count < 0) {
-		/* Wait for the lock to become unbiased.  Readers
-		   are non-exclusive.  */
-		
-		/* This takes care of granting the lock.  */
-		up_read(sem);
-
-		add_wait_queue(&sem->wait, &wait);
-		while (atomic_read(&sem->count) < 0) {
-			set_task_state(tsk, TASK_UNINTERRUPTIBLE);
-			if (atomic_read(&sem->count) >= 0)
-				break;
-			schedule();
-		}
-
-		remove_wait_queue(&sem->wait, &wait);
-		tsk->state = TASK_RUNNING;
-
-		mb();
-		count = atomic_dec_return(&sem->count);
-		if (count <= 0)
-			goto retry_down;
-	} else {
-		add_wait_queue(&sem->wait, &wait);
-
-		while (1) {
-			if (test_and_clear_bit(0, &sem->granted))
-				break;
-			set_task_state(tsk, TASK_UNINTERRUPTIBLE);
-			if ((sem->granted & 1) == 0)
-				schedule();
-		}
-
-		remove_wait_queue(&sem->wait, &wait);
-		tsk->state = TASK_RUNNING;
-	}
-}
-
-void
-__down_write(struct rw_semaphore *sem, int count)
-{
-	DOWN_VAR;
-
- retry_down:
-	if (count + RW_LOCK_BIAS < 0) {
-		up_write(sem);
-
-		add_wait_queue_exclusive(&sem->wait, &wait);
-	
-		while (atomic_read(&sem->count) < 0) {
-			set_task_state(tsk, TASK_UNINTERRUPTIBLE);
-			if (atomic_read(&sem->count) >= RW_LOCK_BIAS)
-				break;
-			schedule();
-		}
-
-		remove_wait_queue(&sem->wait, &wait);
-		tsk->state = TASK_RUNNING;
-
-		mb();
-		count = atomic_sub_return(RW_LOCK_BIAS, &sem->count);
-		if (count != 0)
-			goto retry_down;
-	} else {
-		/* Put ourselves at the end of the list.  */
-		add_wait_queue_exclusive(&sem->write_bias_wait, &wait);
-
-		while (1) {
-			if (test_and_clear_bit(1, &sem->granted))
-				break;
-			set_task_state(tsk, TASK_UNINTERRUPTIBLE);
-			if ((sem->granted & 2) == 0)
-				schedule();
-		}
-
-		remove_wait_queue(&sem->write_bias_wait, &wait);
-		tsk->state = TASK_RUNNING;
-
-		/* If the lock is currently unbiased, awaken the sleepers.
-		   FIXME: This wakes up the readers early in a bit of a
-		   stampede -> bad!  */
-		if (atomic_read(&sem->count) >= 0)
-			wake_up(&sem->wait);
-	}
-}
-
-void
-__rwsem_wake(struct rw_semaphore *sem, unsigned long readers)
-{
-	if (readers) {
-		if (test_and_set_bit(0, &sem->granted))
-			BUG();
-		wake_up(&sem->wait);
-	} else {
-		if (test_and_set_bit(1, &sem->granted))
-			BUG();
-		wake_up(&sem->write_bias_wait);
-	}
-}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)