mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>, cphealy@gmail.com
Subject: [PATCH 4/6] mtd: dataflash: Get rid of loop counter in jedec_probe()
Date: Mon, 19 Jun 2017 07:44:29 -0700	[thread overview]
Message-ID: <20170619144431.20843-5-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20170619144431.20843-1-andrew.smirnov@gmail.com>

"For" loop in jedec_probe can be simplified to not need counter
'i'. Convert the code and get rid of the variable.

This is a backport of kernel commit
a296a1bc3eb54382d2a61d47529e71c9d3bc615e

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/mtd/devices/mtd_dataflash.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 96dd35e..fae36b6 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -714,7 +714,7 @@ static struct flash_info dataflash_data [] = {
 
 static struct flash_info * jedec_probe(struct spi_device *spi)
 {
-	int ret, i;
+	int ret;
 	u8 code = OP_READ_ID;
 	u8 id[3];
 	u32 jedec;
@@ -745,9 +745,9 @@ static struct flash_info * jedec_probe(struct spi_device *spi)
 	jedec = jedec << 8;
 	jedec |= id[2];
 
-	for (i = 0, info = dataflash_data;
-			i < ARRAY_SIZE(dataflash_data);
-			i++, info++) {
+	for (info = dataflash_data;
+	     info < dataflash_data + ARRAY_SIZE(dataflash_data);
+	     info++) {
 		if (info->jedec_id == jedec) {
 			dev_dbg(&spi->dev, "OTP, sector protect%s\n",
 				(info->flags & SUP_POW2PS) ?
-- 
2.9.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2017-06-19 14:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19 14:44 [PATCH 0/6] Backport support for "extended device ID" for dataflash Andrey Smirnov
2017-06-19 14:44 ` [PATCH 1/6] mtd: dataflash: Replace C99 types with their kernel counterparts Andrey Smirnov
2017-06-19 14:44 ` [PATCH 2/6] mtd: dataflash: Improve coding style in jedec_probe() Andrey Smirnov
2017-06-19 14:44 ` [PATCH 3/6] mtd: dataflash: Replace pr_debug, printk with dev_* functions Andrey Smirnov
2017-06-19 14:44 ` Andrey Smirnov [this message]
2017-06-19 14:44 ` [PATCH 5/6] mtd: dataflash: Make use of "extened device information" Andrey Smirnov
2017-06-19 14:44 ` [PATCH 6/6] mtd: dataflash: Add flash_info for AT45DB641E Andrey Smirnov
2017-06-20  7:32 ` [PATCH 0/6] Backport support for "extended device ID" for dataflash 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=20170619144431.20843-5-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=cphealy@gmail.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