diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-12-06 04:04:48 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-12-23 16:41:31 +0100 |
commit | b25472f9b96159cc0b9b7ed449448805973cd789 (patch) | |
tree | 7963f6d5adc2a82f6f10b4f9cf427ce931f67c76 /drivers/char/nwflash.c | |
parent | don't open-code generic_file_llseek_size() (diff) | |
download | linux-b25472f9b96159cc0b9b7ed449448805973cd789.tar.xz linux-b25472f9b96159cc0b9b7ed449448805973cd789.zip |
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.c | 31 |
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; } |