Skip to contentSkip to conversation

common/console.c: Remove unused inline functions

PATCH Superseded Tom Rini 2 participants 7 messages Jan 20, 2016 – Jan 25, 2016 PowerPC

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 common/console.c: Remove unused inline functions

clang-3.8 reports that these functions are unused, remove them.

---
 common/console.c |   48 ------------------------------------------------
 1 file changed, 48 deletions(-)
common/console.c +0 -48
index bc37b6d..b3f5fdc 100644
@@ -227,11 +227,6 @@ static void console_puts(int file, const char *s)
 	}
 }
 
-static inline void console_printdevs(int file)
-{
-	iomux_printdevs(file);
-}
-
 static inline void console_doenv(int file, struct stdio_dev *dev)
 {
 	iomux_doenv(file, dev->name);
@@ -265,11 +260,6 @@ static inline void console_puts(int file, const char *s)
 	stdio_devices[file]->puts(stdio_devices[file], s);
 }
 
-static inline void console_printdevs(int file)
-{
-	printf("%s\n", stdio_devices[file]->name);
-}
-
 static inline void console_doenv(int file, struct stdio_dev *dev)
 {
 	console_setfile(file, dev);
@@ -653,44 +643,6 @@ void clear_ctrlc(void)
 	ctrlc_was_pressed = 0;
 }
 
-#ifdef CONFIG_MODEM_SUPPORT_DEBUG
-char	screen[1024];
-char *cursor = screen;
-int once = 0;
-inline void dbg(const char *fmt, ...)
-{
-	va_list	args;
-	uint	i;
-	char	printbuffer[CONFIG_SYS_PBSIZE];
-
-	if (!once) {
-		memset(screen, 0, sizeof(screen));
-		once++;
-	}
-
-	va_start(args, fmt);
-
-	/* For this to work, printbuffer must be larger than
-	 * anything we ever want to print.
-	 */
-	i = vsnprintf(printbuffer, sizeof(printbuffer), fmt, args);
-	va_end(args);
-
-	if ((screen + sizeof(screen) - 1 - cursor)
-	    < strlen(printbuffer) + 1) {
-		memset(screen, 0, sizeof(screen));
-		cursor = screen;
-	}
-	sprintf(cursor, printbuffer);
-	cursor += strlen(printbuffer);
-
-}
-#else
-static inline void dbg(const char *fmt, ...)
-{
-}
-#endif
-
 /** U-Boot INIT FUNCTIONS *************************************************/
 
 struct stdio_dev *search_device(int flags, const char *name)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/2 serial: Remove serial_putc_raw_dev

clang-3.8 reports that serial_putc_raw_dev in serial_ns16550.c is unused. Further investigation shows that we have 3 places that implement this function and no callers, remove.

---
 arch/powerpc/cpu/mpc512x/serial.c |   12 ------------
 arch/powerpc/cpu/mpc5xxx/serial.c |   11 -----------
 drivers/serial/serial_ns16550.c   |   11 -----------
 3 files changed, 34 deletions(-)
arch/powerpc/cpu/mpc512x/serial.c +0 -12
index 4105a28..ac77ddc 100644
@@ -203,18 +203,6 @@ void serial_putc_dev(unsigned int idx, const char c)
 	out_8(&psc->tfdata_8, c);
 }
 
-void serial_putc_raw_dev(unsigned int idx, const char c)
-{
-	volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
-	volatile psc512x_t *psc = (psc512x_t *) &im->psc[idx];
-
-	/* Wait for last character to go. */
-	while (!(in_be16(&psc->psc_status) & PSC_SR_TXEMP))
-		;
-
-	out_8(&psc->tfdata_8, c);
-}
-
 void serial_puts_dev(unsigned int idx, const char *s)
 {
 	while (*s)
arch/powerpc/cpu/mpc5xxx/serial.c +0 -11
index cb5b0bf..bccdcf7 100644
@@ -112,17 +112,6 @@ void serial_putc_dev (unsigned long dev_base, const char c)
 	psc->psc_buffer_8 = c;
 }
 
