]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
powerpc/spufs: sputrace: Don't block until the read buffer is full
authorJeremy Kerr <jk@ozlabs.org>
Wed, 15 Oct 2008 02:20:42 +0000 (13:20 +1100)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 21 Oct 2008 00:13:07 +0000 (11:13 +1100)
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 <jk@ozlabs.org>
arch/powerpc/platforms/cell/spufs/sputrace.c

index 50cae0cf0988412db0ec1a0127967f6c2ef4e795..a2460e2e192893e386ae44d6695fb2c52d10a421 100644 (file)
@@ -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)