public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: Han Xu <han.xu@nxp.com>, Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: nand: gpmi: replace _manual_ swap with swap macro
Date: Thu, 30 Nov 2017 22:16:43 +0100	[thread overview]
Message-ID: <20171130221643.65f79c58@bbrezillon> (raw)
In-Reply-To: <20171103203147.GA28309@embeddedor.com>

On Fri, 3 Nov 2017 15:31:47 -0500
"Gustavo A. R. Silva" <garsilva@embeddedor.com> wrote:

> Make use of the swap macro and remove unnecessary variables swap.
> This makes the code easier to read and maintain.
> 
> This code was detected with the help of Coccinelle.

Applied.

Thanks,

Boris

> 
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index 50f8d4a..9e365d4 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -1487,12 +1487,8 @@ static int gpmi_ecc_read_page_raw(struct mtd_info *mtd,
>  	 * See the layout description for a detailed explanation on why this
>  	 * is needed.
>  	 */
> -	if (this->swap_block_mark) {
> -		u8 swap = tmp_buf[0];
> -
> -		tmp_buf[0] = tmp_buf[mtd->writesize];
> -		tmp_buf[mtd->writesize] = swap;
> -	}
> +	if (this->swap_block_mark)
> +		swap(tmp_buf[0], tmp_buf[mtd->writesize]);
>  
>  	/*
>  	 * Copy the metadata section into the oob buffer (this section is
> @@ -1615,12 +1611,8 @@ static int gpmi_ecc_write_page_raw(struct mtd_info *mtd,
>  	 * See the layout description for a detailed explanation on why this
>  	 * is needed.
>  	 */
> -	if (this->swap_block_mark) {
> -		u8 swap = tmp_buf[0];
> -
> -		tmp_buf[0] = tmp_buf[mtd->writesize];
> -		tmp_buf[mtd->writesize] = swap;
> -	}
> +	if (this->swap_block_mark)
> +		swap(tmp_buf[0], tmp_buf[mtd->writesize]);
>  
>  	chip->write_buf(mtd, tmp_buf, mtd->writesize + mtd->oobsize);
>  

      parent reply	other threads:[~2017-11-30 21:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 20:31 [PATCH] mtd: nand: gpmi: replace _manual_ swap with swap macro Gustavo A. R. Silva
2017-11-03 20:38 ` Han Xu
2017-11-03 21:44   ` Gustavo A. R. Silva
2017-11-30 21:16 ` Boris Brezillon [this message]

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=20171130221643.65f79c58@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=garsilva@embeddedor.com \
    --cc=han.xu@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    /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