-void serial_putc_raw_dev(unsigned long dev_base, const char c)
-{
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-	/* Wait for last character to go. */
-	while (!(psc->psc_status & PSC_SR_TXEMP))
-		;
-
-	psc->psc_buffer_8 = c;
-}
-
-
 void serial_puts_dev (unsigned long dev_base, const char *s)
 {
 	while (*s) {
drivers/serial/serial_ns16550.c +0 -11
index 799ef6a..fcb1e95 100644
@@ -127,11 +127,6 @@ static void _serial_putc(const char c, const int port)
 	NS16550_putc(PORT, c);
 }
 
-static void _serial_putc_raw(const char c, const int port)
-{
-	NS16550_putc(PORT, c);
-}
-
 static void _serial_puts(const char *s, const int port)
 {
 	while (*s) {
@@ -165,12 +160,6 @@ serial_putc_dev(unsigned int dev_index,const char c)
 }
 
 static inline void
-serial_putc_raw_dev(unsigned int dev_index,const char c)
-{
-	_serial_putc_raw(c,dev_index);
-}
-
-static inline void
 serial_puts_dev(unsigned int dev_index,const char *s)
 {
 	_serial_puts(s,dev_index);
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 serial: Remove serial_putc_raw_dev

Quoted 11 lines · Tom Rini

clang-3.8 reports that serial_putc_raw_dev in serial_ns16550.c is unused. Further investigation shows that we have 3 places that implement this function and no callers, remove.

---
 arch/powerpc/cpu/mpc512x/serial.c |   12 ------------
 arch/powerpc/cpu/mpc5xxx/serial.c |   11 -----------
 drivers/serial/serial_ns16550.c   |   11 -----------
 3 files changed, 34 deletions(-)
author
#3 lore raw

PATCH 2/2 serial: Remove serial_putc_raw_dev

In reply to Tom Rini
Quoted 6 lines · Tom Rini

clang-3.8 reports that serial_putc_raw_dev in serial_ns16550.c is unused. Further investigation shows that we have 3 places that implement this function and no callers, remove.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160125/11274f57/attachment.sig>
#4 lore raw

PATCH 1/2 common/console.c: Remove unused inline functions

In reply to Tom Rini

Hi Tom,

Quoted 71 lines · Tom Rini

clang-3.8 reports that these functions are unused, remove them.

---
 common/console.c |   48 ------------------------------------------------
 1 file changed, 48 deletions(-)
common/console.c +0 -42
index bc37b6d..b3f5fdc 100644
@@ -227,11 +227,6 @@ static void console_puts(int file, const char *s)
        }
 }
 
-static inline void console_printdevs(int file)
-{
-       iomux_printdevs(file);
-}
-
 static inline void console_doenv(int file, struct stdio_dev *dev)
 {
        iomux_doenv(file, dev->name);
@@ -265,11 +260,6 @@ static inline void console_puts(int file, const char *s)
        stdio_devices[file]->puts(stdio_devices[file], s);
 }
 
-static inline void console_printdevs(int file)
-{
-       printf("%s\n", stdio_devices[file]->name);
-}
-
 static inline void console_doenv(int file, struct stdio_dev *dev)
 {
        console_setfile(file, dev);
@@ -653,44 +643,6 @@ void clear_ctrlc(void)
        ctrlc_was_pressed = 0;
 }
 
-#ifdef CONFIG_MODEM_SUPPORT_DEBUG
-char   screen[1024];
-char *cursor = screen;
-int once = 0;
-inline void dbg(const char *fmt, ...)
-{
-       va_list args;
-       uint    i;
-       char    printbuffer[CONFIG_SYS_PBSIZE];
-
-       if (!once) {
-               memset(screen, 0, sizeof(screen));
-               once++;
-       }
-
-       va_start(args, fmt);
-
-       /* For this to work, printbuffer must be larger than
-        * anything we ever want to print.
-        */
-       i = vsnprintf(printbuffer, sizeof(printbuffer), fmt, args);
-       va_end(args);
-
-       if ((screen + sizeof(screen) - 1 - cursor)
-           < strlen(printbuffer) + 1) {
-               memset(screen, 0, sizeof(screen));
-               cursor = screen;
-       }
-       sprintf(cursor, printbuffer);
-       cursor += strlen(printbuffer);
-
-}

common/console.c void clear_ctrlc(void)

Quoted 10 lines
common/console.c +0 -7
-#else
-static inline void dbg(const char *fmt, ...)
-{
-}
-#endif
-
 /** U-Boot INIT FUNCTIONS *************************************************/
 
 struct stdio_dev *search_device(int flags, const char *name)
--

Please remove one more instance of CONFIG_MODEM_SUPPORT_DEBUG in README.

Other than that,

Regards,
Bin

author
#5 lore raw

PATCH v2 1/1 common/console.c: Remove unused inline functions

In reply to Tom Rini

clang-3.8 reports that these functions are unused, remove them. As this is the last part of CONFIG_MODEM_SUPPORT_DEBUG, drop that from README.

---
Changes in v2:
- Drop CONFIG_MODEM_SUPPORT_DEBUG from README as per Bin

---
 README           |    6 ------
 common/console.c |   48 ------------------------------------------------
 2 files changed, 54 deletions(-)
README +0 -6
index ece4793..864c7cc 100644
@@ -3712,12 +3712,6 @@ Modem Support:
 - RTS/CTS Flow control enable:
 		CONFIG_HWFLOW
 
-- Modem debug support:
-		CONFIG_MODEM_SUPPORT_DEBUG
-
-		Enables debugging stuff (char screen[1024], dbg())
-		for modem support. Useful only with BDI2000.
-
 - Interrupt support (PPC):
 
 		There are common interrupt_init() and timer_interrupt()
common/console.c +0 -48

66 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#6 lore raw

PATCH v2 1/1 common/console.c: Remove unused inline functions

Quoted 5 lines · Tom Rini

clang-3.8 reports that these functions are unused, remove them. As this is the last part of CONFIG_MODEM_SUPPORT_DEBUG, drop that from README.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160125/c7e9cfa3/attachment.sig>