Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1041378AbdDUQjg (ORCPT ); Fri, 21 Apr 2017 12:39:36 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:36085 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1041360AbdDUQjb (ORCPT ); Fri, 21 Apr 2017 12:39:31 -0400 From: Andrey Smirnov To: linux-mtd@lists.infradead.org Cc: Andrey Smirnov , cphealy@gmail.com, David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Cyrille Pitchen , linux-kernel@vger.kernel.org Subject: [PATCH v5 4/6] mtd: dataflash: Get rid of loop counter in jedec_probe() Date: Fri, 21 Apr 2017 09:30:24 -0700 Message-Id: <20170421163026.24884-4-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170421163026.24884-1-andrew.smirnov@gmail.com> References: <20170421163026.24884-1-andrew.smirnov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1774 Lines: 57 "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 Cc: Brian Norris Cc: Boris Brezillon Cc: Marek Vasut Cc: Richard Weinberger Cc: Cyrille Pitchen Cc: linux-kernel@vger.kernel.org Reviewed-by: Marek Vasut Signed-off-by: Andrey Smirnov --- No changes since [v4] 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 [v4] http://lkml.kernel.org/r/20170420162952.5181-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