Skip to content

Commit

Permalink
driver/serial: remove return value of up_putc()
Browse files Browse the repository at this point in the history
modify the prototype of up_putc(): remove the return value

The architecture code does not care about the return value of up_putc(), so removing it saves two statements:

Before:                                                    After:
de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)    |  de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)
de50: e24dd014  sub sp, sp, apache#20                         |  de50: e24dd014  sub sp, sp, apache#20
de54: e58d0004  str r0, [sp, #4]                        |  de54: e58d0004  str r0, [sp, #4]
de58: e30030f8  movw  r3, apache#248  @ 0xf8                  |  de58: e30030f8  movw  r3, apache#248  @ 0xf8
de5c: e3423000  movt  r3, apache#8192 @ 0x2000                |  de5c: e3423000  movt  r3, apache#8192 @ 0x2000
de60: e58d300c  str r3, [sp, apache#12]                       |  de60: e58d300c  str r3, [sp, apache#12]
de64: e59d1004  ldr r1, [sp, #4]                        |  de64: e59d1004  ldr r1, [sp, #4]
de68: e59d000c  ldr r0, [sp, apache#12]                       |  de68: e59d000c  ldr r0, [sp, apache#12]
de6c: ebfffe66  bl  d80c <pl011_putc>                   |  de6c: ebfffe66  bl  d80c <pl011_putc>
de70: e59d3004  ldr r3, [sp, #4]                        |  de70: e28dd014  add sp, sp, apache#20
de74: e1a0000  mov r0, r3                              |  de74: e49df004  pop {pc}    @ (ldr pc, [sp], #4)
de78: e28dd014  add sp, sp, apache#20                         |
de7c: e49df004  pop {pc}    @ (ldr pc, [sp], #4)        |

Signed-off-by: chao an <[email protected]>
  • Loading branch information
anchao committed Oct 26, 2024
1 parent 052ea5b commit 370a349
Show file tree
Hide file tree
Showing 115 changed files with 211 additions and 446 deletions.
2 changes: 1 addition & 1 deletion Documentation/reference/os/arch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ APIs Exported by Architecture-Specific Logic to NuttX
architectures, it should be avoided in common implementations
where possible.
.. c:function:: int up_putc(int ch)
.. c:function:: void up_putc(int ch)
This is a debug interface exported by the
architecture-specific logic. Output one character on the console
Expand Down
7 changes: 2 additions & 5 deletions arch/arm/src/a1x/a1x_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ void arm_serialinit(void)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#ifdef HAVE_SERIAL_CONSOLE
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
Expand All @@ -1578,8 +1578,6 @@ int up_putc(int ch)
#ifdef HAVE_SERIAL_CONSOLE
up_restoreuartint(priv, ier);
#endif

return ch;
}

#else /* USE_SERIALDRIVER */
Expand All @@ -1592,12 +1590,11 @@ int up_putc(int ch)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#ifdef HAVE_UART_DEVICE
arm_lowputc(ch);
#endif
return ch;
}

#endif /* USE_SERIALDRIVER */
7 changes: 2 additions & 5 deletions arch/arm/src/am335x/am335x_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ void arm_serialinit(void)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#ifdef HAVE_SERIAL_CONSOLE
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
Expand All @@ -1382,8 +1382,6 @@ int up_putc(int ch)
#ifdef HAVE_SERIAL_CONSOLE
up_restoreuartint(priv, ier);
#endif

return ch;
}

#else /* USE_SERIALDRIVER */
Expand All @@ -1396,12 +1394,11 @@ int up_putc(int ch)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#ifdef HAVE_UART_DEVICE
arm_lowputc(ch);
#endif
return ch;
}

#endif /* USE_SERIALDRIVER */
6 changes: 2 additions & 4 deletions arch/arm/src/at32/at32_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -2997,7 +2997,7 @@ void at32_serial_dma_poll(void)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#if CONSOLE_UART > 0
struct up_dev_s *priv = g_uart_devs[CONSOLE_UART - 1];
Expand All @@ -3007,7 +3007,6 @@ int up_putc(int ch)
arm_lowputc(ch);
up_restoreusartint(priv, ie);
#endif
return ch;
}

#else /* USE_SERIALDRIVER */
Expand All @@ -3020,12 +3019,11 @@ int up_putc(int ch)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#if CONSOLE_UART > 0
arm_lowputc(ch);
#endif
return ch;
}

#endif /* USE_SERIALDRIVER */
3 changes: 1 addition & 2 deletions arch/arm/src/c5471/c5471_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ void arm_serialinit(void)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
uint16_t ier;
Expand All @@ -841,5 +841,4 @@ int up_putc(int ch)

up_waittxready(priv);
up_restoreuartint(priv, ier);
return ch;
}
3 changes: 1 addition & 2 deletions arch/arm/src/common/arm_semi_syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@
* Name: up_putc
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
smh_call(SEMI_SYSLOG_WRITEC, &ch);
return ch;
}

/****************************************************************************
Expand Down
4 changes: 1 addition & 3 deletions arch/arm/src/cxd32xx/cxd32_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ void arm_serialinit(void)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#ifdef HAVE_CONSOLE
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
Expand All @@ -982,8 +982,6 @@ int up_putc(int ch)
#ifdef HAVE_CONSOLE
up_restoreuartint(priv, ier);
#endif

return ch;
}

#endif /* USE_SERIALDRIVER */
7 changes: 2 additions & 5 deletions arch/arm/src/cxd56xx/cxd56_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ void arm_serialinit(void)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#ifdef HAVE_CONSOLE
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
Expand All @@ -1120,8 +1120,6 @@ int up_putc(int ch)
#ifdef HAVE_CONSOLE
up_restoreuartint(priv, ier);
#endif

