From patchwork Thu Oct 16 00:00:55 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 4651 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 62180DE0BE for ; Thu, 16 Oct 2008 11:01:53 +1100 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: by ozlabs.org (Postfix, from userid 1023) id 9DC42DDEEA; Thu, 16 Oct 2008 11:01:17 +1100 (EST) MIME-Version: 1.0 Message-Id: <1224115255.764574.835386443990.2.gpush@pingu> In-Reply-To: <1224115255.764116.272133018718.0.gpush@pingu> To: From: Jeremy Kerr Date: Thu, 16 Oct 2008 11:00:55 +1100 Subject: [Cbe-oss-dev] [PATCH 2/4] powerpc/spufs: sputrace: don't block until the read buffer is full X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Currently, read() on the sputrace buffer will only return data when the user buffer is exhausted. This may mean that we never see the end of the event log, unless we read() with exactly the right-sized buffer. This change makes sputrace_read not block if we have data ready to return. Signed-off-by: Jeremy Kerr --- arch/powerpc/platforms/cell/spufs/sputrace.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/powerpc/platforms/cell/spufs/sputrace.c b/arch/powerpc/platforms/cell/spufs/sputrace.c index 50cae0c..a2460e2 100644 --- a/arch/powerpc/platforms/cell/spufs/sputrace.c +++ b/arch/powerpc/platforms/cell/spufs/sputrace.c @@ -80,6 +80,11 @@ static ssize_t sputrace_read(struct file *file, char __user *buf, char tbuf[128]; int width; + /* If we have data ready to return, don't block waiting + * for more */ + if (cnt > 0 && sputrace_used() == 0) + break; + error = wait_event_interruptible(sputrace_wait, sputrace_used() > 0); if (error)