Re: [U-Boot] [PATCH v2 4/7] mmc: rescan fails on empty slot

2011-08-17 Thread Michael Jones
Hi Andy,

On 08/17/2011 04:30 AM, Andy Fleming wrote:
 
 Ok, I feel dumb. I apparently applied this already. But I'm still
 interested in a response to my comments/questions. :)

OK, I'll humor you :)

 
 On Tue, Aug 16, 2011 at 9:15 PM, Andy Fleming aflem...@gmail.com wrote:
 On Mon, Jul 18, 2011 at 9:40 AM, Michael Jones
 michael.jo...@matrix-vision.de wrote:
 Fail in 'mmc rescan' if mmc_init() returns error

 I think, if we're going to do this, we should change them all.

I agree it would be logical to return failed from the other mmc commands
if mmc_init() fails. I can submit such a patch for that if you want
after we agree the best way to structure the 'return' (see below).


 Also, for the purpose you want, it seems like we should consider
 adding or modifying a command to just report whether the slot has a
 card.

Yes, that would be logical and tidier than the current solution.
However, the way it is now also meets my needs, although it's ugly
because it prints Card did not respond to voltage select!.




 Signed-off-by: Michael Jones michael.jo...@matrix-vision.de
 ---
 Changes for v2:
  - None. Resubmitting to include custodian in cc:

  common/cmd_mmc.c |6 --
  1 files changed, 4 insertions(+), 2 deletions(-)

 diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
 index 176646d..28918f6 100644
 --- a/common/cmd_mmc.c
 +++ b/common/cmd_mmc.c
 @@ -165,9 +165,11 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, 
 char * const argv[])
}

mmc-has_init = 0;
 -   mmc_init(mmc);

 -   return 0;
 +   if (mmc_init(mmc))
 +   return 1;
 +   else
 +   return 0;


 Is there a reason to return 1 instead of returning whatever error
 mmc_init() returns?

 ie:

 return mmc_init(mmc);

It looked to me like do_mmcops should only return either a 1 for fail or
0 for success. mmc_init() returns UNUSABLE_ERR (interesting that it's
not NO_CARD_ERR) when there is no card.

This is the command I wanted to enable with the patch:

if mmc rescan; then echo rescan true; else echo rescan false; fi;

As it is, when the slot is empty this prints:
Card did not respond to voltage select!
rescan false

If UNUSABLE_ERR is returned directly from do_mmcops, I get:
Card did not respond to voltage select!
exit not allowed from main input shell.

Do you want something more compact like 'return !!mmc_init(mmc)' or
return mmc_init(mmc) ? 1 : 0;   ?



 Andy


-Michael

MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Erhard Meier
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 4/7] mmc: rescan fails on empty slot

2011-08-16 Thread Andy Fleming
On Mon, Jul 18, 2011 at 9:40 AM, Michael Jones
michael.jo...@matrix-vision.de wrote:
 Fail in 'mmc rescan' if mmc_init() returns error

I think, if we're going to do this, we should change them all.

Also, for the purpose you want, it seems like we should consider
adding or modifying a command to just report whether the slot has a
card.



 Signed-off-by: Michael Jones michael.jo...@matrix-vision.de
 ---
 Changes for v2:
  - None. Resubmitting to include custodian in cc:

  common/cmd_mmc.c |    6 --
  1 files changed, 4 insertions(+), 2 deletions(-)

 diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
 index 176646d..28918f6 100644
 --- a/common/cmd_mmc.c
 +++ b/common/cmd_mmc.c
 @@ -165,9 +165,11 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char 
 * const argv[])
                }

                mmc-has_init = 0;
 -               mmc_init(mmc);

 -               return 0;
 +               if (mmc_init(mmc))
 +                       return 1;
 +               else
 +                       return 0;


Is there a reason to return 1 instead of returning whatever error
mmc_init() returns?

ie:

return mmc_init(mmc);


Andy
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 4/7] mmc: rescan fails on empty slot

2011-08-16 Thread Andy Fleming
Ok, I feel dumb. I apparently applied this already. But I'm still
interested in a response to my comments/questions. :)

On Tue, Aug 16, 2011 at 9:15 PM, Andy Fleming aflem...@gmail.com wrote:
 On Mon, Jul 18, 2011 at 9:40 AM, Michael Jones
 michael.jo...@matrix-vision.de wrote:
 Fail in 'mmc rescan' if mmc_init() returns error

 I think, if we're going to do this, we should change them all.

 Also, for the purpose you want, it seems like we should consider
 adding or modifying a command to just report whether the slot has a
 card.



 Signed-off-by: Michael Jones michael.jo...@matrix-vision.de
 ---
 Changes for v2:
  - None. Resubmitting to include custodian in cc:

  common/cmd_mmc.c |    6 --
  1 files changed, 4 insertions(+), 2 deletions(-)

 diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
 index 176646d..28918f6 100644
 --- a/common/cmd_mmc.c
 +++ b/common/cmd_mmc.c
 @@ -165,9 +165,11 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, 
 char * const argv[])
                }

                mmc-has_init = 0;
 -               mmc_init(mmc);

 -               return 0;
 +               if (mmc_init(mmc))
 +                       return 1;
 +               else
 +                       return 0;


 Is there a reason to return 1 instead of returning whatever error
 mmc_init() returns?

 ie:

 return mmc_init(mmc);


 Andy

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 4/7] mmc: rescan fails on empty slot

2011-07-18 Thread Michael Jones
Fail in 'mmc rescan' if mmc_init() returns error

Signed-off-by: Michael Jones michael.jo...@matrix-vision.de
---
Changes for v2:
  - None. Resubmitting to include custodian in cc:

 common/cmd_mmc.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 176646d..28918f6 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -165,9 +165,11 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
}
 
mmc-has_init = 0;
-   mmc_init(mmc);
 
-   return 0;
+   if (mmc_init(mmc))
+   return 1;
+   else
+   return 0;
} else if (strncmp(argv[1], part, 4) == 0) {
block_dev_desc_t *mmc_dev;
struct mmc *mmc = find_mmc_device(curr_device);
-- 
1.7.5.4


MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Erhard Meier
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot