[PATCH] msp3400 (bttv), new semaphores

Harald Hoyer (Harald.Hoyer@hot.spotline.de)
Thu, 21 Jan 1999 11:46:46 +0100


This is a multi-part message in MIME format.
--------------57FCBD9B6ED0551767E82175
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi,

msp3400 uses a semaphore to sleep. With the new owner, owner_depth scheme
introduced in pre8 this does not function anymore the way it did. The function
wanted can be regained with the patch attached. It reinitializes the semaphore
and therefore it zero's the owner field.

Linus, is this change wanted? Will it remain the way it is now? Are there other
places where semaphores are used this way? Will they show up before 2.2 is
released? Should the new semaphore scheme with owners be renamed to owner_down
and owner_down_interruptible?

Without the patch it goes like this:

msp_thread:
calls down

other:
calls up

msp_thread:
wakes up
sets owner and owner_depth
does useful things

msp_thread:
loop:
calls down
wakes up immediatly because owner == this_thread && owner_depth
does random things, eat cpu
goto loop

--
»»»» Harald Hoyer ««»» mailto:HarryH@Royal.Net ««»» http://hot.spotline.de ««««
···············································································
Algol-60 surely must be regarded as the most important programming language
yet developed.
                -- T. Cheatham
--------------57FCBD9B6ED0551767E82175
Content-Type: text/plain; charset=us-ascii;
 name="msp.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="msp.patch"

--- drivers/char/msp3400.c.old Thu Jan 21 11:29:14 1999 +++ drivers/char/msp3400.c Thu Jan 21 11:29:26 1999 @@ -543,7 +543,8 @@ goto done; if (debug > 1) printk("msp3400: thread: sleep\n"); - down_interruptible(&sem); + down_interruptible(&sem); + sem = MUTEX_LOCKED; if (debug > 1) printk("msp3400: thread: wakeup\n"); if (msp->rmmod || signal_pending(current))

--------------57FCBD9B6ED0551767E82175--

- 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/