From patchwork Mon Jun 7 13:00:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zidlicky X-Patchwork-Id: 104763 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o57CwBsi017779 for ; Mon, 7 Jun 2010 12:58:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753661Ab0FGM5v (ORCPT ); Mon, 7 Jun 2010 08:57:51 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:50615 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752006Ab0FGM5u (ORCPT ); Mon, 7 Jun 2010 08:57:50 -0400 Received: by wwe15 with SMTP id 15so364115wwe.19 for ; Mon, 07 Jun 2010 05:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=CAjUUsNz6/ABWv9rImxU5W+fGXyJ+hW1/rAjC7cnyQc=; b=GCBhnECtgDJOtgWclTxP32bpYUUo1GzwM0izH3LRsC2Qlyix1zgJ73BIFxcT+ew8hM VS2uAmrcRgjvPV7oMmQ9BW8AzVE5rpLdyPeTIAE2cdzNVhyuZlG+WUJfe0O9zww25kwb l02niBrTYtRY1IpgWfLkqW0Dz1x0K3A6eeFOA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=i/it+O45Jgp2AcizCsr9ZXnyJr3f55elP0zhtSk5QcGaLsPCd01peilBV55Ziz3TB2 ZpRXlZ5JQZ0hVkNgPr0pi9MC15tbhVz5gsBjwi2jYihddoceeP4L/gtL2y0QyLg4a1zo FAazsNj8tzxxyJUx0FmT27MdXbU3HpdIX7Usc= Received: by 10.227.69.21 with SMTP id x21mr2900105wbi.103.1275915456950; Mon, 07 Jun 2010 05:57:36 -0700 (PDT) Received: from localhost.localdomain ([82.113.106.188]) by mx.google.com with ESMTPS id u36sm37682179wbv.0.2010.06.07.05.57.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 07 Jun 2010 05:57:35 -0700 (PDT) Received: from rz by localhost.localdomain with local (Exim 4.69) (envelope-from ) id 1OLbwe-0004Fx-NE; Mon, 07 Jun 2010 15:00:48 +0200 Date: Mon, 7 Jun 2010 15:00:48 +0200 From: Richard Zidlicky To: Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH 2.6.34] schedule inside spin_lock_irqsave Message-ID: <20100607130048.GA6857@linux-m68k.org> References: <20100530145240.GA21559@linux-m68k.org> <4C028336.8030704@gmail.com> <20100606124302.GA10119@linux-m68k.org> <4C0BE03C.8000709@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4C0BE03C.8000709@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 07 Jun 2010 12:58:11 +0000 (UTC) --- linux-2.6.34/drivers/media/dvb/siano/smscoreapi.c.rz 2010-06-03 21:58:11.000000000 +0200 +++ linux-2.6.34/drivers/media/dvb/siano/smscoreapi.c 2010-06-07 14:32:06.000000000 +0200 @@ -1100,31 +1100,26 @@ * * @return pointer to descriptor on success, NULL on error. */ -struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev) + +struct smscore_buffer_t *get_entry(struct smscore_device_t *coredev) { struct smscore_buffer_t *cb = NULL; unsigned long flags; - DEFINE_WAIT(wait); - spin_lock_irqsave(&coredev->bufferslock, flags); - - /* This function must return a valid buffer, since the buffer list is - * finite, we check that there is an available buffer, if not, we wait - * until such buffer become available. - */ - - prepare_to_wait(&coredev->buffer_mng_waitq, &wait, TASK_INTERRUPTIBLE); - - if (list_empty(&coredev->buffers)) - schedule(); - - finish_wait(&coredev->buffer_mng_waitq, &wait); - + if (!list_empty(&coredev->buffers)) { cb = (struct smscore_buffer_t *) coredev->buffers.next; list_del(&cb->entry); - + } spin_unlock_irqrestore(&coredev->bufferslock, flags); + return cb; +} + +struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev) +{ + struct smscore_buffer_t *cb = NULL; + + wait_event(coredev->buffer_mng_waitq, (cb = get_entry(coredev))); return cb; }