From: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public•gmane.org>
To: rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public•gmane.org,
stable-DgEjT+Ai2ygdnm+yROfE0A@public•gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
linux-next-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
Subject: [PATCH] RDMA/cxgb4: use simple_read_from_buffer() for debugfs handlers.
Date: Wed, 29 Sep 2010 13:21:33 -0500 [thread overview]
Message-ID: <20100929182133.30260.84058.stgit@build.ogc.int> (raw)
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
reply other threads:[~2010-09-29 18:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100929182133.30260.84058.stgit@build.ogc.int \
--to=swise-7bpotxp6k4+p2yhjcf5u+vpxobypeauw@public$(echo .)gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
--cc=linux-next-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
--cc=rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public$(echo .)gmane.org \
--cc=stable-DgEjT+Ai2ygdnm+yROfE0A@public$(echo .)gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox