mirror of https://gitee.com/openkylin/linux.git
carma-fpga: switch to fixed_size_llseek()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
2ec3a12a66
commit
1a37f5ecb7
|
@ -767,26 +767,7 @@ static loff_t fpga_llseek(struct file *filp, loff_t offset, int origin)
|
||||||
if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
|
if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
switch (origin) {
|
return fixed_size_llseek(file, offset, origin, priv->fw_size);
|
||||||
case SEEK_SET: /* seek relative to the beginning of the file */
|
|
||||||
newpos = offset;
|
|
||||||
break;
|
|
||||||
case SEEK_CUR: /* seek relative to current position in the file */
|
|
||||||
newpos = filp->f_pos + offset;
|
|
||||||
break;
|
|
||||||
case SEEK_END: /* seek relative to the end of the file */
|
|
||||||
newpos = priv->fw_size - offset;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check for sanity */
|
|
||||||
if (newpos > priv->fw_size)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
filp->f_pos = newpos;
|
|
||||||
return newpos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations fpga_fops = {
|
static const struct file_operations fpga_fops = {
|
||||||
|
|
Loading…
Reference in New Issue