diff mbox

[U-Boot,05/10] dm: spi_flash: Allow the uclass to work without printf()

Message ID 1451391772-6203-6-git-send-email-sjg@chromium.org
State Accepted
Commit 3c8fb12b77849400ffc04737c113a7acff7d7f18
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Dec. 29, 2015, 12:22 p.m. UTC
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 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Simon Glass Jan. 15, 2016, 1:22 p.m. UTC | #1
On 29 December 2015 at 05:22, Simon Glass <sjg@chromium.org> wrote:
> 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 | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Applied to u-boot-rockchip, as it fixes a build error with Jerry.
diff mbox

Patch

diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c
index 72e0f6b..5aa4e6f 100644
--- a/drivers/mtd/spi/sf-uclass.c
+++ b/drivers/mtd/spi/sf-uclass.c
@@ -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)