[U-Boot] [PATCH 2/3] mmc: add find_mmc_device_quiet that doesnt print not found message

Thomas Chou
2010-05-03T00:54:44Z

We need to query mmc devices in mmc_spi subcommand and don't want
the "Device not found" message.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
drivers/mmc/mmc.c | 14 +++++++++++---
include/mmc.h | 1 +
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index cf4ea16..55ab13e 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -60,7 +60,7 @@ int mmc_set_blocklen(struct mmc *mmc, int len)
return mmc_send_cmd(mmc, &cmd, NULL);
}

-struct mmc *find_mmc_device(int dev_num)
+struct mmc *find_mmc_device_quiet(int dev_num)
{
struct mmc *m;
struct list_head *entry;
@@ -72,11 +72,19 @@ struct mmc *find_mmc_device(int dev_num)
return m;
}

- printf("MMC Device %d not found\n", dev_num);
-
return NULL;
}

+struct mmc *find_mmc_device(int dev_num)
+{
+ struct mmc *m = find_mmc_device_quiet(dev_num);
+
+ if (!m)
+ printf("MMC Device %d not found\n", dev_num);
+
+ return m;
+}
+
static ulong
mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
{
diff --git a/include/mmc.h b/include/mmc.h
index 8973bc7..b24b596 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -270,6 +270,7 @@ int mmc_register(struct mmc *mmc);
int mmc_initialize(bd_t *bis);
int mmc_init(struct mmc *mmc);
int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);
+struct mmc *find_mmc_device_quiet(int dev_num);
struct mmc *find_mmc_device(int dev_num);
void print_mmc_devices(char separator);
int board_mmc_getcd(u8 *cd, struct mmc *mmc);
--
1.6.6.1