From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Jonathan Corbet <corbet@lwn.net>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
Tony Lindgren <tony@atomide.com>,
Aaro Koskinen <aaro.koskinen@iki.fi>,
linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
linux-mtd@lists.infradead.org, linux-doc@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 08/12] mtd: rawnand: ams-delta: Simplify pointer resolution on read/write
Date: Tue, 7 Aug 2018 19:02:56 +0200 [thread overview]
Message-ID: <20180807190256.092b2364@bbrezillon> (raw)
In-Reply-To: <20180806222918.12644-9-jmkrzyszt@gmail.com>
On Tue, 7 Aug 2018 00:29:14 +0200
Janusz Krzysztofik <jmkrzyszt@gmail.com> wrote:
> Simplify data read/write sub-functions by changing their APIs so they
> accept driver private structure pointer instead of mtd_info.
>
> Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Can you move that one earlier in the series so that it can be applied
even if we're still discussing the GPIO bitmap changes?
> ---
> drivers/mtd/nand/raw/ams-delta.c | 40 ++++++++++++++++++++++------------------
> 1 file changed, 22 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c
> index d02c48c013e8..30c461138195 100644
> --- a/drivers/mtd/nand/raw/ams-delta.c
> +++ b/drivers/mtd/nand/raw/ams-delta.c
> @@ -76,10 +76,8 @@ static void ams_delta_write_commit(struct ams_delta_nand *priv)
> gpiod_set_value(priv->gpiod_nwe, 1);
> }
>
> -static void ams_delta_write_next_byte(struct mtd_info *mtd, u_char byte)
> +static void ams_delta_write_next_byte(struct ams_delta_nand *priv, u_char byte)
> {
> - struct nand_chip *this = mtd_to_nand(mtd);
> - struct ams_delta_nand *priv = nand_get_controller_data(this);
> struct gpio_descs *data_gpiods = priv->data_gpiods;
> unsigned long bits = byte;
> int i, value_array[data_gpiods->ndescs];
> @@ -93,10 +91,8 @@ static void ams_delta_write_next_byte(struct mtd_info *mtd, u_char byte)
> ams_delta_write_commit(priv);
> }
>
> -static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte)
> +static void ams_delta_write_first_byte(struct ams_delta_nand *priv, u_char byte)
> {
> - struct nand_chip *this = mtd_to_nand(mtd);
> - struct ams_delta_nand *priv = nand_get_controller_data(this);
> struct gpio_descs *data_gpiods = priv->data_gpiods;
> unsigned long bits = byte;
> int i;
> @@ -108,10 +104,8 @@ static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte)
> ams_delta_write_commit(priv);
> }
>
> -static u_char ams_delta_read_next_byte(struct mtd_info *mtd)
> +static u_char ams_delta_read_next_byte(struct ams_delta_nand *priv)
> {
> - struct nand_chip *this = mtd_to_nand(mtd);
> - struct ams_delta_nand *priv = nand_get_controller_data(this);
> struct gpio_descs *data_gpiods = priv->data_gpiods;
> unsigned long bits = 0;
> int i, value_array[data_gpiods->ndescs];
> @@ -131,38 +125,48 @@ static u_char ams_delta_read_next_byte(struct mtd_info *mtd)
> return bits;
> }
>
> -static u_char ams_delta_read_byte(struct mtd_info *mtd)
> +static u_char ams_delta_read_first_byte(struct ams_delta_nand *priv)
> {
> - struct nand_chip *this = mtd_to_nand(mtd);
> - struct ams_delta_nand *priv = nand_get_controller_data(this);
> struct gpio_descs *data_gpiods = priv->data_gpiods;
> int i;
>
> for (i = 0; i < data_gpiods->ndescs; i++)
> gpiod_direction_input(data_gpiods->desc[i]);
>
> - return ams_delta_read_next_byte(mtd);
> + return ams_delta_read_next_byte(priv);
> +}
> +
> +static u_char ams_delta_read_byte(struct mtd_info *mtd)
> +{
> + struct nand_chip *this = mtd_to_nand(mtd);
> + struct ams_delta_nand *priv = nand_get_controller_data(this);
> +
> + return ams_delta_read_first_byte(priv);
> }
>
> static void ams_delta_write_buf(struct mtd_info *mtd, const u_char *buf,
> int len)
> {
> + struct nand_chip *this = mtd_to_nand(mtd);
> + struct ams_delta_nand *priv = nand_get_controller_data(this);
> int i;
>
> if (len > 0)
> - ams_delta_write_byte(mtd, buf[0]);
> + ams_delta_write_first_byte(priv, buf[0]);
> for (i = 1; i < len; i++)
> - ams_delta_write_next_byte(mtd, buf[i]);
> + ams_delta_write_next_byte(priv, buf[i]);
> }
>
> static void ams_delta_read_buf(struct mtd_info *mtd, u_char *buf, int len)
> {
> + struct nand_chip *this = mtd_to_nand(mtd);
> + struct ams_delta_nand *priv = nand_get_controller_data(this);
> int i;
>
> if (len > 0)
> - buf[0] = ams_delta_read_byte(mtd);
> + buf[0] = ams_delta_read_first_byte(priv);
> for (i = 1; i < len; i++)
> - buf[i] = ams_delta_read_next_byte(mtd);
> + buf[i] = ams_delta_read_next_byte(priv);
> }
>
> /*
> @@ -186,7 +190,7 @@ static void ams_delta_hwcontrol(struct mtd_info *mtd, int cmd,
> }
>
> if (cmd != NAND_CMD_NONE)
> - ams_delta_write_byte(mtd, cmd);
> + ams_delta_write_first_byte(priv, cmd);
> }
>
> static int ams_delta_nand_ready(struct mtd_info *mtd)
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-08-07 17:03 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180718235710.18242-1-jmkrzyszt@gmail.com>
2018-08-06 22:29 ` [RFC PATCH v2] mtd: rawnand: ams-delta: Use GPIO API for data I/O Janusz Krzysztofik
2018-08-06 22:29 ` [RFC PATCH v2 01/12] mtd: rawnand: ams-delta: Assign mtd->dev.parent, not mtd->owner Janusz Krzysztofik
2018-08-06 23:54 ` Marek Vasut
2018-08-07 21:55 ` Janusz Krzysztofik
2018-08-07 16:57 ` Boris Brezillon
2018-08-06 22:29 ` [RFC PATCH v2 02/12] mtd: rawnand: ams-delta: Use private structure Janusz Krzysztofik
2018-08-07 16:59 ` Boris Brezillon
2018-08-06 22:29 ` [RFC PATCH v2 03/12] ARM: OMAP1: ams-delta: Provide GPIO lookup table for NAND data port Janusz Krzysztofik
2018-08-07 16:59 ` Boris Brezillon
2018-08-10 10:10 ` Linus Walleij
2018-08-06 22:29 ` [RFC PATCH v2 04/12] mtd: rawnand: ams-delta: request data port GPIO resource Janusz Krzysztofik
2018-08-07 17:00 ` Boris Brezillon
2018-08-10 10:11 ` Linus Walleij
2018-08-06 22:29 ` [RFC PATCH v2 05/12] mtd: rawnand: ams-delta: use GPIO API for data read/write Janusz Krzysztofik
2018-08-06 23:57 ` Marek Vasut
2018-08-07 17:06 ` Boris Brezillon
2018-08-07 17:11 ` Janusz Krzysztofik
2018-08-10 10:25 ` Linus Walleij
2018-08-06 22:29 ` [RFC PATCH v2 06/12] ARM: OMAP1: ams-delta: drop obsolete NAND resources Janusz Krzysztofik
2018-08-06 22:29 ` [RFC PATCH v2 07/12] mtd: rawnand: ams-delta: Set port direction once per transfer Janusz Krzysztofik
2018-08-07 18:57 ` Boris Brezillon
2018-08-08 16:55 ` Janusz Krzysztofik
2018-08-08 17:42 ` Miquel Raynal
2018-08-06 22:29 ` [RFC PATCH v2 08/12] mtd: rawnand: ams-delta: Simplify pointer resolution on read/write Janusz Krzysztofik
2018-08-07 17:02 ` Boris Brezillon [this message]
2018-08-07 17:15 ` Janusz Krzysztofik
2018-08-06 22:29 ` [RFC PATCH v2 09/12] gpiolib: Identify GPIO descriptor arrays with direct mapping Janusz Krzysztofik
2018-08-06 23:29 ` Linus Walleij
2018-08-07 16:50 ` Janusz Krzysztofik
2018-08-07 17:10 ` Boris Brezillon
2018-08-07 17:14 ` Boris Brezillon
2018-08-07 17:19 ` Janusz Krzysztofik
2018-08-06 22:29 ` [RFC PATCH v2 10/12] gpiolib: Introduce bitmap get/set array API extension Janusz Krzysztofik
2018-08-06 22:29 ` [RFC PATCH v2 11/12] mtd: rawnand: ams-delta: Use GPIO API bitmap extension Janusz Krzysztofik
2018-08-06 22:29 ` [RFC PATCH v2 12/12] gpiolib: Add fast processing path to bitmap API functions Janusz Krzysztofik
2018-08-06 23:43 ` Linus Walleij
2018-08-07 17:29 ` Janusz Krzysztofik
2018-08-07 17:47 ` Boris Brezillon
2018-08-10 10:55 ` Linus Walleij
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=20180807190256.092b2364@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=aaro.koskinen@iki.fi \
--cc=computersforpeace@gmail.com \
--cc=corbet@lwn.net \
--cc=dwmw2@infradead.org \
--cc=jmkrzyszt@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=tony@atomide.com \
/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;
as well as URLs for NNTP newsgroup(s).