From: Wolfgang Denk Date: Fri, 07 May 2010 00:14:27 +0200 Subject: [U-Boot] [PATCH 2/3] mmc: add find_mmc_device_quiet that doesnt print not found message In-Reply-To: <1272848085-10698-3-git-send-email-thomas@wytron.com.tw> References: <1271991214-7937-1-git-send-email-thomas@wytron.com.tw> <1272848085-10698-3-git-send-email-thomas@wytron.com.tw> Message-ID: <20100506221427.D7496E8AAC9@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > --- > 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.