diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2017-06-19 07:44:29 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-06-20 09:31:41 +0200 |
commit | 83c76c60d021df0dd7cd4073f6003cbc4787542b (patch) | |
tree | 90295c9303cd983c71f003d7753d877fbbb33b9f | |
parent | 9ce47aea7ee6f1e5182611fe4da3af1c799fc526 (diff) | |
download | barebox-83c76c60d021df0dd7cd4073f6003cbc4787542b.tar.gz barebox-83c76c60d021df0dd7cd4073f6003cbc4787542b.tar.xz |
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.
This is a backport of kernel commit
a296a1bc3eb54382d2a61d47529e71c9d3bc615e
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/mtd/devices/mtd_dataflash.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index 96dd35e767..fae36b679b 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) ? |