From patchwork Tue Apr 2 04:03:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 161597 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1257038jan; Mon, 1 Apr 2019 21:04:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxu+89AtNr+0o0OjFgpf6tE2NBIXKr3FXKDOf7QlvP8sSET94itS+aTRNqCW75Y+OqrI2E+ X-Received: by 2002:a62:58c7:: with SMTP id m190mr66312949pfb.4.1554177846261; Mon, 01 Apr 2019 21:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554177846; cv=none; d=google.com; s=arc-20160816; b=FSIfkP7T0PO9zWehGY5bxAvlPHBpkSXDJpM6DErdXiO0jUoh9B71/HTZjNsYVlcxP3 4bJ8IINj06vDj+NXoDaLT9qEOnUQOTGwEDxvDedDI5aMW84XMlI1im8CSfK9YNQDD1lZ YcGj3JFF/c9VZUlnVwojro+5JbfD0DlvZjpelL1WRDqpeTcKPH+DIaB17dxVNHF7WsXt V80R9fRCTKydZNunFXFi5l9a0MpmzXVdp1u8Qu4qloa0ZQqQAYyoyDLnh4A6Usv6tUYG r3HKZW+Wnk1SRane7nc+QiyurVTVyKZSFSL88EDjZut+41S/+nWpgNGeNeGr2S/XXEOZ fslw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=ReU1OYDJU/+8auVx1kfUmf8jec5Hsbp3EOEOd9fDV1I=; b=iBLxDAyXEq0QRRWrZ3A3j8f+qWWet9YXttaYdTtnu4cnAvu/BYRF6TSlC2bjl25/o5 l70z5GarXRq3dASL7TsvonFr70FWm6vtClix/ONaH7sw4AiaCy8CftlgkoooHT6VL4Af U4kI5PBVbz3NmQZoJCCc/9n7CmpgUVaFPkxb1r3OeWXaqPMTX0/4HoZng1Im3+17SAz7 ZS/+uTNRcqqy0jhKjZaa8I/iwdezFYNieNyigel92OpaTNi07jJAMjlWCBknh52MB2oS EP6ZyKtbvNvin7cFcHXkR13rB0p2manbXMKhxFtBD2HeS/Fd3WueXFCQvrOi9QECbLDd bOBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=LxZJU+ii; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=rtsD1kbJ; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id 70si10815480pfu.227.2019.04.01.21.04.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 21:04:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=LxZJU+ii; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=rtsD1kbJ; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ReU1OYDJU/+8auVx1kfUmf8jec5Hsbp3EOEOd9fDV1I=; b=LxZJU+iiesGfSyF/+/W4MlXhTo eiw5hSjPywIDTIKZ9V8Ezva2yqQFLv9YKVNIWXK+OaaHN/MFdSX/YYATX3/NO+0Yep+sVss2fcnpv /1ldlt5n/BxVBkQlo8ngKwkTVsqijYq/iFzdCML9CQH9c/mo+diGjosBpo9HD12Bgo0MPxW2j2TfY 4PpDGoDJLZsKzTFHv5Fuoxn7l3pxMVi80j8H8McZLd+2JaZipdtRP81vrqJPoAFsGOr8n1gXVONTM mgE6Wno6dnllV9uKDDUAU8PSWjZZYpLAsQifvJrR0WTSpRgylLc1T1vecM6QioayUXlRun/qoCjx8 dbPesFcQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAeQ-0008Nj-FE; Tue, 02 Apr 2019 04:03:54 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAeG-0008Ct-1A for linux-mtd@lists.infradead.org; Tue, 02 Apr 2019 04:03:45 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id x3243HaU021871; Tue, 2 Apr 2019 13:03:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x3243HaU021871 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1554177800; bh=4YuEllPvWnLkCfzg50IoHyOtmXhMWEcrNEE7D+bECH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rtsD1kbJM8UdQc5fiYIGYvURKNwnlsL3dESHanLJv2MZXre3A9OYmRgubn5cloUS7 K7HuS4LaOa+/M8RyCiWt8LrQsk6Y0P7T25awwXfhWX228RjTgtGWsL3Ne+tkcNQxPk /3WPaLOD/fBbZHclG9sTjt4tnrCPbxQ1Ad8DOYMFOiR81zL+fY1gItHsF+kPzq1pcF tOCwb0xfnNUl+jEcl5aefHphx8deQXrKPtGnjQuxH652X9crih9rh4vHJCp1XsACRp zPCWZkNEq9s2kV/MjB5wJIR8sb/wdnE2d50hATzOcg6ghwzviigT4FCgWEiwazkQjE vmDNx6AZfXvPw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Subject: [PATCH v5 1/9] mtd: rawnand: denali: use more nand_chip pointers for internal functions Date: Tue, 2 Apr 2019 13:03:01 +0900 Message-Id: <1554177789-15414-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> References: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_210344_284763_808C136F X-CRM114-Status: GOOD ( 16.51 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.74 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [210.131.2.74 listed in wl.mailspike.net] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , Richard Weinberger , Boris Brezillon , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org With the recent refactoring, the NAND driver hooks now take a pointer to nand_chip. Add to_denali() in order to convert (struct nand_chip *) to (struct denali_nand_info *) directly. It is more useful than the current mtd_to_denali(). I changed some helper functions to take (struct nand_chip *). This will avoid pointer conversion back and forth, and ease further development. Signed-off-by: Masahiro Yamada --- Changes in v5: - pass nand_chip to denali_check_erased_page(), denali_hw_ecc_fixup(), and denali_hw_ecc_fixup() instead of passing them both nand_chip and denali_nand_info. Changes in v4: None Changes in v3: None Changes in v2: None drivers/mtd/nand/raw/denali.c | 61 ++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 27 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index 24aeafc..83156f4 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -47,6 +47,11 @@ static inline struct denali_nand_info *mtd_to_denali(struct mtd_info *mtd) return container_of(mtd_to_nand(mtd), struct denali_nand_info, nand); } +static struct denali_nand_info *to_denali(struct nand_chip *chip) +{ + return container_of(chip, struct denali_nand_info, nand); +} + /* * Direct Addressing - the slave address forms the control information (command * type, bank, block, and page address). The slave data is the actual data to @@ -282,12 +287,12 @@ static void denali_cmd_ctrl(struct nand_chip *chip, int dat, unsigned int ctrl) denali->host_write(denali, DENALI_BANK(denali) | type, dat); } -static int denali_check_erased_page(struct mtd_info *mtd, - struct nand_chip *chip, uint8_t *buf, +static int denali_check_erased_page(struct nand_chip *chip, u8 *buf, unsigned long uncor_ecc_flags, unsigned int max_bitflips) { - struct denali_nand_info *denali = mtd_to_denali(mtd); + struct denali_nand_info *denali = to_denali(chip); + struct mtd_ecc_stats *ecc_stats = &nand_to_mtd(chip)->ecc_stats; uint8_t *ecc_code = chip->oob_poi + denali->oob_skip_bytes; int ecc_steps = chip->ecc.steps; int ecc_size = chip->ecc.size; @@ -303,9 +308,9 @@ static int denali_check_erased_page(struct mtd_info *mtd, NULL, 0, chip->ecc.strength); if (stat < 0) { - mtd->ecc_stats.failed++; + ecc_stats->failed++; } else { - mtd->ecc_stats.corrected += stat; + ecc_stats->corrected += stat; max_bitflips = max_t(unsigned int, max_bitflips, stat); } @@ -316,11 +321,11 @@ static int denali_check_erased_page(struct mtd_info *mtd, return max_bitflips; } -static int denali_hw_ecc_fixup(struct mtd_info *mtd, - struct denali_nand_info *denali, +static int denali_hw_ecc_fixup(struct nand_chip *chip, unsigned long *uncor_ecc_flags) { - struct nand_chip *chip = mtd_to_nand(mtd); + struct denali_nand_info *denali = to_denali(chip); + struct mtd_ecc_stats *ecc_stats = &nand_to_mtd(chip)->ecc_stats; int bank = denali->active_bank; uint32_t ecc_cor; unsigned int max_bitflips; @@ -346,16 +351,17 @@ static int denali_hw_ecc_fixup(struct mtd_info *mtd, * Unfortunately, we can not know the total number of corrected bits in * the page. Increase the stats by max_bitflips. (compromised solution) */ - mtd->ecc_stats.corrected += max_bitflips; + ecc_stats->corrected += max_bitflips; return max_bitflips; } -static int denali_sw_ecc_fixup(struct mtd_info *mtd, - struct denali_nand_info *denali, +static int denali_sw_ecc_fixup(struct nand_chip *chip, unsigned long *uncor_ecc_flags, uint8_t *buf) { - unsigned int ecc_size = denali->nand.ecc.size; + struct denali_nand_info *denali = to_denali(chip); + struct mtd_ecc_stats *ecc_stats = &nand_to_mtd(chip)->ecc_stats; + unsigned int ecc_size = chip->ecc.size; unsigned int bitflips = 0; unsigned int max_bitflips = 0; uint32_t err_addr, err_cor_info; @@ -404,7 +410,7 @@ static int denali_sw_ecc_fixup(struct mtd_info *mtd, /* correct the ECC error */ flips_in_byte = hweight8(buf[offset] ^ err_cor_value); buf[offset] ^= err_cor_value; - mtd->ecc_stats.corrected += flips_in_byte; + ecc_stats->corrected += flips_in_byte; bitflips += flips_in_byte; max_bitflips = max(max_bitflips, bitflips); @@ -587,9 +593,11 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf, return ret; } -static int denali_data_xfer(struct denali_nand_info *denali, void *buf, - size_t size, int page, int raw, int write) +static int denali_data_xfer(struct nand_chip *chip, void *buf, size_t size, + int page, int raw, int write) { + struct denali_nand_info *denali = to_denali(chip); + iowrite32(raw ? 0 : ECC_ENABLE__FLAG, denali->reg + ECC_ENABLE); iowrite32(raw ? TRANSFER_SPARE_REG__FLAG : 0, denali->reg + TRANSFER_SPARE_REG); @@ -678,7 +686,7 @@ static int denali_read_page_raw(struct nand_chip *chip, uint8_t *buf, size_t size = writesize + oobsize; int ret, i, pos, len; - ret = denali_data_xfer(denali, tmp_buf, size, page, 1, 0); + ret = denali_data_xfer(chip, tmp_buf, size, page, 1, 0); if (ret) return ret; @@ -766,14 +774,14 @@ static int denali_read_page(struct nand_chip *chip, uint8_t *buf, int stat = 0; int ret; - ret = denali_data_xfer(denali, buf, mtd->writesize, page, 0, 0); + ret = denali_data_xfer(chip, buf, mtd->writesize, page, 0, 0); if (ret && ret != -EBADMSG) return ret; if (denali->caps & DENALI_CAP_HW_ECC_FIXUP) - stat = denali_hw_ecc_fixup(mtd, denali, &uncor_ecc_flags); + stat = denali_hw_ecc_fixup(chip, &uncor_ecc_flags); else if (ret == -EBADMSG) - stat = denali_sw_ecc_fixup(mtd, denali, &uncor_ecc_flags, buf); + stat = denali_sw_ecc_fixup(chip, &uncor_ecc_flags, buf); if (stat < 0) return stat; @@ -783,7 +791,7 @@ static int denali_read_page(struct nand_chip *chip, uint8_t *buf, if (ret) return ret; - stat = denali_check_erased_page(mtd, chip, buf, + stat = denali_check_erased_page(chip, buf, uncor_ecc_flags, stat); } @@ -866,17 +874,16 @@ static int denali_write_page_raw(struct nand_chip *chip, const uint8_t *buf, memcpy(tmp_buf + size - len, oob, len); } - return denali_data_xfer(denali, tmp_buf, size, page, 1, 1); + return denali_data_xfer(chip, tmp_buf, size, page, 1, 1); } static int denali_write_page(struct nand_chip *chip, const uint8_t *buf, int oob_required, int page) { struct mtd_info *mtd = nand_to_mtd(chip); - struct denali_nand_info *denali = mtd_to_denali(mtd); - return denali_data_xfer(denali, (void *)buf, mtd->writesize, - page, 0, 1); + return denali_data_xfer(chip, (void *)buf, mtd->writesize, page, + 0, 1); } static void denali_select_chip(struct nand_chip *chip, int cs) @@ -1092,9 +1099,9 @@ static const struct mtd_ooblayout_ops denali_ooblayout_ops = { .free = denali_ooblayout_free, }; -static int denali_multidev_fixup(struct denali_nand_info *denali) +static int denali_multidev_fixup(struct nand_chip *chip) { - struct nand_chip *chip = &denali->nand; + struct denali_nand_info *denali = to_denali(chip); struct mtd_info *mtd = nand_to_mtd(chip); /* @@ -1222,7 +1229,7 @@ static int denali_attach_chip(struct nand_chip *chip) chip->ecc.read_oob = denali_read_oob; chip->ecc.write_oob = denali_write_oob; - ret = denali_multidev_fixup(denali); + ret = denali_multidev_fixup(chip); if (ret) return ret; From patchwork Tue Apr 2 04:03:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 161598 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1257151jan; Mon, 1 Apr 2019 21:04:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYXqsFDCJfb/2Hw7YJ1tlVpkIhbBU+OTRS/nga2Bh5CeWIy58JSxKkVQI+8sihJu96aJ5R X-Received: by 2002:a17:902:7081:: with SMTP id z1mr26832753plk.252.1554177855904; Mon, 01 Apr 2019 21:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554177855; cv=none; d=google.com; s=arc-20160816; b=wGoTImiV1AFBZxUbx3dzkDaGOuHcSSSdcIOzKrR1N+SEEDK9grKSPGE5btwHpcxw5L NynqnjjGMQ41k+5/7ptZcboh0TUQYKD0y6xXw77OWwHDUj1CRsRXIEJzMdC6lwTO5gIm VBjf+6HVW3wbVALqQhmG4chHxyjV5D+1Urx6DjNJQjDUCXsJHfHg68nwCickJvEZ8Nb1 5iU1QgDfvoF2efoKvWcFLCJHrNB5u399raSsnoNchlsLtdhyee2bFolAsZtHns/BbLhD 9WRK24NjU0+gqtSlwIgL3HzgaqiTnQwQbvomuw2rjejoQcrIrFUxD3Mzml6D8U7iN+R2 ANbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=XBSTWyAeWicoVafmtaozkF1ybH5QU0Yf796gKPi2fGI=; b=OSYf8vBAXKC3ytRK6ZmSmQFAtDPA2gi5NPtW3n6MmPo+aEtrwQU5S4jew04MzBc3J/ gmyD2LXrqSgnhuje67rfeCfSevqlTclTnfOZeCZPhgLYc0HQ+bEMTamu0EoZmgq54sZA veP+22GskuX5c/ekn/Lri7D7P2rU6CU9fNyslNBsW8GpeZcD46cZYgbWVNB7qpBVvKdz ps3mRqxg3wYUke7/qVhez0VY4ZjD+rK9W63Ul3anU4K8yuw5N55jg4dz01OMxN8qNbR/ TanJhZwmJt3LY99kfD0Sp0AQn5drqWt3a8YGs9Wdb8JMHzuWi7S5bPrz/fUj0qDf68Pb rWMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=kYJHKise; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=zKFkzbQf; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id x30si10670163pgl.477.2019.04.01.21.04.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 21:04:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=kYJHKise; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=zKFkzbQf; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XBSTWyAeWicoVafmtaozkF1ybH5QU0Yf796gKPi2fGI=; b=kYJHKise45xH/D2vnmq6wpGLFp VRtrTmgLJIU/F/Je6rqhhnvwHn2lGWRSs2OjFiM0FbgNTUP/7hTvNFdJiDisqXXK6zV9DREv3W/Bn r+A/esqxcyeJ00ALbjrRIj+v/OPtnPwKlKQ/VE4r81CZRTdD5MLzpuqo35wcEih1DyFkmkytHx5f4 gPzDs/WqdOQrCmxEX9EGp3cdSyHdW2T8IUnDBL7wEHiTxrFmNPp3piVuHbdn3ImIF8krRulmnsJ95 rG3AAHUg+ZH5urnZVxf1A54xf/SRSC8MR4HmoF39/hB/6FrZ7lph/n1dXY4Q/J8Avv3w5WOwDSArR lVtU7Nnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAea-0000Aq-II; Tue, 02 Apr 2019 04:04:04 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAeG-0008Cx-1H for linux-mtd@lists.infradead.org; Tue, 02 Apr 2019 04:03:46 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id x3243HaW021871; Tue, 2 Apr 2019 13:03:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x3243HaW021871 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1554177801; bh=hwp7B4epm8xIJuNf4RNloi2tLVuAeJkYxTUaLmMTjAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zKFkzbQf973zNpAcNfC6xUrmOYIx6eX8Lyp3shiPnIc6TRgl6dFbiBeLjbtBQJp63 oDMP3VVXLDLUeI4GrBIVMjE9cFqGXuseluPq4Ocgd2cuSEQCK10lh8I2zFdpsnFXcz VCox/AXG1ZmcSjHDrooB37l5QkaFvouS6K/YAwpsG2T3/+HWr2zozZgQWkWMBgGBkG rHeqRgtuWsOzBlUdabAws4HyPHZWvqnusnukThIlLDMWwpgodZzp2LSqcIIhGtRUgj kY0k/HTTxgT75vpZ6T23kJ4MepkDRsq72ycDfP2DpljX6nRFyLhd1LHyjiMbZZ0T4c PrG12Qp+stCiA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Subject: [PATCH v5 3/9] mtd: rawnand: denali: remove unneeded casts in denali_{read, write}_pio Date: Tue, 2 Apr 2019 13:03:03 +0900 Message-Id: <1554177789-15414-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> References: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_210344_374661_E5E458E5 X-CRM114-Status: GOOD ( 10.89 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.74 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [210.131.2.74 listed in wl.mailspike.net] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , Richard Weinberger , Boris Brezillon , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Since (u32 *) can accept an opaque pointer, the explicit casting from (void *) to (u32 *) is redundant. Change the function argument type to remove the casts. Signed-off-by: Masahiro Yamada --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/mtd/nand/raw/denali.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index 6a3520f..1422015 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -654,11 +654,10 @@ static void denali_setup_dma32(struct denali_nand_info *denali, denali->host_write(denali, mode | 0x14000, 0x2400); } -static int denali_pio_read(struct denali_nand_info *denali, void *buf, +static int denali_pio_read(struct denali_nand_info *denali, u32 *buf, size_t size, int page) { u32 addr = DENALI_MAP01 | DENALI_BANK(denali) | page; - uint32_t *buf32 = (uint32_t *)buf; uint32_t irq_status, ecc_err_mask; int i; @@ -670,7 +669,7 @@ static int denali_pio_read(struct denali_nand_info *denali, void *buf, denali_reset_irq(denali); for (i = 0; i < size / 4; i++) - *buf32++ = denali->host_read(denali, addr); + buf[i] = denali->host_read(denali, addr); irq_status = denali_wait_for_irq(denali, INTR__PAGE_XFER_INC); if (!(irq_status & INTR__PAGE_XFER_INC)) @@ -682,18 +681,17 @@ static int denali_pio_read(struct denali_nand_info *denali, void *buf, return irq_status & ecc_err_mask ? -EBADMSG : 0; } -static int denali_pio_write(struct denali_nand_info *denali, - const void *buf, size_t size, int page) +static int denali_pio_write(struct denali_nand_info *denali, const u32 *buf, + size_t size, int page) { u32 addr = DENALI_MAP01 | DENALI_BANK(denali) | page; - const uint32_t *buf32 = (uint32_t *)buf; uint32_t irq_status; int i; denali_reset_irq(denali); for (i = 0; i < size / 4; i++) - denali->host_write(denali, addr, *buf32++); + denali->host_write(denali, addr, buf[i]); irq_status = denali_wait_for_irq(denali, INTR__PROGRAM_COMP | INTR__PROGRAM_FAIL); From patchwork Tue Apr 2 04:03:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 161600 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1257423jan; Mon, 1 Apr 2019 21:04:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9T9zLj/Cavk9+5FafEvjElCuvE6YboiRZ8LbRROaFVkcn3rQVocwH8PpKPjmTYyzMzmAn X-Received: by 2002:aa7:9296:: with SMTP id j22mr38703283pfa.140.1554177875285; Mon, 01 Apr 2019 21:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554177875; cv=none; d=google.com; s=arc-20160816; b=w5tkIc6gtt39c4sAccTN7D6dDkDMhpBHDyuDtTW+PTp4gmIicz2VDZ/UR4xjpHPXQ8 VNGT4Z6bM8cpevShOrPg9PP2Fx3tIXNkrmN7ns02rRCeH+1yj5uUx9tk+qoo0vbmWNVJ 8S+3xJxF0kzWZhP8vqieBLvAHItFs5UQGObmtipgPwQ5tTrlYkeywBLvOzJp1ZuyX/qD qFmGS2G6IzPPngJmkTHJSPcQyZ1wZmonKs6z5BqCufonsnw9XCVuEbQgZLAhLu5RN0Sq 9xFDk1rm+/4p5Ex/BKg2frdejm/5qaueNejveza/FmR7fJ9SCcAxlNGhyd/xqY6UYt4m xqwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=yb4O8sNMD66M19PYUyOeT1WZIPDpedVl8pnM5UOKsLs=; b=hO8eqcbezGvPYqrDzEz6/JjNG+DKMsW3L5OGzCwZf86CZiuBt49MKSerJOr8UsqnT0 wJDyFYhBXGqQh7mq9YZZ3fbkpWYIeBSsyuWb7YWJWw0XlYy/E0exloO6QSWBc1ukUKJn vgvhSEIxogFbOxt4MhKcBWXOogSHNz+X5chxwai+DYIozXmGyDKDSy4MTQxhiof6eL3q er4Opcs7RbCJt7db5atIQZBshvts1oZR/R+kjDn/tpbtIgRMMEfHeULrtC+qLEWDtG4/ wbxdK9GYrIkAwDA8kH4JchkN1ua7yV1z9+ZD3xyW6rjnGNmoZcLl9IP7xdhZg35Kz1/b aGGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=jEgw0RDj; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=OmuXsdrW; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id i18si10585876pgi.284.2019.04.01.21.04.35 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 21:04:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=jEgw0RDj; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=OmuXsdrW; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=yb4O8sNMD66M19PYUyOeT1WZIPDpedVl8pnM5UOKsLs=; b=jEgw0RDj7eG39Mn/iyY9Uujsno CCoXG6KWBUwvqeoSFRrdaoR1u6gWRqhgBr04jISURI8gslZBZH9zprs5Wk+QKecnK7CYJYVcdpNuk cnHcaJNresF72ez4uWj3tzzsLXS8aq8vE0PnAbSia4ssPrH1gF3LCSmGHxyS38nAEE+oJDlgeghc4 xN1r6+G0CiA+W6rX3u91oTXKynES8UVqC5FsO27OGi7Op7wZYuNEXmrRqpPrb5M4PNC2swwDshmVA oSpYn+nuTXYyTgDFt3syKXnVIIDFIx9Ey5FgtiB+zibQH5kqQb76iOf3KD8jPQ9t+ZoyBHhGfDcXD urB4Nfjw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAeu-0000dC-9d; Tue, 02 Apr 2019 04:04:24 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAeG-0008Cy-1B for linux-mtd@lists.infradead.org; Tue, 02 Apr 2019 04:03:47 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id x3243HaY021871; Tue, 2 Apr 2019 13:03:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x3243HaY021871 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1554177803; bh=JeFdw5YW0UFiB2TB3IT3/BSl8E6CKnBlNnD2IQK+xDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OmuXsdrWul42DG6KNvCBfHN7L+IlKfX989XeWtenKpU3kFhCGmLsrf4oU0a7HweOS Jdc7QWrToqYFCGOu0O2fuZ9oe881KAqc1FAr1Sr2REaEeQ9GI1mdGyuIaojKXgkfWO sxsv7z/utg2la99lZNVei1NwNWQDkZHbWN8Tr+iR8K0AwNWSosDxsAEjhAm+/ugZ1d HYxRrQzWD1b0UUShIcR8qUW0G0uCuTM8os+RxSG1sj5BeDnVy8NMj/fbMeb82hDlLx fEBL2uaWjm6Syd4E8X14TnPmgjPCssQIV+qEeGXMQbw8tTKZveTt1a5ZHMPiT3vR9q pV08hkZsHPagw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Subject: [PATCH v5 5/9] mtd: rawnand: denali: use bool type instead of int where appropriate Date: Tue, 2 Apr 2019 13:03:05 +0900 Message-Id: <1554177789-15414-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> References: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_210344_367056_850BD9D5 X-CRM114-Status: GOOD ( 14.79 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [210.131.2.74 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.74 listed in list.dnswl.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , Richard Weinberger , Boris Brezillon , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Use 'bool' type for the following boolean parameters. - write (write or read?) - dma_avail (DMA engine available or not?) Signed-off-by: Masahiro Yamada --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - Use bool for dma_avail as well drivers/mtd/nand/raw/denali.c | 23 ++++++++++++----------- drivers/mtd/nand/raw/denali.h | 4 ++-- 2 files changed, 14 insertions(+), 13 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index b9bc406..a501d9e 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -533,7 +533,7 @@ static int denali_sw_ecc_fixup(struct nand_chip *chip, } static void denali_setup_dma64(struct denali_nand_info *denali, - dma_addr_t dma_addr, int page, int write) + dma_addr_t dma_addr, int page, bool write) { uint32_t mode; const int page_count = 1; @@ -547,7 +547,8 @@ static void denali_setup_dma64(struct denali_nand_info *denali, * burst len = 64 bytes, the number of pages */ denali->host_write(denali, mode, - 0x01002000 | (64 << 16) | (write << 8) | page_count); + 0x01002000 | (64 << 16) | + (write ? BIT(8) : 0) | page_count); /* 2. set memory low address */ denali->host_write(denali, mode, lower_32_bits(dma_addr)); @@ -557,7 +558,7 @@ static void denali_setup_dma64(struct denali_nand_info *denali, } static void denali_setup_dma32(struct denali_nand_info *denali, - dma_addr_t dma_addr, int page, int write) + dma_addr_t dma_addr, int page, bool write) { uint32_t mode; const int page_count = 1; @@ -568,7 +569,7 @@ static void denali_setup_dma32(struct denali_nand_info *denali, /* 1. setup transfer type and # of pages */ denali->host_write(denali, mode | page, - 0x2000 | (write << 8) | page_count); + 0x2000 | (write ? BIT(8) : 0) | page_count); /* 2. set memory high address bits 23:8 */ denali->host_write(denali, mode | ((dma_addr >> 16) << 8), 0x2200); @@ -628,7 +629,7 @@ static int denali_pio_write(struct denali_nand_info *denali, const u32 *buf, } static int denali_pio_xfer(struct denali_nand_info *denali, void *buf, - size_t size, int page, int write) + size_t size, int page, bool write) { if (write) return denali_pio_write(denali, buf, size, page); @@ -637,7 +638,7 @@ static int denali_pio_xfer(struct denali_nand_info *denali, void *buf, } static int denali_dma_xfer(struct denali_nand_info *denali, void *buf, - size_t size, int page, int write) + size_t size, int page, bool write) { dma_addr_t dma_addr; uint32_t irq_mask, irq_status, ecc_err_mask; @@ -694,7 +695,7 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf, } static int denali_page_xfer(struct nand_chip *chip, void *buf, size_t size, - int page, int write) + int page, bool write) { struct denali_nand_info *denali = to_denali(chip); @@ -715,7 +716,7 @@ static int denali_read_page(struct nand_chip *chip, uint8_t *buf, int stat = 0; int ret; - ret = denali_page_xfer(chip, buf, mtd->writesize, page, 0); + ret = denali_page_xfer(chip, buf, mtd->writesize, page, false); if (ret && ret != -EBADMSG) return ret; @@ -744,7 +745,7 @@ static int denali_write_page(struct nand_chip *chip, const uint8_t *buf, { struct mtd_info *mtd = nand_to_mtd(chip); - return denali_page_xfer(chip, (void *)buf, mtd->writesize, page, 1); + return denali_page_xfer(chip, (void *)buf, mtd->writesize, page, true); } static int denali_setup_data_interface(struct nand_chip *chip, int chipnr, @@ -1001,7 +1002,7 @@ static int denali_attach_chip(struct nand_chip *chip) int ret; if (ioread32(denali->reg + FEATURES) & FEATURES__DMA) - denali->dma_avail = 1; + denali->dma_avail = true; if (denali->dma_avail) { int dma_bit = denali->caps & DENALI_CAP_DMA_64BIT ? 64 : 32; @@ -1010,7 +1011,7 @@ static int denali_attach_chip(struct nand_chip *chip) if (ret) { dev_info(denali->dev, "Failed to set DMA mask. Disabling DMA.\n"); - denali->dma_avail = 0; + denali->dma_avail = false; } } diff --git a/drivers/mtd/nand/raw/denali.h b/drivers/mtd/nand/raw/denali.h index 4447184..d2603c6 100644 --- a/drivers/mtd/nand/raw/denali.h +++ b/drivers/mtd/nand/raw/denali.h @@ -303,7 +303,7 @@ struct denali_nand_info { u32 irq_mask; /* interrupts we are waiting for */ u32 irq_status; /* interrupts that have happened */ int irq; - int dma_avail; /* can support DMA? */ + bool dma_avail; /* can support DMA? */ int devs_per_cs; /* devices connected in parallel */ int oob_skip_bytes; /* number of bytes reserved for BBM */ int max_banks; @@ -313,7 +313,7 @@ struct denali_nand_info { u32 (*host_read)(struct denali_nand_info *denali, u32 addr); void (*host_write)(struct denali_nand_info *denali, u32 addr, u32 data); void (*setup_dma)(struct denali_nand_info *denali, dma_addr_t dma_addr, - int page, int write); + int page, bool write); }; #define DENALI_CAP_HW_ECC_FIXUP BIT(0) From patchwork Tue Apr 2 04:03:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 161599 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1257265jan; Mon, 1 Apr 2019 21:04:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrkO+vQER9yqA2jbLPH1Y6hdLAwhA2/Ti0IU6qwFGbRo52Xfn/PQiTIU16cogPBHEtQHyB X-Received: by 2002:a62:3583:: with SMTP id c125mr24496759pfa.169.1554177863629; Mon, 01 Apr 2019 21:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554177863; cv=none; d=google.com; s=arc-20160816; b=y+XiZ98ikKfDC0iIqXZPIIgYdzNwJxe/ft486PB+iss8/FQMWpabzy6IPoFy7atCWu Gv7MWripa7PNHa2sqzyllMiCkZHWTzL8KdngCjdcnpvrXy2MT+eS5nEaB0bdpHBnQKJV lxdmSocZrFpuf6qlqszmPF/S46C1qmGBoUOildGcMlw6q3fgkxk8Cm0C0Ywt/5a6ueoe ZCvg1zIFSJpCpVPawzXYUvTQFEl581xEIVUgLLaLfkrHQE5z+1B+aOcLp1qe6eJAF0e+ x1EpuFHm5nbL9LjXSUt6YiBNNBYLsnoxIdNJyhS8A2+PvI3Phj+9GRX2B95bRZMQo+sX Jmqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=W8TLWvrLBsyxjczJ0E+m66g5/PlSU12vnrjz2amdpG4=; b=cjt96ON8SgLdc/vBCy7C1A+aTZtCiEYTBUgF2CIX9WCCHI7+c2oHy77IjK4Q7iM/vS TDsQCTwkVWZTEeptKTdw76YW3f0beFFTeM81S8IiZA/vqKzjZcCGh9djZVxiG4HaDmG1 reenj0SENQu9nVYVdDVbkpZLQrGj8skK7as5ov5+wXQISfT/uu3W8f/pLtO47Vb3TTrZ ZznMvLPkuBY3rXSQIbLyhfOegnL27ykUbhAnYbI9mM0mbp0kzvDDbMO5dbg7gH72wKl8 ZoJYBQccQ02wk+X1q6OyVejvTe4DzY1xWIUhVSJdLxvAGeHJHnTfli5AcZBbuY7a1LpF 4AMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=JI+aMpJC; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=fGhsNWLk; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id o4si10281901pgr.158.2019.04.01.21.04.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 21:04:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=JI+aMpJC; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=fGhsNWLk; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=W8TLWvrLBsyxjczJ0E+m66g5/PlSU12vnrjz2amdpG4=; b=JI+aMpJC0OOhX0F2ySf9Md0Mxh +TxoKlnUL72/X2eAR1eoiOHp+xwKTT5HS3AJ1ykSWMT3iZzMlNBO7HZZchBGnU/gzH3EMHpXL8/Aj OrDc7ZYLrrjCNQ3XUJ4Ns2rmi3+agqetHeVRuhoIuriYEvlEm83nzN+5mFBQwcQj3l6yZff3UlC5E kMJcAlYGbIthznFFIoQSCeYx83ehcR13kYEpmSYat+kwuFS/pnVQu998Ko1cEuVYmXniMR5xOz7T2 znYnB3VDpuHp/HV2NmkkzXfAjoXpOGe2oVQWLgvtkVqgmph4yVujvmLPJ65LR8f18iqQdcoEftYtm pgR82DGg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAej-0000PX-S7; Tue, 02 Apr 2019 04:04:13 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAeG-0008D0-1G for linux-mtd@lists.infradead.org; Tue, 02 Apr 2019 04:03:47 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id x3243HaZ021871; Tue, 2 Apr 2019 13:03:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x3243HaZ021871 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1554177804; bh=dTKU5woaZ+/VtCj4y62Lf6G8K4/FvWqomirsTxXN8f8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fGhsNWLkf9bQ52JgYGLYvF/50waWpHpGFxUAHW+l9uv1T2vdI6WLZmNHH/x2C1nov pVKVjHeUZOig3mam//M442LqP3WCsWla01BagPi072LzZe5/U73BeLZcAEQnQiYFJT pJQahn9G6WIiSrQ/+APrJ3/MKg4tGhZ4x9za25ul+L8bwHCdF3SvcKr/XzuDkWOXUB hOd1BDpzu3chPIh1hQeNUfzhhIQeMwUlYPzF9J0xVkMvHzV6tp5pQ65h0aZlzgnIYI WkOnGIF4QXT+ebwbGQ+GQHzmGMR2pGWMkL1rBNNdmylEBlbsRNkGkINC/4c9qYGxdh reycrB+VJVgVQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Subject: [PATCH v5 6/9] mtd: rawnand: denali_pci: rename goto labels Date: Tue, 2 Apr 2019 13:03:06 +0900 Message-Id: <1554177789-15414-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> References: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_210344_382236_FACB898D X-CRM114-Status: GOOD ( 11.35 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.74 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [210.131.2.74 listed in wl.mailspike.net] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , Richard Weinberger , Boris Brezillon , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org As Documentation/process/coding-style.rst says, choose label names which say what the goto does. The out_ label style is already used in denali_dt.c. Rename likewise for denali_pci.c Signed-off-by: Masahiro Yamada --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/mtd/nand/raw/denali_pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali_pci.c b/drivers/mtd/nand/raw/denali_pci.c index 48e9ac5..02eb599 100644 --- a/drivers/mtd/nand/raw/denali_pci.c +++ b/drivers/mtd/nand/raw/denali_pci.c @@ -84,20 +84,20 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) if (!denali->host) { dev_err(&dev->dev, "Spectra: ioremap_nocache failed!"); ret = -ENOMEM; - goto failed_remap_reg; + goto out_unmap_reg; } ret = denali_init(denali); if (ret) - goto failed_remap_mem; + goto out_unmap_host; pci_set_drvdata(dev, denali); return 0; -failed_remap_mem: +out_unmap_host: iounmap(denali->host); -failed_remap_reg: +out_unmap_reg: iounmap(denali->reg); return ret; } From patchwork Tue Apr 2 04:03:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 161596 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1256964jan; Mon, 1 Apr 2019 21:04:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIT0k4ICrEID9CzdwC7/jCxYkvM9QQWmcyEwe2dfWXGh+TnYG08qAOVtskgH1eHeGl8iWd X-Received: by 2002:a65:5303:: with SMTP id m3mr63817157pgq.292.1554177840411; Mon, 01 Apr 2019 21:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554177840; cv=none; d=google.com; s=arc-20160816; b=pOgALCmQYHkSgg5cFYkdwggbJye7BJBPHL1Upk03TgBZe7DhhyvOGxzRCJk4wbIbZw ttPfZuE206xT4pr1zE+5EDlpoT72jvrY1MBuwgcunrGqm3bTybLJY2CxIyXaQKZqo2CU i3zQNIfxUvvMCres/kEzULfoYBdmGGMxBm5KbMgBGYgncYF8J1PmAyyrMvQFQl2xDqJV RwDUOQ6imMfMk1qqwLjJd0l4fyS+Tg7YVswsmDSbCgJF/2KrwqIMchRulEI3OGD15v0Q 5vC6ER/h75Y2IaTfuXB+rOUfh/y6wKTwrlYNsZ8wQSwElh0k+qPkhMjrAMeL475I3kNz aEww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=KuLN6APH1MF5Hkl5JzpcFN3fazN8KpVqneRw7+8p+rs=; b=Hup31cPJd2PSlL5+a28Q2eGFobjfEqnfBk0SfvLt4dO6GXc1Jubvfrx9iFzVIzXjSH sbYQSJXF3Ks7WTjBSkrzuJD72SkVVGR6CanDfnPITJhQvAh64NKXbH4cjm76RRg9dNue vl8AHzdpamyLT8PWw72CB6Ba/R7y+dOIgS5g3gzfvBFbRN5mnw+hg2LH39A9nItPVHXZ Ho6DHCit7+6tdYp2bkA4Uxe78UafUNpQ4QYuigAw/iZxXdQFK4fJoASc9ch7cdpplalg NhSYY7gvqmte1QG2MySUEsEQk55jTNmkFZ4HrfVweP46TEmpp3YIFoZ50b7nzwEVbfWX J23g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=aQhH9WKF; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=dA8jCy2Y; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id n18si10467448pgb.91.2019.04.01.21.04.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 21:04:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=aQhH9WKF; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=dA8jCy2Y; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=KuLN6APH1MF5Hkl5JzpcFN3fazN8KpVqneRw7+8p+rs=; b=aQhH9WKFgRM8CnBgjMZhlQaOw9 qDcMabduAilioeTeFc2Xp4tDjPFhgPoJ23RoO5qRfhsGDC08KUXlK9rVxVOoIClmB9CKH6aHnHGwf FsgeEGOlZF83aIgegCCTwz8RprAu9yvl1WDO4AyPPq/+gbGv+31lFugdt7hTO5m4srWyAMU7WgoX2 p3w92YpxCy7uEr27f+ILdY5Sq3bkzyVs+kCBEUiGqdZJBpx7E8af+Ff1CGGWcuQs/plZB/A05gTmy HbxrcX9kzx0v49j9annXd8FcVpDQbTgtNALXAl4VwuKd9TTxvnMKuiLbiYd82yu7/gUkrrX7oRCd3 NS+2v9CQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAeK-0008FN-DL; Tue, 02 Apr 2019 04:03:48 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAeG-0008Cw-1C for linux-mtd@lists.infradead.org; Tue, 02 Apr 2019 04:03:45 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id x3243Hab021871; Tue, 2 Apr 2019 13:03:25 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x3243Hab021871 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1554177807; bh=980FdvUomFNwVGg8bn0Nn0Bzbo9qhxxbdHbHtPN2Q0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dA8jCy2YPFzHxOwZ/7ESGIRn1rQ/xdG3j2V8+/X3yfXZGxWtBrgjYRpNID9LREdPL mcTfJzqzY7MJwNDZEcJ+lAoBIwGrFSESjIeTnFB9E0N0negwEbFHqXY9mjpSTcQcfD VPNCtft9gVeyuEUgH5DNoU3mcvXogF0WB0/PDxiyzQyx+YVTCS62WnVPAvmkKzOuo/ LpRVTj30ZDR5pfHx6wZKPPcg0QO1aMSOhMgd4O+bLKwyX0RBHvAOuCOjrm5NR/4x+m JhnWezias5Cdk+BkljMsnPgubEohKJrcEoobIvB7V8QFjnp6JULIB3Ypc/gQKbuTxG pwgtfd/jn+rEw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Subject: [PATCH v5 8/9] mtd: rawnand: denali: remove DENALI_NR_BANKS macro Date: Tue, 2 Apr 2019 13:03:08 +0900 Message-Id: <1554177789-15414-9-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> References: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_210344_365956_5088C824 X-CRM114-Status: GOOD ( 10.85 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.74 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [210.131.2.74 listed in wl.mailspike.net] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , Richard Weinberger , Boris Brezillon , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Use the runtime-detected denali->nbanks instead of hard-coded DENALI_NR_BANKS (=4). The actual number of banks depends on the IP configuration, and can be less than DENALI_NR_BANKS. It is pointless to touch registers of unsupported banks. Signed-off-by: Masahiro Yamada --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/mtd/nand/raw/denali.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index 8722762..e918c3d 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -40,7 +40,6 @@ #define DENALI_BANK(denali) ((denali)->active_bank << 24) #define DENALI_INVALID_BANK -1 -#define DENALI_NR_BANKS 4 static struct denali_chip *to_denali_chip(struct nand_chip *chip) { @@ -92,7 +91,7 @@ static void denali_enable_irq(struct denali_controller *denali) { int i; - for (i = 0; i < DENALI_NR_BANKS; i++) + for (i = 0; i < denali->nbanks; i++) iowrite32(U32_MAX, denali->reg + INTR_EN(i)); iowrite32(GLOBAL_INT_EN_FLAG, denali->reg + GLOBAL_INT_ENABLE); } @@ -101,7 +100,7 @@ static void denali_disable_irq(struct denali_controller *denali) { int i; - for (i = 0; i < DENALI_NR_BANKS; i++) + for (i = 0; i < denali->nbanks; i++) iowrite32(0, denali->reg + INTR_EN(i)); iowrite32(0, denali->reg + GLOBAL_INT_ENABLE); } @@ -117,7 +116,7 @@ static void denali_clear_irq_all(struct denali_controller *denali) { int i; - for (i = 0; i < DENALI_NR_BANKS; i++) + for (i = 0; i < denali->nbanks; i++) denali_clear_irq(denali, i, U32_MAX); } @@ -130,7 +129,7 @@ static irqreturn_t denali_isr(int irq, void *dev_id) spin_lock(&denali->irq_lock); - for (i = 0; i < DENALI_NR_BANKS; i++) { + for (i = 0; i < denali->nbanks; i++) { irq_status = ioread32(denali->reg + INTR_STATUS(i)); if (irq_status) ret = IRQ_HANDLED;