* [PATCH] RDMA/cxgb4: use simple_read_from_buffer() for debugfs handlers.
@ 2010-09-29 18:21 Steve Wise
0 siblings, 0 replies; only message in thread
From: Steve Wise @ 2010-09-29 18:21 UTC (permalink / raw)
To: rdreier-FYB4Gu1CFyUAvxtiuMwx3w, stable-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-next-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---
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 b254357..22a290d 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,
loff_t *ppos)
{
struct c4iw_debugfs_data *d = file->private_data;
- loff_t pos = *ppos;
- loff_t avail = d->pos;
- if (pos < 0)
- return -EINVAL;
- if (pos >= avail)
- return 0;
- if (count > avail - pos)
- count = avail - pos;
-
- while (count) {
- size_t len = 0;
-
- len = min((int)count, (int)d->pos - (int)pos);
- if (copy_to_user(buf, d->buf + pos, len))
- return -EFAULT;
- if (len == 0)
- return -EINVAL;
-
- buf += len;
- pos += len;
- count -= len;
- }
- count = pos - *ppos;
- *ppos = pos;
- return count;
+ return simple_read_from_buffer(buf, count, ppos, d->buf, d->pos);
}
static int dump_qp(int id, void *p, void *data)
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-09-29 18:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-29 18:21 [PATCH] RDMA/cxgb4: use simple_read_from_buffer() for debugfs handlers Steve Wise
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).