diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-07-24 00:28:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:24 -0400 |
commit | ed62f77bb631bc4a2d8acb0521b720cb55e58183 (patch) | |
tree | 0059c770e8c3264bc93e3bf2dbc09f928cf8b01c /arch/cris | |
parent | d50004b0867a59f8a81116f000edb352595343d9 (diff) |
cris: use simple_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/cris')
-rw-r--r-- | arch/cris/kernel/profile.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c index 44f7b4f79476..9aa571169bcc 100644 --- a/arch/cris/kernel/profile.c +++ b/arch/cris/kernel/profile.c | |||
@@ -35,19 +35,16 @@ read_cris_profile(struct file *file, char __user *buf, | |||
35 | size_t count, loff_t *ppos) | 35 | size_t count, loff_t *ppos) |
36 | { | 36 | { |
37 | unsigned long p = *ppos; | 37 | unsigned long p = *ppos; |
38 | ssize_t ret; | ||
38 | 39 | ||
39 | if (p > SAMPLE_BUFFER_SIZE) | 40 | ret = simple_read_from_buffer(buf, count, ppos, sample_buffer, |
40 | return 0; | 41 | SAMPLE_BUFFER_SIZE); |
42 | if (ret < 0) | ||
43 | return ret; | ||
41 | 44 | ||
42 | if (p + count > SAMPLE_BUFFER_SIZE) | 45 | memset(sample_buffer + p, 0, ret); |
43 | count = SAMPLE_BUFFER_SIZE - p; | ||
44 | if (copy_to_user(buf, sample_buffer + p,count)) | ||
45 | return -EFAULT; | ||
46 | 46 | ||
47 | memset(sample_buffer + p, 0, count); | 47 | return ret; |
48 | *ppos += count; | ||
49 | |||
50 | return count; | ||
51 | } | 48 | } |
52 | 49 | ||
53 | static ssize_t | 50 | static ssize_t |