Skip to content

Commit c6591c0

Browse files
anchaoxiaoxiang781216
authored andcommitted
driver/serial: remove return value of up_putc()
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, apache#4] | de54: e58d0004 str r0, [sp, apache#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, apache#4] | de64: e59d1004 ldr r1, [sp, apache#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, apache#4] | de70: e28dd014 add sp, sp, apache#20 de74: e1a0000 mov r0, r3 | de74: e49df004 pop {pc} @ (ldr pc, [sp], apache#4) de78: e28dd014 add sp, sp, apache#20 | de7c: e49df004 pop {pc} @ (ldr pc, [sp], apache#4) | Signed-off-by: chao an <[email protected]>
1 parent d0f957a commit c6591c0

File tree

115 files changed

+211
-446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+211
-446
lines changed

Documentation/reference/os/arch.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ APIs Exported by Architecture-Specific Logic to NuttX
288288
architectures, it should be avoided in common implementations
289289
where possible.
290290
291-
.. c:function:: int up_putc(int ch)
291+
.. c:function:: void up_putc(int ch)
292292
293293
This is a debug interface exported by the
294294
architecture-specific logic. Output one character on the console

arch/arm/src/a1x/a1x_serial.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ void arm_serialinit(void)
15661566
*
15671567
****************************************************************************/
15681568

1569-
int up_putc(int ch)
1569+
void up_putc(int ch)
15701570
{
15711571
#ifdef HAVE_SERIAL_CONSOLE
15721572
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
@@ -1578,8 +1578,6 @@ int up_putc(int ch)
15781578
#ifdef HAVE_SERIAL_CONSOLE
15791579
up_restoreuartint(priv, ier);
15801580
#endif
1581-
1582-
return ch;
15831581
}
15841582

15851583
#else /* USE_SERIALDRIVER */
@@ -1592,12 +1590,11 @@ int up_putc(int ch)
15921590
*
15931591
****************************************************************************/
15941592

1595-
int up_putc(int ch)
1593+
void up_putc(int ch)
15961594
{
15971595
#ifdef HAVE_UART_DEVICE
15981596
arm_lowputc(ch);
15991597
#endif
1600-
return ch;
16011598
}
16021599

16031600
#endif /* USE_SERIALDRIVER */

arch/arm/src/am335x/am335x_serial.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ void arm_serialinit(void)
13701370
*
13711371
****************************************************************************/
13721372

1373-
int up_putc(int ch)
1373+
void up_putc(int ch)
13741374
{
13751375
#ifdef HAVE_SERIAL_CONSOLE
13761376
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
@@ -1382,8 +1382,6 @@ int up_putc(int ch)
13821382
#ifdef HAVE_SERIAL_CONSOLE
13831383
up_restoreuartint(priv, ier);
13841384
#endif
1385-
1386-
return ch;
13871385
}
13881386

13891387
#else /* USE_SERIALDRIVER */
@@ -1396,12 +1394,11 @@ int up_putc(int ch)
13961394
*
13971395
****************************************************************************/
13981396

1399-
int up_putc(int ch)
1397+
void up_putc(int ch)
14001398
{
14011399
#ifdef HAVE_UART_DEVICE
14021400
arm_lowputc(ch);
14031401
#endif
1404-
return ch;
14051402
}
14061403

14071404
#endif /* USE_SERIALDRIVER */

arch/arm/src/at32/at32_serial.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,7 +2997,7 @@ void at32_serial_dma_poll(void)
29972997
*
29982998
****************************************************************************/
29992999

3000-
int up_putc(int ch)
3000+
void up_putc(int ch)
30013001
{
30023002
#if CONSOLE_UART > 0
30033003
struct up_dev_s *priv = g_uart_devs[CONSOLE_UART - 1];
@@ -3007,7 +3007,6 @@ int up_putc(int ch)
30073007
arm_lowputc(ch);
30083008
up_restoreusartint(priv, ie);
30093009
#endif
3010-
return ch;
30113010
}
30123011

30133012
#else /* USE_SERIALDRIVER */
@@ -3020,12 +3019,11 @@ int up_putc(int ch)
30203019
*
30213020
****************************************************************************/
30223021

3023-
int up_putc(int ch)
3022+
void up_putc(int ch)
30243023
{
30253024
#if CONSOLE_UART > 0
30263025
arm_lowputc(ch);
30273026
#endif
3028-
return ch;
30293027
}
30303028

30313029
#endif /* USE_SERIALDRIVER */

