diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2008-10-14 22:20:42 -0400 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2008-10-20 20:13:07 -0400 |
commit | e869446bb6db209e6092f7cba6cdfc2a5e637177 (patch) | |
tree | be2506f59efce3c5cd6d5a847ae40ea7657c2bb5 /arch | |
parent | baf399273f2ea38e2fcbd4d0b6cc7ba7f7db43eb (diff) |
powerpc/spufs: sputrace: Don't block until the read buffer is full
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/sputrace.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sputrace.c b/arch/powerpc/platforms/cell/spufs/sputrace.c index 50cae0cf0988..a2460e2e1928 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, | |||
80 | char tbuf[128]; | 80 | char tbuf[128]; |
81 | int width; | 81 | int width; |
82 | 82 | ||
83 | /* If we have data ready to return, don't block waiting | ||
84 | * for more */ | ||
85 | if (cnt > 0 && sputrace_used() == 0) | ||
86 | break; | ||
87 | |||
83 | error = wait_event_interruptible(sputrace_wait, | 88 | error = wait_event_interruptible(sputrace_wait, |
84 | sputrace_used() > 0); | 89 | sputrace_used() > 0); |
85 | if (error) | 90 | if (error) |