diff mbox series

[07/10] drivers: serial: Make serial_initialize return int

Message ID 20200709080457.26850-7-ovidiu.panait@windriver.com
State Superseded
Headers show
Series [01/10] board_f: Introduce arch_setup_bdinfo initcall | expand

Commit Message

Ovidiu Panait July 9, 2020, 8:04 a.m. UTC
serial_initialize is called only during the common init sequence, after
relocation (in common/board_r.c). Because it has a void return value, it
has to wrapped in initr_serial. In order to be able to get rid of this
indirection, make serial_initialize return int.

Remove extern from prototype in order to silence the following checkpatch
warning:
check: extern prototypes should be avoided in .h files

Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>
---

 drivers/serial/serial-uclass.c | 4 ++--
 drivers/serial/serial.c        | 4 +++-
 include/serial.h               | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

Comments

Simon Glass July 10, 2020, 12:35 a.m. UTC | #1
On Thu, 9 Jul 2020 at 02:10, Ovidiu Panait <ovidiu.panait at windriver.com> wrote:
>
> serial_initialize is called only during the common init sequence, after
> relocation (in common/board_r.c). Because it has a void return value, it
> has to wrapped in initr_serial. In order to be able to get rid of this
> indirection, make serial_initialize return int.
>
> Remove extern from prototype in order to silence the following checkpatch
> warning:
> check: extern prototypes should be avoided in .h files
>
> Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>
> ---
>
>  drivers/serial/serial-uclass.c | 4 ++--
>  drivers/serial/serial.c        | 4 +++-
>  include/serial.h               | 2 +-
>  3 files changed, 6 insertions(+), 4 deletions(-)
>

Reviewed-by: Simon Glass <sjg at chromium.org>

Has bothered me for a while :-)
diff mbox series

Patch

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index a0af0e6bfd..0027625ebf 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -170,9 +170,9 @@  int serial_init(void)
 }
 
 /* Called after relocation */
-void serial_initialize(void)
+int serial_initialize(void)
 {
-	serial_init();
+	return serial_init();
 }
 
 static void _serial_putc(struct udevice *dev, char ch)
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index da017dc5b3..53358acb81 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -170,7 +170,7 @@  void serial_register(struct serial_device *dev)
  * serial port to the serial core. That serial port is then used as a
  * default output.
  */
-void serial_initialize(void)
+int serial_initialize(void)
 {
 	atmel_serial_initialize();
 	mcf_serial_initialize();
@@ -183,6 +183,8 @@  void serial_initialize(void)
 	mtk_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
+
+	return 0;
 }
 
 static int serial_stub_start(struct stdio_dev *sdev)
diff --git a/include/serial.h b/include/serial.h
index c590637b1f..6d1e62c677 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -42,10 +42,10 @@  extern struct serial_device eserial5_device;
 extern struct serial_device eserial6_device;
 
 extern void serial_register(struct serial_device *);
-extern void serial_initialize(void);
 extern void serial_stdio_init(void);
 extern int serial_assign(const char *name);
 extern void serial_reinit_all(void);
+int serial_initialize(void);
 
 /* For usbtty */
 #ifdef CONFIG_USB_TTY