mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-mtd@lists.infradead.org
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	linux-kernel@vger.kernel.org,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Brian Norris <computersforpeace@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>
Subject: [PATCH v2 01/12] mtd: nand: denali: squash setup_ecc_for_xfer() helper into caller
Date: Fri, 22 Sep 2017 12:46:38 +0900	[thread overview]
Message-ID: <1506052009-8285-2-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1506052009-8285-1-git-send-email-yamada.masahiro@socionext.com>

The setup_ecc_for_xfer() is only called from denali_data_xfer().
This helper is small enough, so squash it into the caller.
This looks cleaner to me.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Changes in v2: None

 drivers/mtd/nand/denali.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
index aefdc83..d847ae4 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -208,24 +208,6 @@ static uint32_t denali_check_irq(struct denali_nand_info *denali)
 	return irq_status;
 }
 
-/*
- * This helper function setups the registers for ECC and whether or not
- * the spare area will be transferred.
- */
-static void setup_ecc_for_xfer(struct denali_nand_info *denali, bool ecc_en,
-				bool transfer_spare)
-{
-	int ecc_en_flag, transfer_spare_flag;
-
-	/* set ECC, transfer spare bits if needed */
-	ecc_en_flag = ecc_en ? ECC_ENABLE__FLAG : 0;
-	transfer_spare_flag = transfer_spare ? TRANSFER_SPARE_REG__FLAG : 0;
-
-	/* Enable spare area/ECC per user's request. */
-	iowrite32(ecc_en_flag, denali->reg + ECC_ENABLE);
-	iowrite32(transfer_spare_flag, denali->reg + TRANSFER_SPARE_REG);
-}
-
 static void denali_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
 {
 	struct denali_nand_info *denali = mtd_to_denali(mtd);
@@ -659,7 +641,9 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf,
 static int denali_data_xfer(struct denali_nand_info *denali, void *buf,
 			    size_t size, int page, int raw, int write)
 {
-	setup_ecc_for_xfer(denali, !raw, raw);
+	iowrite32(raw ? 0 : ECC_ENABLE__FLAG, denali->reg + ECC_ENABLE);
+	iowrite32(raw ? TRANSFER_SPARE_REG__FLAG : 0,
+		  denali->reg + TRANSFER_SPARE_REG);
 
 	if (denali->dma_avail)
 		return denali_dma_xfer(denali, buf, size, page, raw, write);
-- 
2.7.4

  reply	other threads:[~2017-09-22  3:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22  3:46 [PATCH v2 00/12] mtd: nand: denali: more clean-ups Masahiro Yamada
2017-09-22  3:46 ` Masahiro Yamada [this message]
2017-09-22  3:46 ` [PATCH v2 02/12] mtd: nand: denali: prefix detect_max_banks() with denali_ Masahiro Yamada
2017-09-22  3:46 ` [PATCH v2 03/12] mtd: nand: denali: consolidate include directives Masahiro Yamada
2017-09-22  3:46 ` [PATCH v2 04/12] mtd: nand: denali: squash denali_enable_dma() helper into caller Masahiro Yamada
2017-09-22  3:46 ` [PATCH v2 05/12] mtd: nand: denali: slight clean up of denali_wait_for_irq() Masahiro Yamada
2017-09-22  3:46 ` [PATCH v2 06/12] mtd: nand: denali: clean up macros with <linux/bitfield.h> Masahiro Yamada
2017-09-22  3:46 ` [PATCH v2 07/12] mtd: nand: denali: use more FIELD_PREP / FIELD_GET where appropriate Masahiro Yamada
2017-09-22  3:46 ` [PATCH v2 08/12] mtd: nand: denali: clean up comments Masahiro Yamada
2017-09-22  3:46 ` [PATCH v2 09/12] mtd: nand: denali: use upper/lower_32_bits() macro for clean-up Masahiro Yamada
2017-09-22  3:46 ` [PATCH v2 10/12] mtd: nand: denali: remove unneeded init of ECC_ENABLE register Masahiro Yamada
2017-09-22  3:46 ` [PATCH v2 11/12] mtd: nand: denali: support direct addressing mode Masahiro Yamada
2017-09-22  3:46 ` [PATCH v2 12/12] mtd: nand: denali: change the setup_dma choice into hook Masahiro Yamada
2017-09-22 10:06 ` [PATCH v2 00/12] mtd: nand: denali: more clean-ups Boris Brezillon

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=1506052009-8285-2-git-send-email-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --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

all inboxes | Powered by JetHome®