diff options
Diffstat (limited to 'drivers/misc/carma/carma-fpga-program.c')
-rw-r--r-- | drivers/misc/carma/carma-fpga-program.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c index 7be89832db19..7e97e53f9ff2 100644 --- a/drivers/misc/carma/carma-fpga-program.c +++ b/drivers/misc/carma/carma-fpga-program.c | |||
@@ -749,13 +749,8 @@ static ssize_t fpga_read(struct file *filp, char __user *buf, size_t count, | |||
749 | loff_t *f_pos) | 749 | loff_t *f_pos) |
750 | { | 750 | { |
751 | struct fpga_dev *priv = filp->private_data; | 751 | struct fpga_dev *priv = filp->private_data; |
752 | 752 | return simple_read_from_buffer(buf, count, ppos, | |
753 | count = min_t(size_t, priv->bytes - *f_pos, count); | 753 | priv->vb.vaddr, priv->bytes); |
754 | if (copy_to_user(buf, priv->vb.vaddr + *f_pos, count)) | ||
755 | return -EFAULT; | ||
756 | |||
757 | *f_pos += count; | ||
758 | return count; | ||
759 | } | 754 | } |
760 | 755 | ||
761 | static loff_t fpga_llseek(struct file *filp, loff_t offset, int origin) | 756 | static loff_t fpga_llseek(struct file *filp, loff_t offset, int origin) |
@@ -767,26 +762,7 @@ static loff_t fpga_llseek(struct file *filp, loff_t offset, int origin) | |||
767 | if ((filp->f_flags & O_ACCMODE) != O_RDONLY) | 762 | if ((filp->f_flags & O_ACCMODE) != O_RDONLY) |
768 | return -EINVAL; | 763 | return -EINVAL; |
769 | 764 | ||
770 | switch (origin) { | 765 | return fixed_size_llseek(file, offset, origin, priv->fw_size); |
771 | case SEEK_SET: /* seek relative to the beginning of the file */ | ||
772 | newpos = offset; | ||
773 | break; | ||
774 | case SEEK_CUR: /* seek relative to current position in the file */ | ||
775 | newpos = filp->f_pos + offset; | ||
776 | break; | ||
777 | case SEEK_END: /* seek relative to the end of the file */ | ||
778 | newpos = priv->fw_size - offset; | ||
779 | break; | ||
780 | default: | ||
781 | return -EINVAL; | ||
782 | } | ||
783 | |||
784 | /* check for sanity */ | ||
785 | if (newpos > priv->fw_size) | ||
786 | return -EINVAL; | ||
787 | |||
788 | filp->f_pos = newpos; | ||
789 | return newpos; | ||
790 | } | 766 | } |
791 | 767 | ||
792 | static const struct file_operations fpga_fops = { | 768 | static const struct file_operations fpga_fops = { |