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

Wolfgang Denk
2010-05-06T22:14:27Z

Dear Thomas Chou,

In message <1272848085-10698-3-git-send-email-thomas@wytron.com.tw> you wrote:
> We need to query mmc devices in mmc_spi subcommand and don't want
> the "Device not found" message.

Your subject line is way too long.

> 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;
> +}
> +

Instead of creating a new function please consider using an argument
instead?

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
While money can't buy happiness, it certainly lets you choose your
own form of misery.