summaryrefslogtreecommitdiff
path: root/drivers/staging/vme
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-08-19 11:28:35 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-10-09 02:39:05 -0400
commit594822918de20bf3a50afbc4de65b6f2971a92db (patch)
treeec093e00455932ff726b9a5fcec31d6759a3a0fb /drivers/staging/vme
parent91360b02ab483fc96a70b8c3016838f5d3725f99 (diff)
vme: don't open-code fixed_size_llseek()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/staging/vme')
-rw-r--r--drivers/staging/vme/devices/vme_user.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c
index 920e50addd3e..cdd2ff7999e9 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -410,41 +410,19 @@ static ssize_t vme_user_write(struct file *file, const char __user *buf,
static loff_t vme_user_llseek(struct file *file, loff_t off, int whence)
{
- loff_t absolute = -1;
unsigned int minor = MINOR(file_inode(file)->i_rdev);
size_t image_size;
+ loff_t res;
if (minor == CONTROL_MINOR)
return -EINVAL;
mutex_lock(&image[minor].mutex);
image_size = vme_get_size(image[minor].resource);
-
- switch (whence) {
- case SEEK_SET:
- absolute = off;
- break;
- case SEEK_CUR:
- absolute = file->f_pos + off;
- break;
- case SEEK_END:
- absolute = image_size + off;
- break;
- default:
- mutex_unlock(&image[minor].mutex);
- return -EINVAL;
- }
-
- if ((absolute < 0) || (absolute >= image_size)) {
- mutex_unlock(&image[minor].mutex);
- return -EINVAL;
- }
-
- file->f_pos = absolute;
-
+ res = fixed_size_llseek(file, off, whence, image_size);
mutex_unlock(&image[minor].mutex);
- return absolute;
+ return res;
}
/*