Skip to content
Snippets Groups Projects
Commit 4dc5259a authored by Simon Glass's avatar Simon Glass
Browse files

dm: gpio: Allow the uclass to work without printf()


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: default avatarSimon Glass <sjg@chromium.org>
parent 8e31681c
No related branches found
No related tags found
No related merge requests found
...@@ -154,6 +154,7 @@ int dm_gpio_request(struct gpio_desc *desc, const char *label) ...@@ -154,6 +154,7 @@ int dm_gpio_request(struct gpio_desc *desc, const char *label)
static int dm_gpio_requestf(struct gpio_desc *desc, const char *fmt, ...) static int dm_gpio_requestf(struct gpio_desc *desc, const char *fmt, ...)
{ {
#if !defined(CONFIG_SPL_BUILD) || !defined(CONFIG_USE_TINY_PRINTF)
va_list args; va_list args;
char buf[40]; char buf[40];
...@@ -161,6 +162,9 @@ static int dm_gpio_requestf(struct gpio_desc *desc, const char *fmt, ...) ...@@ -161,6 +162,9 @@ static int dm_gpio_requestf(struct gpio_desc *desc, const char *fmt, ...)
vscnprintf(buf, sizeof(buf), fmt, args); vscnprintf(buf, sizeof(buf), fmt, args);
va_end(args); va_end(args);
return dm_gpio_request(desc, buf); return dm_gpio_request(desc, buf);
#else
return dm_gpio_request(desc, fmt);
#endif
} }
/** /**
...@@ -199,6 +203,7 @@ int gpio_request(unsigned gpio, const char *label) ...@@ -199,6 +203,7 @@ int gpio_request(unsigned gpio, const char *label)
*/ */
int gpio_requestf(unsigned gpio, const char *fmt, ...) int gpio_requestf(unsigned gpio, const char *fmt, ...)
{ {
#if !defined(CONFIG_SPL_BUILD) || !defined(CONFIG_USE_TINY_PRINTF)
va_list args; va_list args;
char buf[40]; char buf[40];
...@@ -206,6 +211,9 @@ int gpio_requestf(unsigned gpio, const char *fmt, ...) ...@@ -206,6 +211,9 @@ int gpio_requestf(unsigned gpio, const char *fmt, ...)
vscnprintf(buf, sizeof(buf), fmt, args); vscnprintf(buf, sizeof(buf), fmt, args);
va_end(args); va_end(args);
return gpio_request(gpio, buf); return gpio_request(gpio, buf);
#else
return gpio_request(gpio, fmt);
#endif
} }
int _dm_gpio_free(struct udevice *dev, uint offset) int _dm_gpio_free(struct udevice *dev, uint offset)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment