From: Al Viro Date: Tue, 19 Aug 2014 16:08:37 +0000 (-0400) Subject: carma-fpga: switch to simple_read_from_buffer() X-Git-Tag: v3.18-rc1~76^2~27 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=d88c242623e90c99864317baae1e192bece2af57;p=~emulex%2Finfiniband.git carma-fpga: switch to simple_read_from_buffer() Signed-off-by: Al Viro --- diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c index f390deeae3c..7e97e53f9ff 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, loff_t *f_pos) { struct fpga_dev *priv = filp->private_data; - - count = min_t(size_t, priv->bytes - *f_pos, count); - if (copy_to_user(buf, priv->vb.vaddr + *f_pos, count)) - return -EFAULT; - - *f_pos += count; - return count; + return simple_read_from_buffer(buf, count, ppos, + priv->vb.vaddr, priv->bytes); } static loff_t fpga_llseek(struct file *filp, loff_t offset, int origin)