]> git.sur5r.net Git - u-boot/commitdiff
dm: spi_flash: Allow the uclass to work without printf()
authorSimon Glass <sjg@chromium.org>
Tue, 29 Dec 2015 12:22:47 +0000 (05:22 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 15 Jan 2016 12:39:27 +0000 (05:39 -0700)
For SPL we don't really need sprintf() and with tiny-printf this is not
available. Allow this to be dropped in SPL when using tiny-printf.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/mtd/spi/sf-uclass.c

index 95ffad476d76c1bf0127802da1d7b7490b094f3e..19de964e6121c53642d07a8c28b8afde8f9d137c 100644 (file)
@@ -55,11 +55,17 @@ int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
 {
        struct spi_slave *slave;
        struct udevice *bus;
-       char name[30], *str;
+       char *str;
        int ret;
 
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_USE_TINY_PRINTF)
+       str = "spi_flash";
+#else
+       char name[30];
+
        snprintf(name, sizeof(name), "spi_flash@%d:%d", busnum, cs);
        str = strdup(name);
+#endif
        ret = spi_get_bus_and_cs(busnum, cs, max_hz, spi_mode,
                                  "spi_flash_std", str, &bus, &slave);
        if (ret)