diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-12-06 02:39:06 (GMT) |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-12-09 18:00:45 (GMT) |
commit | b808b1d632f6915e4d6b1badb927b2c970ad11bb (patch) | |
tree | b3c85ccbb0a685d4beae45598518307624ccb6ac /drivers/char/mbcs.c | |
parent | e1a63bbc40c00d5198b1c1d133b139e962f5e872 (diff) | |
download | linux-b808b1d632f6915e4d6b1badb927b2c970ad11bb.tar.xz |
don't open-code generic_file_llseek_size()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/char/mbcs.c')
-rw-r--r-- | drivers/char/mbcs.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index e5d3e3f..67d4264 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c @@ -26,6 +26,7 @@ #include <linux/uio.h> #include <linux/mutex.h> #include <linux/slab.h> +#include <linux/pagemap.h> #include <asm/io.h> #include <asm/uaccess.h> #include <asm/pgtable.h> @@ -451,31 +452,8 @@ mbcs_sram_write(struct file * fp, const char __user *buf, size_t len, loff_t * o static loff_t mbcs_sram_llseek(struct file * filp, loff_t off, int whence) { - loff_t newpos; - - switch (whence) { - case SEEK_SET: - newpos = off; - break; - - case SEEK_CUR: - newpos = filp->f_pos + off; - break; - - case SEEK_END: - newpos = MBCS_SRAM_SIZE + off; - break; - - default: /* can't happen */ - return -EINVAL; - } - - if (newpos < 0) - return -EINVAL; - - filp->f_pos = newpos; - - return newpos; + return generic_file_llseek_size(filp, off, whence, MAX_LFS_FILESIZE, + MBCS_SRAM_SIZE); } static uint64_t mbcs_pioaddr(struct mbcs_soft *soft, uint64_t offset) |