From: Sam Ravnborg <sam@ravnborg.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 5/8] mtd: mtdraw: add raw page size to private data
Date: Fri, 21 Sep 2018 16:42:40 +0200 [thread overview]
Message-ID: <20180921144240.GB14258@ravnborg.org> (raw)
In-Reply-To: <20180921111820.29742-6-s.hauer@pengutronix.de>
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@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
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-09-21 14:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-21 11:18 [PATCH 0/8] mtd: work on mtdraw Sascha Hauer
2018-09-21 11:18 ` [PATCH 1/8] mtd: mtdraw: Simplify error path Sascha Hauer
2018-09-21 11:18 ` [PATCH 2/8] mtd: mtdraw: use dev_* for printing Sascha Hauer
2018-09-21 14:33 ` Sam Ravnborg
2018-09-24 6:51 ` Sascha Hauer
2018-09-21 11:18 ` [PATCH 3/8] mtd: mtdraw: do not write empty buffers Sascha Hauer
2018-09-21 11:18 ` [PATCH 4/8] mtd: mtdraw: pass mtdraw around Sascha Hauer
2018-09-21 11:18 ` [PATCH 5/8] mtd: mtdraw: add raw page size to private data Sascha Hauer
2018-09-21 14:42 ` Sam Ravnborg [this message]
2018-09-24 6:52 ` Sascha Hauer
2018-09-21 11:18 ` [PATCH 6/8] mtd: mtdraw: fail when writing fails Sascha Hauer
2018-09-21 11:18 ` [PATCH 7/8] mtd: mtdraw: replace "block" with "page" Sascha Hauer
2018-09-21 11:18 ` [PATCH 8/8] mtd: mtdraw: fix wrong alignment check Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180921144240.GB14258@ravnborg.org \
--to=sam@ravnborg.org \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox