From patchwork Thu Nov 12 16:16:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Borgeaud X-Patchwork-Id: 59590 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nACGKGem024915 for ; Thu, 12 Nov 2009 16:20:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753279AbZKLQUJ (ORCPT ); Thu, 12 Nov 2009 11:20:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753269AbZKLQUJ (ORCPT ); Thu, 12 Nov 2009 11:20:09 -0500 Received: from auth-1.ukservers.net ([217.10.138.153]:42030 "EHLO auth-1.ukservers.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753233AbZKLQUI (ORCPT ); Thu, 12 Nov 2009 11:20:08 -0500 Received: from hades.syntheticmoon.co.uk (82-71-38-22.dsl.in-addr.zen.co.uk [82.71.38.22]) by auth-1.ukservers.net (Postfix smtp) with ESMTP id 6342036F979F for ; Thu, 12 Nov 2009 16:20:13 +0000 (GMT) Message-ID: <4AFC34CC.1060204@tangobravo.co.uk> Date: Thu, 12 Nov 2009 16:16:12 +0000 From: Tim Borgeaud User-Agent: Thunderbird 2.0.0.21 (X11/20090911) MIME-Version: 1.0 To: linux-media@vger.kernel.org Subject: [PATCH] Locking in Siano driver (untested) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org --- 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);