From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S971226AbdDTQaQ (ORCPT ); Thu, 20 Apr 2017 12:30:16 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:36140 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S971143AbdDTQaK (ORCPT ); Thu, 20 Apr 2017 12:30:10 -0400 From: Andrey Smirnov To: linux-mtd@lists.infradead.org Cc: Andrey Smirnov , cphealy@gmail.com, David Woodhouse , Brian Norris , Boris Brezillon , Richard Weinberger , Cyrille Pitchen , Marek Vasut , linux-kernel@vger.kernel.org Subject: [PATCH v4 2/6] mtd: dataflash: Improve coding style in jedec_probe() Date: Thu, 20 Apr 2017 09:29:48 -0700 Message-Id: <20170420162952.5181-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170420162952.5181-1-andrew.smirnov@gmail.com> References: <20170420162952.5181-1-andrew.smirnov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change the following: - Replace indentation between type and name of local variable from tabs to spaces - Replace magic number 0x1F with CFI_MFR_ATMEL macro - Replace variable 'tmp' with 'ret' and 'i' where appropriate - Reformat multi-line comments and add newlines where appropriate No functional change intended. Cc: cphealy@gmail.com Cc: David Woodhouse Cc: Brian Norris Cc: Boris Brezillon Cc: Richard Weinberger Cc: Cyrille Pitchen Cc: Marek Vasut Cc: linux-kernel@vger.kernel.org Acked-by: Marek Vasut Signed-off-by: Andrey Smirnov --- No changes since [v3] Changes since [v2]: - Re-worded commit message - Collected Acked-by from Marek Not present in v1 [v2] http://lkml.kernel.org/r/20170418142127.23301-2-andrew.smirnov@gmail.com [v3] http://lkml.kernel.org/r/20170419152305.17226-2-andrew.smirnov@gmail.com drivers/mtd/devices/mtd_dataflash.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index a566231..5b7a8c3 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -82,6 +82,7 @@ #define OP_WRITE_SECURITY_REVC 0x9A #define OP_WRITE_SECURITY 0x9B /* revision D */ +#define CFI_MFR_ATMEL 0x1F struct dataflash { u8 command[4]; @@ -738,14 +739,15 @@ static struct flash_info dataflash_data[] = { static struct flash_info *jedec_probe(struct spi_device *spi) { - int tmp; - u8 code = OP_READ_ID; - u8 id[3]; - u32 jedec; - struct flash_info *info; + int ret, i; + u8 code = OP_READ_ID; + u8 id[3]; + u32 jedec; + struct flash_info *info; int status; - /* JEDEC also defines an optional "extended device information" + /* + * JEDEC also defines an optional "extended device information" * string for after vendor-specific data, after the three bytes * we use here. Supporting some chips might require using it. * @@ -753,13 +755,14 @@ static struct flash_info *jedec_probe(struct spi_device *spi) * That's not an error; only rev C and newer chips handle it, and * only Atmel sells these chips. */ - tmp = spi_write_then_read(spi, &code, 1, id, 3); - if (tmp < 0) { + ret = spi_write_then_read(spi, &code, 1, id, 3); + if (ret < 0) { pr_debug("%s: error %d reading JEDEC ID\n", - dev_name(&spi->dev), tmp); - return ERR_PTR(tmp); + dev_name(&spi->dev), ret); + return ERR_PTR(ret); } - if (id[0] != 0x1f) + + if (id[0] != CFI_MFR_ATMEL) return NULL; jedec = id[0]; @@ -768,9 +771,9 @@ static struct flash_info *jedec_probe(struct spi_device *spi) jedec = jedec << 8; jedec |= id[2]; - for (tmp = 0, info = dataflash_data; - tmp < ARRAY_SIZE(dataflash_data); - tmp++, info++) { + for (i = 0, info = dataflash_data; + i < ARRAY_SIZE(dataflash_data); + i++, info++) { if (info->jedec_id == jedec) { pr_debug("%s: OTP, sector protect%s\n", dev_name(&spi->dev), -- 2.9.3