public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot]  [PATCH]: common/cmd_flash.c: bug-fix
@ 2010-02-12  8:31 Teh Kok How
  2010-02-12  9:00 ` Stefan Roese
  2010-02-12  9:16 ` Teh Kok How
  0 siblings, 2 replies; 9+ messages in thread
From: Teh Kok How @ 2010-02-12  8:31 UTC (permalink / raw)
  To: u-boot

--- u-boot-2009.11.1.orig/common/cmd_flash.c    2010-01-25
16:35:12.000000000 +0800

+++ u-boot-2009.11.1.new/common/cmd_flash.c     2010-02-12
16:18:10.565540182 +0800

@@ -43,6 +43,7 @@

 

 #ifndef CONFIG_SYS_NO_FLASH

 extern flash_info_t flash_info[];      /* info for FLASH chips */

+extern struct mtd_device *current_mtd_dev;

 

 /*

  * The user interface starts numbering for Flash banks with 1

@@ -331,6 +332,7 @@

        u8 dev_type, dev_num, pnum;

 #endif

        int rcode = 0;

+       char mtd_dev[10];

 

        if (argc < 2) {

                cmd_usage(cmdtp);

@@ -359,7 +361,8 @@

 

 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)

        /* erase <part-id> - erase partition */

-       if ((argc == 2) && (mtd_id_parse(argv[1], NULL, &dev_type, &dev_num)
== 0)) {

+        sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(current_mtd_dev->id->type),
current_mtd_dev->id->num);

