diff mbox

[RESEND,v2] mtd: nand_base: Use io{read, write}*_rep functions for transfer

Message ID 1366303846-20384-1-git-send-email-shc_work@mail.ru
State New, archived
Headers show

Commit Message

Alexander Shiyan April 18, 2013, 4:50 p.m. UTC
This patch replaces the usage of loops in the nand_base code with
io{read,write}{8,16}_rep calls instead.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mtd/nand/nand_base.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

Comments

Brian Norris April 18, 2013, 10:09 p.m. UTC | #1
On Thu, Apr 18, 2013 at 9:50 AM, Alexander Shiyan <shc_work@mail.ru> wrote:
> This patch replaces the usage of loops in the nand_base code with
> io{read,write}{8,16}_rep calls instead.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>

Looks good. Thanks.

Acked-by: Brian Norris <computersforpeace@gmail.com>
diff mbox

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 0b6daaf..d99ab3d 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -255,11 +255,9 @@  static void nand_write_byte16(struct mtd_info *mtd, uint8_t byte)
  */
 static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
 {
-	int i;
 	struct nand_chip *chip = mtd->priv;
 
-	for (i = 0; i < len; i++)
-		writeb(buf[i], chip->IO_ADDR_W);
+	iowrite8_rep(chip->IO_ADDR_W, buf, len);
 }
 
 /**
@@ -272,11 +270,9 @@  static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
  */
 static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
 {
-	int i;
 	struct nand_chip *chip = mtd->priv;
 
-	for (i = 0; i < len; i++)
-		buf[i] = readb(chip->IO_ADDR_R);
+	ioread8_rep(chip->IO_ADDR_R, buf, len);
 }
 
 /**
@@ -289,14 +285,10 @@  static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
  */
 static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
 {
-	int i;
 	struct nand_chip *chip = mtd->priv;
 	u16 *p = (u16 *) buf;
-	len >>= 1;
-
-	for (i = 0; i < len; i++)
-		writew(p[i], chip->IO_ADDR_W);
 
+	iowrite16_rep(chip->IO_ADDR_W, p, len >> 1);
 }
 
 /**
@@ -309,13 +301,10 @@  static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
  */
 static void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len)
 {
-	int i;
 	struct nand_chip *chip = mtd->priv;
 	u16 *p = (u16 *) buf;
-	len >>= 1;
 
-	for (i = 0; i < len; i++)
-		p[i] = readw(chip->IO_ADDR_R);
+	ioread16_rep(chip->IO_ADDR_R, p, len >> 1);
 }
 
 /**