From: Grygorii Strashko <grygorii.strashko@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 03/17] dfu: dfu_nand: use get_nand_dev_by_index()
Date: Fri, 10 Feb 2017 14:22:50 -0600 [thread overview]
Message-ID: <20170210202304.20652-4-grygorii.strashko@ti.com> (raw)
In-Reply-To: <20170210202304.20652-1-grygorii.strashko@ti.com>
As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
drivers/dfu/dfu_nand.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index 23f1571..97cd608 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -37,15 +37,15 @@ static int nand_block_op(enum dfu_op op, struct dfu_entity *dfu,
lim = dfu->data.nand.start + dfu->data.nand.size - start;
count = *len;
+ mtd = get_nand_dev_by_index(nand_curr_device);
+
if (nand_curr_device < 0 ||
nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE ||
- !nand_info[nand_curr_device]) {
+ !mtd) {
printf("%s: invalid nand device\n", __func__);
return -1;
}
- mtd = nand_info[nand_curr_device];
-
if (op == DFU_OP_READ) {
ret = nand_read_skip_bad(mtd, start, &count, &actual,
lim, buf);
@@ -143,18 +143,16 @@ static int dfu_flush_medium_nand(struct dfu_entity *dfu)
/* in case of ubi partition, erase rest of the partition */
if (dfu->data.nand.ubi) {
- struct mtd_info *mtd;
+ struct mtd_info *mtd = get_nand_dev_by_index(nand_curr_device);
nand_erase_options_t opts;
if (nand_curr_device < 0 ||
nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE ||
- !nand_info[nand_curr_device]) {
+ !mtd) {
printf("%s: invalid nand device\n", __func__);
return -1;
}
- mtd = nand_info[nand_curr_device];
-
memset(&opts, 0, sizeof(opts));
off = dfu->offset;
if ((off & (mtd->erasesize - 1)) != 0) {
--
2.10.1.dirty
next prev parent reply other threads:[~2017-02-10 20:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-10 20:22 [U-Boot] [PATCH v3 00/17] nand: remove direct acces to nand_info array Grygorii Strashko
2017-02-10 20:22 ` [U-Boot] [PATCH v3 01/17] cmd: nand: abstract global variable usage for dm conversion Grygorii Strashko
2017-02-10 20:22 ` [U-Boot] [PATCH v3 02/17] common: env_nand: use get_nand_dev_by_index() Grygorii Strashko
2017-02-10 20:22 ` Grygorii Strashko [this message]
2017-02-10 20:22 ` [U-Boot] [PATCH v3 04/17] cmd: bootm: " Grygorii Strashko
2017-02-10 20:22 ` [U-Boot] [PATCH v3 05/17] cmd: jffs2: " Grygorii Strashko
2017-02-10 20:22 ` [U-Boot] [PATCH v3 06/17] common: " Grygorii Strashko
2017-02-10 20:22 ` [U-Boot] [PATCH v3 07/17] fs: " Grygorii Strashko
2017-02-10 20:22 ` [U-Boot] [PATCH v3 08/17] cmd: nand: remove direct access to struct mtd_info->priv Grygorii Strashko
2017-02-10 20:22 ` [U-Boot] [PATCH v3 09/17] net: phy: cortina: use get_nand_dev_by_index() Grygorii Strashko
2017-02-10 20:52 ` Joe Hershberger
2017-02-10 20:22 ` [U-Boot] [PATCH v3 10/17] net: fm: " Grygorii Strashko
2017-02-10 20:54 ` Joe Hershberger
2017-02-10 20:22 ` [U-Boot] [PATCH v3 11/17] mtd: nand: drv: " Grygorii Strashko
2017-02-10 20:22 ` [U-Boot] [PATCH v3 12/17] cmd: mvebu: bubt: " Grygorii Strashko
2017-02-10 20:23 ` [U-Boot] [PATCH v3 13/17] board: atmel: " Grygorii Strashko
2017-02-10 20:23 ` [U-Boot] [PATCH v3 14/17] board: ronetix: " Grygorii Strashko
2017-02-10 20:23 ` [U-Boot] [PATCH v3 15/17] board: BuR: " Grygorii Strashko
2017-02-21 11:53 ` Hannes Schmelzer
2017-02-22 4:00 ` Simon Glass
2017-02-10 20:23 ` [U-Boot] [PATCH v3 16/17] board: toradex: " Grygorii Strashko
2017-02-11 1:20 ` Marcel Ziswiler
2017-02-10 20:23 ` [U-Boot] [PATCH v3 17/17] mtd: nand: make nand_info array static Grygorii Strashko
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=20170210202304.20652-4-grygorii.strashko@ti.com \
--to=grygorii.strashko@ti.com \
--cc=u-boot@lists.denx.de \
/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