From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Miquel Raynal <miquel.raynal@bootlin.com>,
linux-mtd@lists.infradead.org
Cc: Andrew Lunn <andrew@lunn.ch>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Rich Felker <dalias@libc.org>,
linux-doc@vger.kernel.org, Tony Lindgren <tony@atomide.com>,
linux-mips@linux-mips.org, Stefan Agner <stefan@agner.ch>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Mans Rullgard <mans@mansr.com>,
Robert Jarzmik <robert.jarzmik@free.fr>,
Jason Cooper <jason@lakedaemon.net>,
devel@driverdev.osuosl.org,
Maxime Ripard <maxime.ripard@bootlin.com>,
Maxim Levitsky <maximlevitsky@gmail.com>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Aaro Koskinen <aaro.koskinen@iki.fi>,
Gregory Clement <gregory.clement@bootlin.com>,
linux-sh@vger.kernel.org, Lukasz Majewski <lukma@denx.de>,
Neil Armstrong <narmstrong@baylibre.com>,
Marek Vasut <marek.vasut@gmail.com>, Chen-Yu Tsai <wens@csie.org>,
NXP Linux Team <linux-imx@nxp.com>,
Sylvain Lemieux <slemieux.tyco@gmail.com>
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 [thread overview]
Message-ID: <20180817160922.6224-20-boris.brezillon@bootlin.com> (raw)
In-Reply-To: <20180817160922.6224-1-boris.brezillon@bootlin.com>
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 <boris.brezillon@bootlin.com>
---
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,
--
2.14.1
next prev parent reply other threads:[~2018-08-17 16:09 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-17 16:08 [PATCH 00/23] mtd: rawnand: Stop passing mtd_info to drivers Boris Brezillon
2018-08-17 16:09 ` [PATCH 01/23] mtd: rawnand: plat_nand: Pass a nand_chip object to all platform_nand_ctrl hooks Boris Brezillon
2018-08-19 10:13 ` Alexander Sverdlin
[not found] ` <20180817160922.6224-2-boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-08-22 19:14 ` Robert Jarzmik
2018-08-22 19:24 ` Boris Brezillon
2018-08-17 16:09 ` [PATCH 02/23] mtd: rawnand: Pass a nand_chip object to nand_scan() & co Boris Brezillon
2018-08-17 16:09 ` [PATCH 03/23] mtd: rawnand: Pass a nand_chip object to nand_release() Boris Brezillon
2018-08-17 16:09 ` [PATCH 04/23] mtd: rawnand: Pass a nand_chip object to nand_wait_ready() Boris Brezillon
2018-08-17 16:09 ` [PATCH 05/23] mtd: rawnand: Pass a nand_chip object to ecc->hwctl() Boris Brezillon
2018-08-17 16:09 ` [PATCH 06/23] mtd: rawnand: Pass a nand_chip object to ecc->calculate() Boris Brezillon
2018-08-17 16:09 ` [PATCH 07/23] mtd: rawnand: Pass a nand_chip object to ecc->correct() Boris Brezillon
2018-08-17 16:09 ` [PATCH 08/23] mtd: rawnand: Pass a nand_chip object to ecc->read_xxx() hooks Boris Brezillon
[not found] ` <20180817160922.6224-9-boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-08-18 8:30 ` Stefan Agner
2018-08-19 11:26 ` Boris Brezillon
2018-08-20 7:57 ` Stefan Agner
[not found] ` <f75fc1c2e3c70cdb6c2f9ca2dbba3f2f-XLVq0VzYD2Y@public.gmane.org>
2018-08-20 8:09 ` Boris Brezillon
2018-08-20 8:57 ` Stefan Agner
2018-08-17 16:09 ` [PATCH 09/23] mtd: rawnand: Pass a nand_chip object to ecc->write_xxx() hooks Boris Brezillon
2018-08-17 16:09 ` [PATCH 10/23] mtd: rawnand: Pass a nand_chip object to chip->read_xxx() hooks Boris Brezillon
2018-08-17 16:09 ` [PATCH 11/23] mtd: rawnand: Pass a nand_chip object to chip->write_xxx() hooks Boris Brezillon
2018-08-17 16:09 ` [PATCH 12/23] mtd: rawnand: Pass a nand_chip object to chip->select_chip() Boris Brezillon
2018-08-17 16:09 ` [PATCH 13/23] mtd: rawnand: Pass a nand_chip object to chip->block_xxx() hooks Boris Brezillon
2018-08-17 16:09 ` [PATCH 14/23] mtd: rawnand: Pass a nand_chip object to chip->cmd_ctrl() Boris Brezillon
2018-08-17 16:09 ` [PATCH 15/23] mtd: rawnand: Pass a nand_chip object to chip->dev_ready() Boris Brezillon
2018-08-17 16:09 ` [PATCH 16/23] mtd: rawnand: Pass a nand_chip object to chip->cmdfunc() Boris Brezillon
2018-08-17 16:09 ` [PATCH 17/23] mtd: rawnand: Pass a nand_chip object to chip->waitfunc() Boris Brezillon
2018-08-17 16:09 ` [PATCH 18/23] mtd: rawnand: Pass a nand_chip object to chip->erase() Boris Brezillon
2018-08-17 16:09 ` Boris Brezillon [this message]
2018-08-17 16:09 ` [PATCH 20/23] mtd: rawnand: Pass a nand_chip object to chip->setup_read_retry() Boris Brezillon
2018-08-17 16:09 ` [PATCH 21/23] mtd: rawnand: Pass a nand_chip object to chip->setup_data_interface() Boris Brezillon
2018-08-17 16:09 ` [PATCH 22/23] mtd: rawnand: Pass a nand_chip object to all nand_xxx_bbt() helpers Boris Brezillon
2018-08-17 16:09 ` [PATCH 23/23] mtd: rawnand: Pass a nand_chip object nand_erase_nand() Boris Brezillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180817160922.6224-20-boris.brezillon@bootlin.com \
--to=boris.brezillon@bootlin.com \
--cc=aaro.koskinen@iki.fi \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=dalias@libc.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregory.clement@bootlin.com \
--cc=jason@lakedaemon.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-mips@linux-mips.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-sh@vger.kernel.org \
--cc=lukma@denx.de \
--cc=mans@mansr.com \
--cc=marek.vasut@gmail.com \
--cc=maxime.ripard@bootlin.com \
--cc=maximlevitsky@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=narmstrong@baylibre.com \
--cc=richard@nod.at \
--cc=robert.jarzmik@free.fr \
--cc=slemieux.tyco@gmail.com \
--cc=stefan@agner.ch \
--cc=tony@atomide.com \
--cc=wens@csie.org \
--cc=yamada.masahiro@socionext.com \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox