mtd: dataflash: Get rid of loop counter in jedec_probe()
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Thu Jul 13 10:59:02 PDT 2017
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=a296a1bc3eb54382d2a61d47529e71c9d3bc615e
Commit: a296a1bc3eb54382d2a61d47529e71c9d3bc615e
Parent: 02f62864f6cebbbbff6bb611fddf78c1d05a9747
Author: Andrey Smirnov <andrew.smirnov at gmail.com>
AuthorDate: Fri Apr 21 09:30:24 2017 -0700
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Thu May 11 10:04:39 2017 -0700
mtd: dataflash: Get rid of loop counter in jedec_probe()
"For" loop in jedec_probe can be simplified to not need counter
'i'. Convert the code and get rid of the variable.
Cc: cphealy at gmail.com
Cc: David Woodhouse <dwmw2 at infradead.org>
Cc: Brian Norris <computersforpeace at gmail.com>
Cc: Boris Brezillon <boris.brezillon at free-electrons.com>
Cc: Marek Vasut <marek.vasut at gmail.com>
Cc: Richard Weinberger <richard at nod.at>
Cc: Cyrille Pitchen <cyrille.pitchen at atmel.com>
Cc: linux-kernel at vger.kernel.org
Reviewed-by: Marek Vasut <marek.vasut at gmail.com>
Tested-by: Chris Healy <cphealy at gmail.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
Signed-off-by: Brian Norris <computersforpeace at 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) ?
More information about the linux-mtd-cvs
mailing list