diff mbox

[6/7] mmc: mmc: Don't use sprintf when using tiny-printf

Message ID 1449268061-805-7-git-send-email-sjoerd.simons@collabora.co.uk
State Accepted
Commit fc011f6402d3d63fe826260fcc5940d7b7fb138e
Headers show

Commit Message

Sjoerd Simons Dec. 4, 2015, 10:27 p.m. UTC
There is no sprintf implementation in tiny-printf, so don't try to use
it when tiny-printf if used.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

---

 drivers/mmc/mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.6.2

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

Comments

Sjoerd Simons Dec. 8, 2015, 7:34 a.m. UTC | #1
On Mon, 2015-12-07 at 17:40 -0700, Simon Glass wrote:
> On 4 December 2015 at 15:27, Sjoerd Simons
> <sjoerd.simons@collabora.co.uk> wrote:
> > There is no sprintf implementation in tiny-printf, so don't try to
> > use
> > it when tiny-printf if used.
> > 
> > Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> > ---
> > 
> >  drivers/mmc/mmc.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> Acked-by: Simon Glass <sjg@chromium.org>
> Tested on firefly:
> Tested-by: Simon Glass <sjg@chromium.org>
> 
> I can't help thinking that sprintf() would not add a lot more code...

Probably not (it's write to buffer rather then write to output, so
maybe just passing a function pointer for an out function in would just
do the job). More work then I had time for though :/

Though i'm not sure it's worth it though (at least on firefly the spl
won't output those fields) :)
diff mbox

Patch

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 2a58702..3a34028 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1469,7 +1469,9 @@  static int mmc_startup(struct mmc *mmc)
 	mmc->block_dev.blksz = mmc->read_bl_len;
 	mmc->block_dev.log2blksz = LOG2(mmc->block_dev.blksz);
 	mmc->block_dev.lba = lldiv(mmc->capacity, mmc->read_bl_len);
-#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
+#if !defined(CONFIG_SPL_BUILD) || \
+		(defined(CONFIG_SPL_LIBCOMMON_SUPPORT) && \
+		!defined(CONFIG_USE_TINY_PRINTF))
 	sprintf(mmc->block_dev.vendor, "Man %06x Snr %04x%04x",
 		mmc->cid[0] >> 24, (mmc->cid[2] & 0xffff),
 		(mmc->cid[3] >> 16) & 0xffff);