diff mbox

Locking in Siano driver (untested)

Message ID 4AFC34CC.1060204@tangobravo.co.uk (mailing list archive)
State Superseded
Headers show

Commit Message

Tim Borgeaud Nov. 12, 2009, 4:16 p.m. UTC
None
diff mbox

Patch

--- smscoreapi.c.orig	2009-11-11 11:22:44.000000000 +0000
+++ smscoreapi.c	2009-11-12 16:02:25.000000000 +0000
@@ -1120,8 +1120,11 @@ 
 
 	prepare_to_wait(&coredev->buffer_mng_waitq, &wait, TASK_INTERRUPTIBLE);
 
-	if (list_empty(&coredev->buffers))
+	if (list_empty(&coredev->buffers)) {
+		spin_unlock_irqrestore(&coredev->bufferslock, flags);
 		schedule();
+		spin_lock_irqsave(&coredev->bufferslock, flags);
+	}
 
 	finish_wait(&coredev->buffer_mng_waitq, &wait);
 
@@ -1144,8 +1147,14 @@ 
  */
 void smscore_putbuffer(struct smscore_device_t *coredev,
 		struct smscore_buffer_t *cb) {
+	unsigned long flags;
+
+	spin_lock_irqsave(&coredev->bufferslock, flags);
+
+	list_add(&cb->entry, &coredev->buffers);
 	wake_up_interruptible(&coredev->buffer_mng_waitq);
-	list_add_locked(&cb->entry, &coredev->buffers, &coredev->bufferslock);
+
+	spin_unlock_irqrestore(&coredev->bufferslock, flags);
 }
 EXPORT_SYMBOL_GPL(smscore_putbuffer);