From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>,
cphealy@gmail.com, David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
Cyrille Pitchen <cyrille.pitchen@atmel.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v4 4/6] mtd: dataflash: Get rid of loop counter in jedec_probe()
Date: Thu, 20 Apr 2017 09:29:50 -0700 [thread overview]
Message-ID: <20170420162952.5181-4-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20170420162952.5181-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.
Cc: cphealy@gmail.com
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
Changes since [v3]
- Collected Reviewed-by from Marek
Not present in v2, v1
[v3] http://lkml.kernel.org/r/20170419152305.17226-4-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 ccd1e02..2d3e403 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -736,7 +736,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;
@@ -767,9 +767,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.3
next prev parent reply other threads:[~2017-04-20 16:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-20 16:29 [PATCH v4 1/6] mtd: dataflash: Replace C99 types with their kernel counterparts Andrey Smirnov
2017-04-20 16:29 ` [PATCH v4 2/6] mtd: dataflash: Improve coding style in jedec_probe() Andrey Smirnov
2017-04-20 16:29 ` [PATCH v4 3/6] mtd: dataflash: Replace pr_debug, printk with dev_* functions Andrey Smirnov
2017-04-20 16:29 ` Andrey Smirnov [this message]
2017-04-20 16:29 ` [PATCH v4 5/6] mtd: dataflash: Make use of "extened device information" Andrey Smirnov
2017-04-20 17:27 ` Marek Vasut
2017-04-20 16:29 ` [PATCH v4 6/6] mtd: dataflash: Add flash_info for AT45DB641E Andrey Smirnov
2017-04-20 17:28 ` Marek Vasut
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=20170420162952.5181-4-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cphealy@gmail.com \
--cc=cyrille.pitchen@atmel.com \
--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;
as well as URLs for NNTP newsgroup(s).