[prev in list] [next in list] [prev in thread] [next in thread]
List: git-commits-head
Subject: IB/hfi1: Use kernel default llseek for ui device
From: "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date: 2016-04-30 0:48:59
Message-ID: 20160430004859.3CC5B660F65 () gitolite ! kernel ! org
[Download RAW message or body]
Web: https://git.kernel.org/torvalds/c/7723d8c2445c4dfa91f8df42703b56f8ade59af7
Commit: 7723d8c2445c4dfa91f8df42703b56f8ade59af7
Parent: 94158442eb0c66bbb0b733999e108fa26a7673ef
Refname: refs/heads/master
Author: Dean Luick <dean.luick@intel.com>
AuthorDate: Fri Apr 22 11:17:03 2016 -0700
Committer: Doug Ledford <dledford@redhat.com>
CommitDate: Thu Apr 28 12:00:39 2016 -0400
IB/hfi1: Use kernel default llseek for ui device
The ui device llseek had a mistake with SEEK_END and did
not fully follow seek semantics. Correct all this by
using a kernel supplied function for fixed size devices.
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
---
drivers/staging/rdma/hfi1/file_ops.c | 25 ++-----------------------
1 file changed, 2 insertions(+), 23 deletions(-)
diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c
index ec6c226..5415295 100644
--- a/drivers/staging/rdma/hfi1/file_ops.c
+++ b/drivers/staging/rdma/hfi1/file_ops.c
@@ -1559,29 +1559,8 @@ static loff_t ui_lseek(struct file *filp, loff_t offset, int whence)
{
struct hfi1_devdata *dd = filp->private_data;
- switch (whence) {
- case SEEK_SET:
- break;
- case SEEK_CUR:
- offset += filp->f_pos;
- break;
- case SEEK_END:
- offset = ((dd->kregend - dd->kregbase) + DC8051_DATA_MEM_SIZE) -
- offset;
- break;
- default:
- return -EINVAL;
- }
-
- if (offset < 0)
- return -EINVAL;
-
- if (offset >= (dd->kregend - dd->kregbase) + DC8051_DATA_MEM_SIZE)
- return -EINVAL;
-
- filp->f_pos = offset;
-
- return filp->f_pos;
+ return fixed_size_llseek(filp, offset, whence,
+ (dd->kregend - dd->kregbase) + DC8051_DATA_MEM_SIZE);
}
/* NOTE: assumes unsigned long is 8 bytes */
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic