diff options
author | Steve Wise <swise@opengridcomputing.com> | 2010-09-29 14:21:33 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2010-10-11 23:15:14 -0400 |
commit | 3160977a6e66ea4c4b4f33010f5d04f0004b938c (patch) | |
tree | 233bff2c8bb78f6a0094f597bcfda40e94586a0d /drivers | |
parent | 8bbac892fb75d20fa274ca026e24faf00afbf9dd (diff) |
RDMA/cxgb4: Use simple_read_from_buffer() for debugfs handlers
We can replace our equivalent open-coded version.
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/cxgb4/device.c | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index b25435736d44..22a290d0d5bf 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c | |||
@@ -68,32 +68,8 @@ static ssize_t debugfs_read(struct file *file, char __user *buf, size_t count, | |||
68 | loff_t *ppos) | 68 | loff_t *ppos) |
69 | { | 69 | { |
70 | struct c4iw_debugfs_data *d = file->private_data; | 70 | struct c4iw_debugfs_data *d = file->private_data; |
71 | loff_t pos = *ppos; | ||
72 | loff_t avail = d->pos; | ||
73 | 71 | ||
74 | if (pos < 0) | 72 | return simple_read_from_buffer(buf, count, ppos, d->buf, d->pos); |
75 | return -EINVAL; | ||
76 | if (pos >= avail) | ||
77 | return 0; | ||
78 | if (count > avail - pos) | ||
79 | count = avail - pos; | ||
80 | |||
81 | while (count) { | ||
82 | size_t len = 0; | ||
83 | |||
84 | len = min((int)count, (int)d->pos - (int)pos); | ||
85 | if (copy_to_user(buf, d->buf + pos, len)) | ||
86 | return -EFAULT; | ||
87 | if (len == 0) | ||
88 | return -EINVAL; | ||
89 | |||
90 | buf += len; | ||
91 | pos += len; | ||
92 | count -= len; | ||
93 | } | ||
94 | count = pos - *ppos; | ||
95 | *ppos = pos; | ||
96 | return count; | ||
97 | } | 73 | } |
98 | 74 | ||
99 | static int dump_qp(int id, void *p, void *data) | 75 | static int dump_qp(int id, void *p, void *data) |