Message ID | 20170131213717.30745-5-grygorii.strashko@ti.com |
---|---|
State | Deferred |
Delegated to: | Tom Rini |
Headers | show |
On Tue, Jan 31, 2017 at 03:37:06PM -0600, Grygorii Strashko wrote: > 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> Reviewed-by: Tom Rini <trini@konsulko.com>
On 5 February 2017 at 17:57, Tom Rini <trini@konsulko.com> wrote: > On Tue, Jan 31, 2017 at 03:37:06PM -0600, Grygorii Strashko wrote: > >> 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> > > Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
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) {
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(-)