arch/arm/src/c5471/c5471_serial.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ void arm_serialinit(void)
830830
*
831831
****************************************************************************/
832832

833-
int up_putc(int ch)
833+
void up_putc(int ch)
834834
{
835835
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
836836
uint16_t ier;
@@ -841,5 +841,4 @@ int up_putc(int ch)
841841

842842
up_waittxready(priv);
843843
up_restoreuartint(priv, ier);
844-
return ch;
845844
}

arch/arm/src/common/arm_semi_syslog.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@
4545
* Name: up_putc
4646
****************************************************************************/
4747

48-
int up_putc(int ch)
48+
void up_putc(int ch)
4949
{
5050
smh_call(SEMI_SYSLOG_WRITEC, &ch);
51-
return ch;
5251
}
5352

5453
/****************************************************************************

arch/arm/src/cxd32xx/cxd32_serial.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ void arm_serialinit(void)
970970
*
971971
****************************************************************************/
972972

973-
int up_putc(int ch)
973+
void up_putc(int ch)
974974
{
975975
#ifdef HAVE_CONSOLE
976976
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
@@ -982,8 +982,6 @@ int up_putc(int ch)
982982
#ifdef HAVE_CONSOLE
983983
up_restoreuartint(priv, ier);
984984
#endif
985-
986-
return ch;
987985
}
988986

989987
#endif /* USE_SERIALDRIVER */

arch/arm/src/cxd56xx/cxd56_serial.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ void arm_serialinit(void)
11081108
*
11091109
****************************************************************************/
11101110

1111-
int up_putc(int ch)
1111+
void up_putc(int ch)
11121112
{
11131113
#ifdef HAVE_CONSOLE
11141114
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
@@ -1120,8 +1120,6 @@ int up_putc(int ch)
11201120
#ifdef HAVE_CONSOLE
11211121
up_restoreuartint(priv, ier);
11221122
#endif
1123-
1124-
return ch;
11251123
}
11261124

11271125
#else /* USE_SERIALDRIVER */
@@ -1134,12 +1132,11 @@ int up_putc(int ch)
11341132
*
11351133
****************************************************************************/
11361134

1137-
int up_putc(int ch)
1135+
void up_putc(int ch)
11381136
{
11391137
#ifdef HAVE_UART
11401138
arm_lowputc(ch);
11411139
#endif
1142-
return ch;
11431140
}
11441141

11451142
#endif /* USE_SERIALDRIVER */

arch/arm/src/dm320/dm320_serial.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ void arm_serialinit(void)
742742
*
743743
****************************************************************************/
744744

745-
int up_putc(int ch)
745+
void up_putc(int ch)
746746
{
747747
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
748748
uint16_t ier;
@@ -753,7 +753,6 @@ int up_putc(int ch)
753753

754754
up_waittxready(priv);
755755
up_restoreuartint(priv, ier);
756-
return ch;
757756
}
758757

759758
#else /* USE_SERIALDRIVER */
@@ -789,13 +788,12 @@ static inline void up_waittxready(void)
789788
* Public Functions
790789
****************************************************************************/
791790

792-
int up_putc(int ch)
791+
void up_putc(int ch)
793792
{
794793
up_waittxready();
795794
putreg16((uint16_t)ch, DM320_REGISTER_BASE + UART_DTRR);
796795

797796
up_waittxready();
798-
return ch;
799797
}
800798

801799
#endif /* USE_SERIALDRIVER */

arch/arm/src/efm32/efm32_leserial.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -809,15 +809,14 @@ void arm_serialinit(void)
809809
****************************************************************************/
810810

811811
#ifdef HAVE_LEUART_CONSOLE
812-
int up_putc(int ch)
812+
void up_putc(int ch)
813813
{
814814
struct efm32_leuart_s *priv = (struct efm32_leuart_s *)CONSOLE_DEV.priv;
815815
uint32_t ien;
816816

817817
efm32_disableuartint(priv, &ien);
818818
efm32_lowputc(ch);
819819
efm32_restoreuartint(priv, ien);
820-
return ch;
821820
}
822821
#endif
823822

@@ -832,10 +831,9 @@ int up_putc(int ch)
832831
****************************************************************************/
833832

834833
#ifdef HAVE_LEUART_CONSOLE
835-
int up_putc(int ch)
834+
void up_putc(int ch)
836835
{
837836
efm32_lowputc(ch);
838-
return ch;
839837
}
840838
#endif
841839

0 commit comments

Comments
 (0)