lkml.org 
[lkml]   [1999]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] fix for locks.h example
Hi!

I can see that the file include/asm-i386/locks.h is not currently used in
the kernel. I assume that it is kept in there just as an example for
implementing spinlocks. However, it contains two bugs which the patch
below fixes.

--- include/asm-i386/locks.h Sat Nov 29 19:33:21 1997
+++ include/asm-i386/locks.h.new Mon Jan 11 13:25:18 1999
@@ -62,7 +62,7 @@
not be safe this way */
if(!--sp->users)
{
- lock_clear_bit(0,&sp->lock);sp->cpu= NO_PROC_ID;
+ sp->cpu=NO_PROC_ID;lock_clear_bit(0,&sp->lock);
return 1;
}
return 0;
@@ -102,15 +102,17 @@

extern __inline__ void spinunlock(struct spinlock *sp)
{
+ int pri;
if(current->lock_order!=sp->priority)
panic("lock release order violation %s (%d)\n", sp->name, current->lock_order);
+ pri=sp->oldpri;
if(prim_spin_unlock(sp))
{
/*
* Update the debugging lock priority chain. We dumped
* our last right to the lock.
*/
- current->lock_order=sp->oldpri;
+ current->lock_order=pri;
}
}

Patrik



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.060 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site