return ch;
}

#else /* USE_SERIALDRIVER */
Expand All @@ -1134,12 +1132,11 @@ int up_putc(int ch)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#ifdef HAVE_UART
arm_lowputc(ch);
#endif
return ch;
}

#endif /* USE_SERIALDRIVER */
6 changes: 2 additions & 4 deletions arch/arm/src/dm320/dm320_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ void arm_serialinit(void)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
uint16_t ier;
Expand All @@ -753,7 +753,6 @@ int up_putc(int ch)

up_waittxready(priv);
up_restoreuartint(priv, ier);
return ch;
}

#else /* USE_SERIALDRIVER */
Expand Down Expand Up @@ -789,13 +788,12 @@ static inline void up_waittxready(void)
* Public Functions
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
up_waittxready();
putreg16((uint16_t)ch, DM320_REGISTER_BASE + UART_DTRR);

up_waittxready();
return ch;
}

#endif /* USE_SERIALDRIVER */
6 changes: 2 additions & 4 deletions arch/arm/src/efm32/efm32_leserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,15 +809,14 @@ void arm_serialinit(void)
****************************************************************************/

#ifdef HAVE_LEUART_CONSOLE
int up_putc(int ch)
void up_putc(int ch)
{
struct efm32_leuart_s *priv = (struct efm32_leuart_s *)CONSOLE_DEV.priv;
uint32_t ien;

efm32_disableuartint(priv, &ien);
efm32_lowputc(ch);
efm32_restoreuartint(priv, ien);
return ch;
}
#endif

Expand All @@ -832,10 +831,9 @@ int up_putc(int ch)
****************************************************************************/

#ifdef HAVE_LEUART_CONSOLE
int up_putc(int ch)
void up_putc(int ch)
{
efm32_lowputc(ch);
return ch;
}
#endif

Expand Down
6 changes: 2 additions & 4 deletions arch/arm/src/efm32/efm32_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ void arm_serialinit(void)
****************************************************************************/

#ifndef HAVE_LEUART_CONSOLE
int up_putc(int ch)
void up_putc(int ch)
{
#ifdef HAVE_UART_CONSOLE
struct efm32_usart_s *priv = (struct efm32_usart_s *)CONSOLE_DEV.priv;
Expand All @@ -1195,7 +1195,6 @@ int up_putc(int ch)
efm32_lowputc(ch);
efm32_restoreuartint(priv, ien);
#endif
return ch;
}
#endif

Expand All @@ -1210,12 +1209,11 @@ int up_putc(int ch)
****************************************************************************/

#ifndef HAVE_LEUART_CONSOLE
int up_putc(int ch)
void up_putc(int ch)
{
#ifdef HAVE_UART_CONSOLE
efm32_lowputc(ch);
#endif
return ch;
}
#endif

Expand Down
7 changes: 2 additions & 5 deletions arch/arm/src/eoss3/eoss3_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ void arm_serialinit(void)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#ifdef CONFIG_UART_SERIAL_CONSOLE
struct eoss3_uart_s *priv = (struct eoss3_uart_s *)g_uartport.priv;
Expand All @@ -591,8 +591,6 @@ int up_putc(int ch)
arm_lowputc(ch);
eoss3_restoreuartint(priv, ie);
#endif

return ch;
}

#else /* USE_SERIALDRIVER */
Expand All @@ -605,12 +603,11 @@ int up_putc(int ch)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
/* Output the character */

arm_lowputc(ch);
return ch;
}

#endif /* USE_SERIALDRIVER */
3 changes: 1 addition & 2 deletions arch/arm/src/fvp-v8r-aarch32/fvp_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ void arm_serialinit(void)

#else /* USE_SERIALDRIVER */

int up_putc(int ch)
void up_putc(int ch)
{
return 0;
}

#endif /* USE_SERIALDRIVER */
6 changes: 2 additions & 4 deletions arch/arm/src/gd32f4/gd32f4xx_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -2929,7 +2929,7 @@ void gd32_serial_dma_poll(void)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#ifdef CONSOLE_UART

Expand All @@ -2940,7 +2940,6 @@ int up_putc(int ch)
arm_lowputc(ch);
up_restoreusartint(priv, ie);
#endif
return ch;
}

#else /* USE_SERIALDRIVER */
Expand All @@ -2953,12 +2952,11 @@ int up_putc(int ch)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
#ifdef CONSOLE_UART
arm_lowputc(ch);
#endif
return ch;
}

#endif /* USE_SERIALDRIVER */
6 changes: 2 additions & 4 deletions arch/arm/src/imx1/imx_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ void arm_serialinit(void)
*
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
uint32_t ier;
Expand All @@ -1169,7 +1169,6 @@ int up_putc(int ch)
up_serialout(priv, UART_TXD0, (uint32_t)ch);
up_waittxready(priv);
up_restoreuartint(priv, ier);
return ch;
}

#else /* USE_SERIALDRIVER */
Expand Down Expand Up @@ -1211,11 +1210,10 @@ static inline void up_waittxready(void)
* Public Functions
****************************************************************************/

int up_putc(int ch)
void up_putc(int ch)
{
up_waittxready();
putreg32((uint16_t)ch, IMX_REGISTER_BASE + UART_TXD0);
return ch;
}

#endif /* USE_SERIALDRIVER */
Loading

0 comments on commit 370a349

Please sign in to comment.