summaryrefslogtreecommitdiff
path: root/drivers/char/nwflash.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-12-05 22:04:48 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-12-23 10:41:31 -0500
commitb25472f9b96159cc0b9b7ed449448805973cd789 (patch)
tree7963f6d5adc2a82f6f10b4f9cf427ce931f67c76 /drivers/char/nwflash.c
parentb808b1d632f6915e4d6b1badb927b2c970ad11bb (diff)
new helpers: no_seek_end_llseek{,_size}()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/char/nwflash.c')
-rw-r--r--drivers/char/nwflash.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c
index e371480d3639..dbe598de9b74 100644
--- a/drivers/char/nwflash.c
+++ b/drivers/char/nwflash.c
@@ -277,36 +277,7 @@ static loff_t flash_llseek(struct file *file, loff_t offset, int orig)
printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n",
(unsigned int) offset, orig);
- switch (orig) {
- case 0:
- if (offset < 0) {
- ret = -EINVAL;
- break;
- }
-
- if ((unsigned int) offset > gbFlashSize) {
- ret = -EINVAL;
- break;
- }
-
- file->f_pos = (unsigned int) offset;
- ret = file->f_pos;
- break;
- case 1:
- if ((file->f_pos + offset) > gbFlashSize) {
- ret = -EINVAL;
- break;
- }
- if ((file->f_pos + offset) < 0) {
- ret = -EINVAL;
- break;
- }
- file->f_pos += offset;
- ret = file->f_pos;
- break;
- default:
- ret = -EINVAL;
- }
+ ret = no_seek_end_llseek_size(file, offset, orig, gbFlashSize);
mutex_unlock(&flash_mutex);
return ret;
}