All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd/nand.c: Remove unnecessarily repeated step
@ 2016-10-10  4:44 Ahmed Samir Khalil
  2016-10-13 21:15 ` Benoît Thébaudeau
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmed Samir Khalil @ 2016-10-10  4:44 UTC (permalink / raw
  To: u-boot

Getting the current NAND device is already done once as part
 of nand command. Therefore, repeating this step as part of
 the sub-commands is unnecessary.

Signed-off-by: Ahmed Samir Khalil <engkhalil86@gmail.com>
---
 cmd/nand.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/cmd/nand.c b/cmd/nand.c
index ec7f1df..71ffe85 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -528,8 +528,6 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		if (set_dev(dev))
 			return 1;
 
-		mtd = nand_info[dev];
-
 		memset(&opts, 0, sizeof(opts));
 		opts.offset = off;
 		opts.length = size;
@@ -597,8 +595,6 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			if (set_dev(dev))
 				return 1;
 
-			mtd = nand_info[dev];
-
 			if (argc > 4 && !str2long(argv[4], &pagecount)) {
 				printf("'%s' is not a number\n", argv[4]);
 				return 1;
@@ -626,8 +622,6 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			rwsize = size;
 		}
 
-		mtd = nand_info[dev];
-
 		if (!s || !strcmp(s, ".jffs2") ||
 		    !strcmp(s, ".e") || !strcmp(s, ".i")) {
 			if (read)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] cmd/nand.c: Remove unnecessarily repeated step
  2016-10-10  4:44 [U-Boot] [PATCH] cmd/nand.c: Remove unnecessarily repeated step Ahmed Samir Khalil
@ 2016-10-13 21:15 ` Benoît Thébaudeau
  0 siblings, 0 replies; 2+ messages in thread
From: Benoît Thébaudeau @ 2016-10-13 21:15 UTC (permalink / raw
  To: u-boot

Dear Ahmed Samir Khalil,

On Mon, Oct 10, 2016 at 6:44 AM, Ahmed Samir Khalil
<engkhalil86@gmail.com> wrote:
> Getting the current NAND device is already done once as part
>  of nand command. Therefore, repeating this step as part of
>  the sub-commands is unnecessary.
>
> Signed-off-by: Ahmed Samir Khalil <engkhalil86@gmail.com>
> ---
>  cmd/nand.c | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/cmd/nand.c b/cmd/nand.c
> index ec7f1df..71ffe85 100644
> --- a/cmd/nand.c
> +++ b/cmd/nand.c
> @@ -528,8 +528,6 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>                 if (set_dev(dev))
>                         return 1;
>
> -               mtd = nand_info[dev];
> -
>                 memset(&opts, 0, sizeof(opts));
>                 opts.offset = off;
>                 opts.length = size;
> @@ -597,8 +595,6 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>                         if (set_dev(dev))
>                                 return 1;
>
> -                       mtd = nand_info[dev];
> -
>                         if (argc > 4 && !str2long(argv[4], &pagecount)) {
>                                 printf("'%s' is not a number\n", argv[4]);
>                                 return 1;
> @@ -626,8 +622,6 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>                         rwsize = size;
>                 }
>
> -               mtd = nand_info[dev];
> -
>                 if (!s || !strcmp(s, ".jffs2") ||
>                     !strcmp(s, ".e") || !strcmp(s, ".i")) {
>                         if (read)

Quickly looking at the code, these assignments of mtd directly follow
calls to mtd_arg_off_size(), which may alter dev, so they are required
and should not be removed. This is even mentioned in the comment block
above the initialization of mtd that you refer to: "The following
commands operate on the current device, _unless overridden by a
partition specifier_.".

Best regards,
Beno?t

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-13 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-10  4:44 [U-Boot] [PATCH] cmd/nand.c: Remove unnecessarily repeated step Ahmed Samir Khalil
2016-10-13 21:15 ` Benoît Thébaudeau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.