[PATCH 5/8] mtd: mtdraw: add raw page size to private data

Sam Ravnborg sam at ravnborg.org
Fri Sep 21 07:42:40 PDT 2018


Hi Sascha.

On Fri, Sep 21, 2018 at 01:18:17PM +0200, Sascha Hauer wrote:
> The raw page size is used many times in the driver, so add a variable
> to the private data instead of calculating it each time again.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  drivers/mtd/mtdraw.c | 40 ++++++++++++++++++++--------------------
>  1 file changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
> index 089dc54eb4..6518ae34d5 100644
> --- a/drivers/mtd/mtdraw.c
> +++ b/drivers/mtd/mtdraw.c
> @@ -48,6 +48,7 @@
>   * @write_fill: number of bytes in writebuf
>   * @write_ofs: offset in character device (mtdraw) where last write(s) stored
>   * bytes because of unaligned writes (ie. remain of writesize+oobsize write)
> + * @rps: raw page size (data + oob)
>From the code I would say that a (writesize + oobsize) was more correct.
Like we use in the line above too.

> @@ -131,12 +132,11 @@ static ssize_t mtdraw_read(struct cdev *cdev, void *buf, size_t count,
>  	int skip;
>  
>  	numblock = mtdraw_offset_to_block(mtdraw, offset);
> -	skip = offset - numblock * (mtd->writesize + mtd->oobsize);
> +	skip = offset - numblock * (mtdraw->rps);

Here the () can be dropped.


	Sam



More information about the barebox mailing list