+       if ((argc == 2) && (mtd_id_parse(mtd_dev, NULL, &dev_type, &dev_num)
== 0)) {

                mtdparts_init();

                if (find_dev_and_part(argv[1], &dev, &pnum, &part) == 0) {

                        if (dev->id->type == MTD_DEV_TYPE_NOR) {

@@ -481,6 +484,7 @@

 #endif

        int p;

        int rcode = 0;

+       char mtd_dev[10];

 

        if (argc < 3) {

                cmd_usage(cmdtp);

@@ -567,7 +571,8 @@

 

 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)

        /* protect on/off <part-id> */

-       if ((argc == 3) && (mtd_id_parse(argv[2], NULL, &dev_type, &dev_num)
== 0)) {

+        sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(current_mtd_dev->id->type),
current_mtd_dev->id->num);

+       if ((argc == 3) && (mtd_id_parse(mtd_dev, NULL, &dev_type, &dev_num)
== 0)) {

                mtdparts_init();

                if (find_dev_and_part(argv[2], &dev, &pnum, &part) == 0) {

                        if (dev->id->type == MTD_DEV_TYPE_NOR) {

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

* [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix
  2010-02-12  8:31 [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix Teh Kok How
@ 2010-02-12  9:00 ` Stefan Roese
  2010-02-12  9:16 ` Teh Kok How
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Roese @ 2010-02-12  9:00 UTC (permalink / raw)
  To: u-boot

On Friday 12 February 2010 09:31:17 Teh Kok How wrote:
> --- u-boot-2009.11.1.orig/common/cmd_flash.c    2010-01-25
> 16:35:12.000000000 +0800
> 
> +++ u-boot-2009.11.1.new/common/cmd_flash.c     2010-02-12
> 16:18:10.565540182 +0800
> 
> @@ -43,6 +43,7 @@
> 
> 
> 
>  #ifndef CONFIG_SYS_NO_FLASH
> 
>  extern flash_info_t flash_info[];      /* info for FLASH chips */
> 
> +extern struct mtd_device *current_mtd_dev;

Sorry, but your patch has several problems:

- What exactly are you trying to fix? Please add a small description
  on what's broken and how your patch fixes it.
- Patch adds empty line after each line
- Patch is line wrapped
- Signed-off-by line missing

Please see here for more details on creating and sending patches:

http://www.denx.de/wiki/view/U-Boot/Patches

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot]   [PATCH]: common/cmd_flash.c: bug-fix
  2010-02-12  8:31 [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix Teh Kok How
  2010-02-12  9:00 ` Stefan Roese
@ 2010-02-12  9:16 ` Teh Kok How
  2010-02-12 10:19   ` Stefan Roese
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Teh Kok How @ 2010-02-12  9:16 UTC (permalink / raw)
  To: u-boot

- What exactly are you trying to fix? Please add a small description
  on what's broken and how your patch fixes it.
=> Fixes wrong argument to mtd_id_parse that affects u-boot command `erase`
and `protect` <part-id>. This fix passes the correct part-id to the commands
so that `erase rootfs` and `protect rootfs` work.

- Patch adds empty line after each line
- Patch is line wrapped
=> Hope it's better this time as I am sure I use "Plain Text" in my email
body.
- Signed-off-by line missing

Signed-off-by: Kok How, Teh <k_h_teh@yahoo.com>
--- u-boot-2009.11.1.orig/common/cmd_flash.c    2010-01-25
16:35:12.000000000 +0800
+++ u-boot-2009.11.1.new/common/cmd_flash.c     2010-02-12
16:18:10.565540182 +0800
@@ -43,6 +43,7 @@

 #ifndef CONFIG_SYS_NO_FLASH
 extern flash_info_t flash_info[];      /* info for FLASH chips */
+extern struct mtd_device *current_mtd_dev;

 /*
  * The user interface starts numbering for Flash banks with 1
@@ -331,6 +332,7 @@
        u8 dev_type, dev_num, pnum;
 #endif
        int rcode = 0;
+       char mtd_dev[10];

        if (argc < 2) {
                cmd_usage(cmdtp);
@@ -359,7 +361,8 @@

 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
        /* erase <part-id> - erase partition */
-       if ((argc == 2) && (mtd_id_parse(argv[1], NULL, &dev_type, &dev_num)
== 0)) {
+        sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(current_mtd_dev->id->type),
current_mtd_dev->id->num);
+       if ((argc == 2) && (mtd_id_parse(mtd_dev, NULL, &dev_type, &dev_num)
== 0)) {
                mtdparts_init();
                if (find_dev_and_part(argv[1], &dev, &pnum, &part) == 0) {
                        if (dev->id->type == MTD_DEV_TYPE_NOR) {
@@ -481,6 +484,7 @@
 #endif
        int p;
        int rcode = 0;
+       char mtd_dev[10];

        if (argc < 3) {
                cmd_usage(cmdtp);
@@ -567,7 +571,8 @@

 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
        /* protect on/off <part-id> */
-       if ((argc == 3) && (mtd_id_parse(argv[2], NULL, &dev_type, &dev_num)
== 0)) {
+        sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(current_mtd_dev->id->type),
current_mtd_dev->id->num);
+       if ((argc == 3) && (mtd_id_parse(mtd_dev, NULL, &dev_type, &dev_num)
== 0)) {
                mtdparts_init();
                if (find_dev_and_part(argv[2], &dev, &pnum, &part) == 0) {
                        if (dev->id->type == MTD_DEV_TYPE_NOR) {

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

* [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix
  2010-02-12  9:16 ` Teh Kok How
@ 2010-02-12 10:19   ` Stefan Roese
  2010-02-12 10:35   ` [U-Boot] [PATCH]: common/cmd_flash.c: Fix mtdparts usage in "erase" and "protect" Teh Kok How
  2010-02-12 15:27   ` [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix Wolfgang Denk
  2 siblings, 0 replies; 9+ messages in thread
From: Stefan Roese @ 2010-02-12 10:19 UTC (permalink / raw)
  To: u-boot

On Friday 12 February 2010 10:16:36 Teh Kok How wrote:
> - What exactly are you trying to fix? Please add a small description
>   on what's broken and how your patch fixes it.
> => Fixes wrong argument to mtd_id_parse that affects u-boot command `erase`
> and `protect` <part-id>. This fix passes the correct part-id to the
> commands so that `erase rootfs` and `protect rootfs` work.
> 
> - Patch adds empty line after each line
> - Patch is line wrapped
> => Hope it's better this time as I am sure I use "Plain Text" in my email
> body.
> - Signed-off-by line missing
> 
> Signed-off-by: Kok How, Teh <k_h_teh@yahoo.com>
> --- u-boot-2009.11.1.orig/common/cmd_flash.c    2010-01-25
> 16:35:12.000000000 +0800
> +++ u-boot-2009.11.1.new/common/cmd_flash.c     2010-02-12
> 16:18:10.565540182 +0800
> @@ -43,6 +43,7 @@

Thanks. But your patch is still line wrapped. Please take a look a this page 
on how to send patches:

http://kerneltrap.org/Linux/Email_Clients_and_Patches

And please remove my comments from the commit text. It should look like this:

"
Fixes wrong argument to mtd_id_parse that affects u-boot command
`erase` and `protect` <part-id>. This fix passes the correct
part-id to the commands so that `erase rootfs` and `protect rootfs`
work.
"

And please add a small description to the email subject. Something like:

cmd_flash: Fix mtdparts usage in "erase" and "protect"


Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH]: common/cmd_flash.c: Fix mtdparts usage in "erase" and "protect"
  2010-02-12  9:16 ` Teh Kok How
  2010-02-12 10:19   ` Stefan Roese
@ 2010-02-12 10:35   ` Teh Kok How
  2010-02-12 15:32     ` Wolfgang Denk
  2010-02-12 15:27   ` [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix Wolfgang Denk
  2 siblings, 1 reply; 9+ messages in thread
From: Teh Kok How @ 2010-02-12 10:35 UTC (permalink / raw)
  To: u-boot

Fixes wrong argument to mtd_id_parse that affects u-boot command `erase`
and `protect` <part-id>. This fix passes the correct part-id to the commands
so that `erase rootfs` and `protect rootfs` work.


Signed-off-by: Kok How, Teh <k_h_teh@yahoo.com>
--- u-boot-2009.11.1.orig/common/cmd_flash.c    2010-01-25
16:35:12.000000000 +0800
+++ u-boot-2009.11.1.new/common/cmd_flash.c     2010-02-12
16:18:10.565540182 +0800
@@ -43,6 +43,7 @@

 #ifndef CONFIG_SYS_NO_FLASH
 extern flash_info_t flash_info[];      /* info for FLASH chips */
+extern struct mtd_device *current_mtd_dev;

 /*
  * The user interface starts numbering for Flash banks with 1
@@ -331,6 +332,7 @@
        u8 dev_type, dev_num, pnum;
 #endif
        int rcode = 0;
+       char mtd_dev[10];

        if (argc < 2) {
                cmd_usage(cmdtp);
@@ -359,7 +361,8 @@

 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
        /* erase <part-id> - erase partition */
-       if ((argc == 2) && (mtd_id_parse(argv[1], NULL, &dev_type, &dev_num)
== 0)) {
+        sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(current_mtd_dev->id->type),
current_mtd_dev->id->num);
+       if ((argc == 2) && (mtd_id_parse(mtd_dev, NULL, &dev_type, &dev_num)
== 0)) {
                mtdparts_init();
                if (find_dev_and_part(argv[1], &dev, &pnum, &part) == 0) {
                        if (dev->id->type == MTD_DEV_TYPE_NOR) {
@@ -481,6 +484,7 @@
 #endif
        int p;
        int rcode = 0;
+       char mtd_dev[10];

        if (argc < 3) {
                cmd_usage(cmdtp);
@@ -567,7 +571,8 @@

 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
        /* protect on/off <part-id> */
-       if ((argc == 3) && (mtd_id_parse(argv[2], NULL, &dev_type, &dev_num)
== 0)) {
+        sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(current_mtd_dev->id->type),
current_mtd_dev->id->num);
+       if ((argc == 3) && (mtd_id_parse(mtd_dev, NULL, &dev_type, &dev_num)
== 0)) {
                mtdparts_init();
                if (find_dev_and_part(argv[2], &dev, &pnum, &part) == 0) {
                        if (dev->id->type == MTD_DEV_TYPE_NOR) {

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

* [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix
  2010-02-12  9:16 ` Teh Kok How
  2010-02-12 10:19   ` Stefan Roese
  2010-02-12 10:35   ` [U-Boot] [PATCH]: common/cmd_flash.c: Fix mtdparts usage in "erase" and "protect" Teh Kok How
@ 2010-02-12 15:27   ` Wolfgang Denk
  2010-02-22  5:36     ` Teh Kok How
  2 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2010-02-12 15:27 UTC (permalink / raw)
  To: u-boot

Dear "Teh Kok How",

In message <89D4E2CB6B654B3FB0DA6A0CE6650515@smartbridges.com> you wrote:
>
> --- u-boot-2009.11.1.orig/common/cmd_flash.c    2010-01-25
> 16:35:12.000000000 +0800
> +++ u-boot-2009.11.1.new/common/cmd_flash.c     2010-02-12
> 16:18:10.565540182 +0800
> @@ -43,6 +43,7 @@
> 
>  #ifndef CONFIG_SYS_NO_FLASH
>  extern flash_info_t flash_info[];      /* info for FLASH chips */
> +extern struct mtd_device *current_mtd_dev;
> 
>  /*
>   * The user interface starts numbering for Flash banks with 1
> @@ -331,6 +332,7 @@
>         u8 dev_type, dev_num, pnum;
>  #endif
>         int rcode = 0;
> +       char mtd_dev[10];

Where is this magic constant 10 coming from?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Why is an average signature file longer than an average Perl script??

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

* [U-Boot] [PATCH]: common/cmd_flash.c: Fix mtdparts usage in "erase" and "protect"
  2010-02-12 10:35   ` [U-Boot] [PATCH]: common/cmd_flash.c: Fix mtdparts usage in "erase" and "protect" Teh Kok How
@ 2010-02-12 15:32     ` Wolfgang Denk
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2010-02-12 15:32 UTC (permalink / raw)
  To: u-boot

Dear "Teh Kok How",

In message <9BAE6A5E771E47C99977F5057F7B300A@smartbridges.com> you wrote:
> Fixes wrong argument to mtd_id_parse that affects u-boot command `erase`
> and `protect` <part-id>. This fix passes the correct part-id to the commands
> so that `erase rootfs` and `protect rootfs` work.
> 
> 
> Signed-off-by: Kok How, Teh <k_h_teh@yahoo.com>
> --- u-boot-2009.11.1.orig/common/cmd_flash.c    2010-01-25
> 16:35:12.000000000 +0800
> +++ u-boot-2009.11.1.new/common/cmd_flash.c     2010-02-12
> 16:18:10.565540182 +0800
> @@ -43,6 +43,7 @@
> 
>  #ifndef CONFIG_SYS_NO_FLASH
>  extern flash_info_t flash_info[];      /* info for FLASH chips */
> +extern struct mtd_device *current_mtd_dev;
> 
>  /*
>   * The user interface starts numbering for Flash banks with 1
> @@ -331,6 +332,7 @@
>         u8 dev_type, dev_num, pnum;
>  #endif
>         int rcode = 0;
> +       char mtd_dev[10];

I already asked: wher eis this magic constant coming from?

>         if (argc < 2) {
>                 cmd_usage(cmdtp);
> @@ -359,7 +361,8 @@
> 
>  #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
>         /* erase <part-id> - erase partition */
> -       if ((argc == 2) && (mtd_id_parse(argv[1], NULL, &dev_type, &dev_num)
> == 0)) {

This is still line wrapped.

Please read http://kerneltrap.org/Linux/Email_Clients_and_Patches and
fix your mailer configuration before reposting.

Also, consider using git-format-patch to create the patch, and using
git-send-email to send it.



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Until you walk a mile in another man's moccasins, you  can't  imagine
the smell.

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

* [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix
  2010-02-12 15:27   ` [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix Wolfgang Denk
@ 2010-02-22  5:36     ` Teh Kok How
  2010-02-22  8:28       ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Teh Kok How @ 2010-02-22  5:36 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang;
	Sorry, been away for 1 week. The constant 10 is the size of an array
that is arbitrarily chosen so that it is big enough to hold the current mtd
device identifier such as nor0, nor1, nor2, nand0, nand1, nand2, etc.

Regards,
KH

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de] 
Sent: Friday, February 12, 2010 11:28 PM
To: Teh Kok How
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix

Dear "Teh Kok How",

In message <89D4E2CB6B654B3FB0DA6A0CE6650515@smartbridges.com> you wrote:
>
> --- u-boot-2009.11.1.orig/common/cmd_flash.c    2010-01-25
> 16:35:12.000000000 +0800
> +++ u-boot-2009.11.1.new/common/cmd_flash.c     2010-02-12
> 16:18:10.565540182 +0800
> @@ -43,6 +43,7 @@
> 
>  #ifndef CONFIG_SYS_NO_FLASH
>  extern flash_info_t flash_info[];      /* info for FLASH chips */
> +extern struct mtd_device *current_mtd_dev;
> 
>  /*
>   * The user interface starts numbering for Flash banks with 1
> @@ -331,6 +332,7 @@
>         u8 dev_type, dev_num, pnum;
>  #endif
>         int rcode = 0;
> +       char mtd_dev[10];

Where is this magic constant 10 coming from?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Why is an average signature file longer than an average Perl script??

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

* [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix
  2010-02-22  5:36     ` Teh Kok How
@ 2010-02-22  8:28       ` Wolfgang Denk
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2010-02-22  8:28 UTC (permalink / raw)
  To: u-boot

Dear "Teh Kok How",

please do not top-post / full quote.

In message <8F43DBAAFE554067877FD8568CAB4FDC@smartbridges.com> you wrote:
>
> 	Sorry, been away for 1 week. The constant 10 is the size of an array
> that is arbitrarily chosen so that it is big enough to hold the current mtd
> device identifier such as nor0, nor1, nor2, nand0, nand1, nand2, etc.

Such random limitations have never been a good idea. This should be
fixed.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is much easier to suggest solutions when you know nothing

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

end of thread, other threads:[~2010-02-22  8:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-12  8:31 [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix Teh Kok How
2010-02-12  9:00 ` Stefan Roese
2010-02-12  9:16 ` Teh Kok How
2010-02-12 10:19   ` Stefan Roese
2010-02-12 10:35   ` [U-Boot] [PATCH]: common/cmd_flash.c: Fix mtdparts usage in "erase" and "protect" Teh Kok How
2010-02-12 15:32     ` Wolfgang Denk
2010-02-12 15:27   ` [U-Boot] [PATCH]: common/cmd_flash.c: bug-fix Wolfgang Denk
2010-02-22  5:36     ` Teh Kok How
2010-02-22  8:28       ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox