From patchwork Fri Aug 17 16:09:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 10569157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F8B95A4 for ; Fri, 17 Aug 2018 16:12:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F1F32BD85 for ; Fri, 17 Aug 2018 16:12:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41C202BDDF; Fri, 17 Aug 2018 16:12:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A6FA22BD85 for ; Fri, 17 Aug 2018 16:12:26 +0000 (UTC) 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=TLCeDVUo2lTlDnor5NZV4/8QvL8Rwt893ylRpvA6WNw=; b=fyOtpLKl5Htd4kBD67ipSZhCWe WAc6/hYqLiQLTFA/3pzq/KdyD9EGoWrgd7SnKooK7MbdYGlNNNP+oVwu0J5IqeSCWvYCxclD2VPp4 wx54dfoEemhp7xShtCYSCk4qYX3B8wWCBFjsBw25ACYrxSVsuuAliuXeCYcELwQT9qrNTAxbaKwH6 HxTUt0anIvu+bqDMAb26cUFrYqHjj9XrCJSwuRlO6u54YeY+JFtvanD08mHKF1TidJe96dC3h5+/K MAL3wtIg2bsGHlrLq+2QoT5QorUky1xv0v0Qa4BL8WzhU654USXtMjx1je9hyTJwDxxlH5awkxWqR hpZFssFg==; 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 1fqhMP-0000Zw-H5 for patchwork-linux-mediatek@patchwork.kernel.org; Fri, 17 Aug 2018 16:12:25 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fqhK2-0004Zm-Rm; Fri, 17 Aug 2018 16:10:27 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 1220E215CB; Fri, 17 Aug 2018 18:09:48 +0200 (CEST) Received: from localhost.localdomain (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id C1549215DC; Fri, 17 Aug 2018 18:09:46 +0200 (CEST) From: Boris Brezillon To: Boris Brezillon , Richard Weinberger , Miquel Raynal , linux-mtd@lists.infradead.org Subject: [PATCH 19/23] mtd: rawnand: Pass a nand_chip object to chip->{get, set}_features() Date: Fri, 17 Aug 2018 18:09:18 +0200 Message-Id: <20180817160922.6224-20-boris.brezillon@bootlin.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180817160922.6224-1-boris.brezillon@bootlin.com> References: <20180817160922.6224-1-boris.brezillon@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180817_090959_949314_C6856EBD X-CRM114-Status: GOOD ( 18.75 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Alexandre Belloni , Rich Felker , linux-doc@vger.kernel.org, Tony Lindgren , linux-mips@linux-mips.org, Stefan Agner , Masahiro Yamada , Mans Rullgard , Robert Jarzmik , Jason Cooper , devel@driverdev.osuosl.org, Maxime Ripard , Maxim Levitsky , Yoshinori Sato , Aaro Koskinen , Gregory Clement , linux-sh@vger.kernel.org, Lukasz Majewski , Neil Armstrong , Marek Vasut , Chen-Yu Tsai , NXP Linux Team , Sylvain Lemieux , Sebastian Hesselbarth , Alexander Clouter , Wan ZongShun , Marc Gonzalez , Sascha Hauer , Haojian Zhuang , Vladimir Zapolskiy , Harvey Hunt , Krzysztof Halasa , Kamal Dasu , Matthias Brugger , Han Xu , Xiaolei Li , linux-omap@vger.kernel.org, Alexander Sverdlin , linux-arm-kernel@lists.infradead.org, Brian Norris , David Woodhouse , Jonathan Corbet , Nicolas Ferre , Ralf Baechle , Hartley Sweeten , Pengutronix Kernel Team , Greg Kroah-Hartman , Fabio Estevam , linux-mediatek@lists.infradead.org, Imre Kaloz , Shawn Guo , Daniel Mack MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one or remove the mtd_info object when both are passed. Let's tackle the chip->{get,set}_features() hooks. Signed-off-by: Boris Brezillon --- drivers/mtd/nand/raw/mxc_nand.c | 16 ++++++++-------- drivers/mtd/nand/raw/nand_base.c | 21 ++++++--------------- include/linux/mtd/rawnand.h | 12 ++++++------ 3 files changed, 20 insertions(+), 29 deletions(-) diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c index a03a33656cf4..ec150e19a368 100644 --- a/drivers/mtd/nand/raw/mxc_nand.c +++ b/drivers/mtd/nand/raw/mxc_nand.c @@ -1393,11 +1393,11 @@ static void mxc_nand_command(struct nand_chip *nand_chip, unsigned command, } } -static int mxc_nand_set_features(struct mtd_info *mtd, struct nand_chip *chip, - int addr, u8 *subfeature_param) +static int mxc_nand_set_features(struct nand_chip *chip, int addr, + u8 *subfeature_param) { - struct nand_chip *nand_chip = mtd_to_nand(mtd); - struct mxc_nand_host *host = nand_get_controller_data(nand_chip); + struct mtd_info *mtd = nand_to_mtd(chip); + struct mxc_nand_host *host = nand_get_controller_data(chip); int i; host->buf_start = 0; @@ -1413,11 +1413,11 @@ static int mxc_nand_set_features(struct mtd_info *mtd, struct nand_chip *chip, return 0; } -static int mxc_nand_get_features(struct mtd_info *mtd, struct nand_chip *chip, - int addr, u8 *subfeature_param) +static int mxc_nand_get_features(struct nand_chip *chip, int addr, + u8 *subfeature_param) { - struct nand_chip *nand_chip = mtd_to_nand(mtd); - struct mxc_nand_host *host = nand_get_controller_data(nand_chip); + struct mtd_info *mtd = nand_to_mtd(chip); + struct mxc_nand_host *host = nand_get_controller_data(chip); int i; host->devtype_data->send_cmd(host, NAND_CMD_GET_FEATURES, false); diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 26be436eb8f1..0ae597ced5b4 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -1163,12 +1163,10 @@ static bool nand_supports_set_features(struct nand_chip *chip, int addr) int nand_get_features(struct nand_chip *chip, int addr, u8 *subfeature_param) { - struct mtd_info *mtd = nand_to_mtd(chip); - if (!nand_supports_get_features(chip, addr)) return -ENOTSUPP; - return chip->get_features(mtd, chip, addr, subfeature_param); + return chip->get_features(chip, addr, subfeature_param); } EXPORT_SYMBOL_GPL(nand_get_features); @@ -1184,12 +1182,10 @@ EXPORT_SYMBOL_GPL(nand_get_features); int nand_set_features(struct nand_chip *chip, int addr, u8 *subfeature_param) { - struct mtd_info *mtd = nand_to_mtd(chip); - if (!nand_supports_set_features(chip, addr)) return -ENOTSUPP; - return chip->set_features(mtd, chip, addr, subfeature_param); + return chip->set_features(chip, addr, subfeature_param); } EXPORT_SYMBOL_GPL(nand_set_features); @@ -4846,13 +4842,11 @@ static int nand_max_bad_blocks(struct mtd_info *mtd, loff_t ofs, size_t len) /** * nand_default_set_features- [REPLACEABLE] set NAND chip features - * @mtd: MTD device structure * @chip: nand chip info structure * @addr: feature address. * @subfeature_param: the subfeature parameters, a four bytes array. */ -static int nand_default_set_features(struct mtd_info *mtd, - struct nand_chip *chip, int addr, +static int nand_default_set_features(struct nand_chip *chip, int addr, uint8_t *subfeature_param) { return nand_set_features_op(chip, addr, subfeature_param); @@ -4860,13 +4854,11 @@ static int nand_default_set_features(struct mtd_info *mtd, /** * nand_default_get_features- [REPLACEABLE] get NAND chip features - * @mtd: MTD device structure * @chip: nand chip info structure * @addr: feature address. * @subfeature_param: the subfeature parameters, a four bytes array. */ -static int nand_default_get_features(struct mtd_info *mtd, - struct nand_chip *chip, int addr, +static int nand_default_get_features(struct nand_chip *chip, int addr, uint8_t *subfeature_param) { return nand_get_features_op(chip, addr, subfeature_param); @@ -4874,7 +4866,6 @@ static int nand_default_get_features(struct mtd_info *mtd, /** * nand_get_set_features_notsupp - set/get features stub returning -ENOTSUPP - * @mtd: MTD device structure * @chip: nand chip info structure * @addr: feature address. * @subfeature_param: the subfeature parameters, a four bytes array. @@ -4882,8 +4873,8 @@ static int nand_default_get_features(struct mtd_info *mtd, * Should be used by NAND controller drivers that do not support the SET/GET * FEATURES operations. */ -int nand_get_set_features_notsupp(struct mtd_info *mtd, struct nand_chip *chip, - int addr, u8 *subfeature_param) +int nand_get_set_features_notsupp(struct nand_chip *chip, int addr, + u8 *subfeature_param) { return -ENOTSUPP; } diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 469008740e89..471ad78d27a5 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -1299,10 +1299,10 @@ struct nand_chip { const struct nand_operation *op, bool check_only); int (*erase)(struct nand_chip *chip, int page); - int (*set_features)(struct mtd_info *mtd, struct nand_chip *chip, - int feature_addr, uint8_t *subfeature_para); - int (*get_features)(struct mtd_info *mtd, struct nand_chip *chip, - int feature_addr, uint8_t *subfeature_para); + int (*set_features)(struct nand_chip *chip, int feature_addr, + uint8_t *subfeature_para); + int (*get_features)(struct nand_chip *chip, int feature_addr, + uint8_t *subfeature_para); int (*setup_read_retry)(struct mtd_info *mtd, int retry_mode); int (*setup_data_interface)(struct mtd_info *mtd, int chipnr, const struct nand_data_interface *conf); @@ -1681,8 +1681,8 @@ int nand_read_oob_syndrome(struct nand_chip *chip, int page); int nand_get_features(struct nand_chip *chip, int addr, u8 *subfeature_param); int nand_set_features(struct nand_chip *chip, int addr, u8 *subfeature_param); /* Stub used by drivers that do not support GET/SET FEATURES operations */ -int nand_get_set_features_notsupp(struct mtd_info *mtd, struct nand_chip *chip, - int addr, u8 *subfeature_param); +int nand_get_set_features_notsupp(struct nand_chip *chip, int addr, + u8 *subfeature_param); /* Default read_page_raw implementation */ int nand_read_page_raw(struct nand_chip *chip, uint8_t *buf, int oob_required,