From patchwork Mon Jan 21 06:32:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 156150 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6030130jaa; Sun, 20 Jan 2019 22:32:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN6QqeCEaD6HKyMwg4UhunCcTj6p9ni8nxTKjm0sS7yeCRERb7/Tvs3dWyGCATVchyZippg/ X-Received: by 2002:a17:902:6bc7:: with SMTP id m7mr29396798plt.106.1548052366994; Sun, 20 Jan 2019 22:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548052366; cv=none; d=google.com; s=arc-20160816; b=jJT9Vf6RPTPQ7xii2AVinD6rIwQoVJ35Bq6aBMRPxICrwx2PhGUc7rubVEzm/Zjctb Jvl2h1i3gYXXD2D6ISfNmGAGtYs4ffTC7Xp9Ctg6bsvKyIiGsHxkNQeQUHlEgWpg6Qcg Z7pmo+WPxZhxRjKPky4fucTqqpjjLOy5nsYPHzpTlut9aTM15ytgyMe4lOi3saTaRoXo dp0bHmuH5gfSqq8aG+Io7Y1dLCHk4KFP4jcRK6Aeo6gNNh1nUbHq2QjpWjODyZydncMp u15MOmB1hF4Ro0X5iIszUXIm74U+xdzB1tdntZNsUBo0Q/v0W6vL1eBZe6DaYd3/KK/S ncrQ== 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:message-id:date:subject:to:from:dkim-signature :dkim-filter:dkim-signature; bh=p2ObmwWUMD3kBMeXqFB6T8j9+k/rEU6ksyM0YRaLJtk=; b=qXElxVLe/tgj8TjMWIt/aCbKzdJnNw6MiEcE4sUr1JJ4/HH5SvBjciP2/UVciibFnp t+2PKhkbr0uEUpe5Po8FlzoZsAt20MAgp7CPDUJRI80wIys45RNoaKYTb4Vd+KaybaLE fVkvlO39OKJAuARLewt3EILIkhzjI60NqFkPDDwF3+XQrBO1A9EXeMMd18eOEyFyW/M1 bg9IuvfQwm9iaDUJ+KjtJRGRjvyUbC8vVhmwHlKDSr4MIvZGl1QubfXXsz+0A1anmO/A FNM5QHHMNhR84WarQSsJikgj76mZ7AgZ2bddNaLIkrqkL921/0o20hu7IpjUymXWHT6Q gO+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=qMZwxmJi; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=BZDt5m8Z; 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 f186si4805805pfb.67.2019.01.20.22.32.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Jan 2019 22:32:46 -0800 (PST) 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=qMZwxmJi; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=BZDt5m8Z; 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: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:In-Reply-To: References:List-Owner; bh=p2ObmwWUMD3kBMeXqFB6T8j9+k/rEU6ksyM0YRaLJtk=; b=qMZ wxmJiDCXNv4vjngyFMWxvXvrWq94gZ+ni41UtiVu//dfzkl1ERyu2TuSfGraWTjMZ29shhVWOR1gn I31H+ZsqryEv49PTcJYTOVGjEWebWW/Jf37K/d5AVDTE6v8omOQVRvdAw3vjfdYZLtsTrfwRPamLX q/R8r+rHyHj5MEH32qN7vKFV79mF0Fs+OQz9MzJq2rCl8KRGa8lp2AKXlbfE9WaCpb4Csow4RXSOo QfxaaEnK79YkbYYfnkh/As+P52BBOdDz3bo/ft1uA3LknSLqg/VjGDQ6WKwuIoIxthj9kjQ/YX6HM zJatXhSwLCfbBD8w9HVeF3Y3iIIr3VA==; 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 1glT8P-0000Xz-LE; Mon, 21 Jan 2019 06:32:37 +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 1glT8J-0000XX-CU for linux-mtd@lists.infradead.org; Mon, 21 Jan 2019 06:32:33 +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 x0L6WCPC003098; Mon, 21 Jan 2019 15:32:13 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x0L6WCPC003098 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1548052333; bh=qrh/ZcVeEBRczMZx/DNnPsCU/3ppDsvTOZXlUv3uS90=; h=From:To:Cc:Subject:Date:From; b=BZDt5m8ZX+oGTcNyNLj6dly8ZyqgwpbvGocWGu5X8myzZosRQGKmXE5hp+6CFcyKG sjovxM/VtDF+Pqe3U4dDOQ7JDYm/cKuuoLElr4hb36/B3w2Rn1avvFPB8jesJzrEbU enEuwao6qwfXcErDo18UjbMFYRaCQVQQ8yHVsb7S4yIkJ5RvcRFRKg5fj6oKNoVnVg 2CXMYsZuKTCMMJlBJRKFqZTlXMZj/2bW8AmABLpwuui0EwyEa5DsEbiYZLVPu7iVAf xTWhyFyiTdx6DANV8NzwxZHAnnK+4VVG5qwIk+TjPcfA3SNu275K658A7MzyNA7xqT j/BgSva9Sjv+w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Boris Brezillon , Miquel Raynal Subject: [PATCH v2] mtd: rawnand: remove ->legacy.erase and single_erase() Date: Mon, 21 Jan 2019 15:32:07 +0900 Message-Id: <1548052327-26483-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190120_223231_655670_813084FF X-CRM114-Status: GOOD ( 15.01 ) 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 http://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: Marek Vasut , Richard Weinberger , Boris Brezillon , linux-kernel@vger.kernel.org, Masahiro Yamada , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Now that the last user of this hook, denali.c, stopped using it, we can remove the erase hook from nand_legacy. I squashed single_erase() because only the difference between single_erase() and nand_erase_op() is the number of bit shifts. The status/ret conversion in nand_erase_nand() is unneeded since commit eb94555e9e97 ("mtd: nand: use usual return values for the ->erase() hook"). Cleaned it up now. Signed-off-by: Masahiro Yamada --- This depends on the denali patch: http://patchwork.ozlabs.org/patch/1028264/ Changes in v2: - I noticed the masking by chip->pagemask is still needed drivers/mtd/nand/raw/nand_base.c | 31 ++++--------------------------- include/linux/mtd/rawnand.h | 2 -- 2 files changed, 4 insertions(+), 29 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index cca4b24..7ea3f10 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -4155,23 +4155,6 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to, } /** - * single_erase - [GENERIC] NAND standard block erase command function - * @chip: NAND chip object - * @page: the page address of the block which will be erased - * - * Standard erase command for NAND chips. Returns NAND status. - */ -static int single_erase(struct nand_chip *chip, int page) -{ - unsigned int eraseblock; - - /* Send commands to erase a block */ - eraseblock = page >> (chip->phys_erase_shift - chip->page_shift); - - return nand_erase_op(chip, eraseblock); -} - -/** * nand_erase - [MTD Interface] erase block(s) * @mtd: MTD device structure * @instr: erase instruction @@ -4194,7 +4177,7 @@ static int nand_erase(struct mtd_info *mtd, struct erase_info *instr) int nand_erase_nand(struct nand_chip *chip, struct erase_info *instr, int allowbbt) { - int page, status, pages_per_block, ret, chipnr; + int page, pages_per_block, ret, chipnr; loff_t len; pr_debug("%s: start = 0x%012llx, len = %llu\n", @@ -4246,17 +4229,11 @@ int nand_erase_nand(struct nand_chip *chip, struct erase_info *instr, (page + pages_per_block)) chip->pagebuf = -1; - if (chip->legacy.erase) - status = chip->legacy.erase(chip, - page & chip->pagemask); - else - status = single_erase(chip, page & chip->pagemask); - - /* See if block erase succeeded */ - if (status) { + ret = nand_erase_op(chip, (page & chip->pagemask) >> + (chip->phys_erase_shift - chip->page_shift)); + if (ret) { pr_debug("%s: failed erase, page 0x%08x\n", __func__, page); - ret = -EIO; instr->fail_addr = ((loff_t)page << chip->page_shift); goto erase_exit; diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 33e240a..5e37534 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -936,7 +936,6 @@ static inline void nand_controller_init(struct nand_controller *nfc) * @waitfunc: hardware specific function for wait on ready. * @block_bad: check if a block is bad, using OOB markers * @block_markbad: mark a block bad - * @erase: erase function * @set_features: set the NAND chip features * @get_features: get the NAND chip features * @chip_delay: chip dependent delay for transferring data from array to read @@ -962,7 +961,6 @@ struct nand_legacy { int (*waitfunc)(struct nand_chip *chip); int (*block_bad)(struct nand_chip *chip, loff_t ofs); int (*block_markbad)(struct nand_chip *chip, loff_t ofs); - int (*erase)(struct nand_chip *chip, int page); int (*set_features)(struct nand_chip *chip, int feature_addr, u8 *subfeature_para); int (*get_features)(struct nand_chip *chip, int feature_addr,