From f516fd99ec59d964836906c8ac370f246d60c14d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 14 Nov 2019 12:57:23 -0700 Subject: [PATCH] common: Move serial_printf() to the serial header Move this function header to serial.h since this function is clearly related to serial. The function itself stays in console.c since we don't have a single serial file. DM and non-DM each has a separate file so we would have to either create a new common serial file, or repeat the function in both serial.c and serial-uclass.c, neither of which seem worthwhile. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- drivers/usb/gadget/core.c | 1 + drivers/usb/gadget/designware_udc.c | 1 + drivers/usb/gadget/ep0.c | 3 ++- drivers/usb/musb-new/omap2430.c | 1 + drivers/usb/musb/musb_udc.c | 1 + drivers/usb/musb/omap3.c | 1 + include/common.h | 7 ------- include/serial.h | 11 +++++++++++ 8 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/core.c b/drivers/usb/gadget/core.c index ffaf161fb7..7e1e51db96 100644 --- a/drivers/usb/gadget/core.c +++ b/drivers/usb/gadget/core.c @@ -16,6 +16,7 @@ */ #include +#include #include #define MAX_INTERFACES 2 diff --git a/drivers/usb/gadget/designware_udc.c b/drivers/usb/gadget/designware_udc.c index 432f312cee..70c5c678c3 100644 --- a/drivers/usb/gadget/designware_udc.c +++ b/drivers/usb/gadget/designware_udc.c @@ -8,6 +8,7 @@ */ #include +#include #include #include diff --git a/drivers/usb/gadget/ep0.c b/drivers/usb/gadget/ep0.c index a36d9ec03d..6fabee24ce 100644 --- a/drivers/usb/gadget/ep0.c +++ b/drivers/usb/gadget/ep0.c @@ -37,6 +37,7 @@ */ #include +#include #include #if 0 @@ -581,7 +582,7 @@ int ep0_recv_setup (struct urb *urb) device->interface = le16_to_cpu (request->wIndex); device->alternate = le16_to_cpu (request->wValue); /*dbg_ep0(2, "set interface: %d alternate: %d", device->interface, device->alternate); */ - serial_printf ("DEVICE_SET_INTERFACE.. event?\n"); + serial_printf("DEVICE_SET_INTERFACE.. event?\n"); return 0; case USB_REQ_GET_STATUS: diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c index cca1653f1e..05059ce3cb 100644 --- a/drivers/usb/musb-new/omap2430.c +++ b/drivers/usb/musb-new/omap2430.c @@ -10,6 +10,7 @@ */ #include #include +#include #include #include #include diff --git a/drivers/usb/musb/musb_udc.c b/drivers/usb/musb/musb_udc.c index 7620114bec..584564bac2 100644 --- a/drivers/usb/musb/musb_udc.c +++ b/drivers/usb/musb/musb_udc.c @@ -38,6 +38,7 @@ */ #include +#include #include #include #include "../gadget/ep0.h" diff --git a/drivers/usb/musb/omap3.c b/drivers/usb/musb/omap3.c index b2e4c32baf..080bd78523 100644 --- a/drivers/usb/musb/omap3.c +++ b/drivers/usb/musb/omap3.c @@ -16,6 +16,7 @@ * ------------------------------------------------------------------------ */ +#include #include #include #include diff --git a/include/common.h b/include/common.h index 4fda40cc1d..f97a7b6e14 100644 --- a/include/common.h +++ b/include/common.h @@ -310,13 +310,6 @@ int ulz4fn(const void *src, size_t srcn, void *dst, size_t *dstn); /* lib/vsprintf.c */ #include -/* - * STDIO based functions (can always be used) - */ -/* serial stuff */ -int serial_printf (const char *fmt, ...) - __attribute__ ((format (__printf__, 1, 2))); - /* lib/net_utils.c */ #include diff --git a/include/serial.h b/include/serial.h index 38a1cc99ae..8d1803c800 100644 --- a/include/serial.h +++ b/include/serial.h @@ -324,4 +324,15 @@ void pl01x_serial_initialize(void); void pxa_serial_initialize(void); void sh_serial_initialize(void); +/** + * serial_printf() - Write a formatted string to the serial console + * + * The total size of the output must be less than CONFIG_SYS_PBSIZE. + * + * @fmt: Printf format string, followed by format arguments + * @return number of characters written + */ +int serial_printf(const char *fmt, ...) + __attribute__ ((format (__printf__, 1, 2))); + #endif -- 2.25.1