tty: serial: samsung_tty: use standard debugging macros
The dbg() macro for the driver is not needed at all, all drivers should use the common dynamic debugging infrastructure, not roll their own. So delete the custom macro and convert the driver to use dev_dbg() instead, providing a lot more information than the previous macro provided. Cc: Kukjin Kim <kgene@kernel.org> Cc: Hyunki Koo <kkoos00@naver.com> Cc: HYUN-KI KOO <hyunki00.koo@samsung.com> Cc: Shinbeom Choi <sbeom.choi@samsung.com> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20191210143706.3928480-7-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f187a7fdfc
commit
a05025d0ce
1 changed files with 30 additions and 48 deletions
|
@ -46,28 +46,6 @@
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <asm/irq.h>
|
#include <asm/irq.h>
|
||||||
|
|
||||||
#if defined(CONFIG_SERIAL_SAMSUNG_DEBUG) && \
|
|
||||||
!defined(MODULE)
|
|
||||||
|
|
||||||
extern void printascii(const char *);
|
|
||||||
|
|
||||||
__printf(1, 2)
|
|
||||||
static void dbg(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list va;
|
|
||||||
char buff[256];
|
|
||||||
|
|
||||||
va_start(va, fmt);
|
|
||||||
vscnprintf(buff, sizeof(buff), fmt, va);
|
|
||||||
va_end(va);
|
|
||||||
|
|
||||||
printascii(buff);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
#define dbg(fmt, ...) do { if (0) no_printk(fmt, ##__VA_ARGS__); } while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* UART name and device definitions */
|
/* UART name and device definitions */
|
||||||
|
|
||||||
#define S3C24XX_SERIAL_NAME "ttySAC"
|
#define S3C24XX_SERIAL_NAME "ttySAC"
|
||||||
|
@ -517,7 +495,7 @@ static void s3c24xx_serial_stop_rx(struct uart_port *port)
|
||||||
unsigned int received;
|
unsigned int received;
|
||||||
|
|
||||||
if (rx_enabled(port)) {
|
if (rx_enabled(port)) {
|
||||||
dbg("s3c24xx_serial_stop_rx: port=%p\n", port);
|
dev_dbg(port->dev, "stopping rx\n");
|
||||||
if (s3c24xx_serial_has_interrupt_mask(port))
|
if (s3c24xx_serial_has_interrupt_mask(port))
|
||||||
s3c24xx_set_bit(port, S3C64XX_UINTM_RXD,
|
s3c24xx_set_bit(port, S3C64XX_UINTM_RXD,
|
||||||
S3C64XX_UINTM);
|
S3C64XX_UINTM);
|
||||||
|
@ -768,12 +746,13 @@ static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport)
|
||||||
port->icount.rx++;
|
port->icount.rx++;
|
||||||
|
|
||||||
if (unlikely(uerstat & S3C2410_UERSTAT_ANY)) {
|
if (unlikely(uerstat & S3C2410_UERSTAT_ANY)) {
|
||||||
dbg("rxerr: port ch=0x%02x, rxs=0x%08x\n",
|
dev_dbg(port->dev,
|
||||||
|
"rxerr: port ch=0x%02x, rxs=0x%08x\n",
|
||||||
ch, uerstat);
|
ch, uerstat);
|
||||||
|
|
||||||
/* check for break */
|
/* check for break */
|
||||||
if (uerstat & S3C2410_UERSTAT_BREAK) {
|
if (uerstat & S3C2410_UERSTAT_BREAK) {
|
||||||
dbg("break!\n");
|
dev_dbg(port->dev, "break!\n");
|
||||||
port->icount.brk++;
|
port->icount.brk++;
|
||||||
if (uart_handle_break(port))
|
if (uart_handle_break(port))
|
||||||
continue; /* Ignore character */
|
continue; /* Ignore character */
|
||||||
|
@ -1148,7 +1127,7 @@ static int s3c24xx_serial_startup(struct uart_port *port)
|
||||||
|
|
||||||
ourport->rx_claimed = 1;
|
ourport->rx_claimed = 1;
|
||||||
|
|
||||||
dbg("requesting tx irq...\n");
|
dev_dbg(port->dev, "requesting tx irq...\n");
|
||||||
|
|
||||||
tx_enabled(port) = 1;
|
tx_enabled(port) = 1;
|
||||||
|
|
||||||
|
@ -1433,29 +1412,30 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
|
||||||
|
|
||||||
if (cfg->has_fracval) {
|
if (cfg->has_fracval) {
|
||||||
udivslot = (div & 15);
|
udivslot = (div & 15);
|
||||||
dbg("fracval = %04x\n", udivslot);
|
dev_dbg(port->dev, "fracval = %04x\n", udivslot);
|
||||||
} else {
|
} else {
|
||||||
udivslot = udivslot_table[div & 15];
|
udivslot = udivslot_table[div & 15];
|
||||||
dbg("udivslot = %04x (div %d)\n", udivslot, div & 15);
|
dev_dbg(port->dev, "udivslot = %04x (div %d)\n",
|
||||||
|
udivslot, div & 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (termios->c_cflag & CSIZE) {
|
switch (termios->c_cflag & CSIZE) {
|
||||||
case CS5:
|
case CS5:
|
||||||
dbg("config: 5bits/char\n");
|
dev_dbg(port->dev, "config: 5bits/char\n");
|
||||||
ulcon = S3C2410_LCON_CS5;
|
ulcon = S3C2410_LCON_CS5;
|
||||||
break;
|
break;
|
||||||
case CS6:
|
case CS6:
|
||||||
dbg("config: 6bits/char\n");
|
dev_dbg(port->dev, "config: 6bits/char\n");
|
||||||
ulcon = S3C2410_LCON_CS6;
|
ulcon = S3C2410_LCON_CS6;
|
||||||
break;
|
break;
|
||||||
case CS7:
|
case CS7:
|
||||||
dbg("config: 7bits/char\n");
|
dev_dbg(port->dev, "config: 7bits/char\n");
|
||||||
ulcon = S3C2410_LCON_CS7;
|
ulcon = S3C2410_LCON_CS7;
|
||||||
break;
|
break;
|
||||||
case CS8:
|
case CS8:
|
||||||
default:
|
default:
|
||||||
dbg("config: 8bits/char\n");
|
dev_dbg(port->dev, "config: 8bits/char\n");
|
||||||
ulcon = S3C2410_LCON_CS8;
|
ulcon = S3C2410_LCON_CS8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1477,7 +1457,8 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
|
||||||
|
|
||||||
spin_lock_irqsave(&port->lock, flags);
|
spin_lock_irqsave(&port->lock, flags);
|
||||||
|
|
||||||
dbg("setting ulcon to %08x, brddiv to %d, udivslot %08x\n",
|
dev_dbg(port->dev,
|
||||||
|
"setting ulcon to %08x, brddiv to %d, udivslot %08x\n",
|
||||||
ulcon, quot, udivslot);
|
ulcon, quot, udivslot);
|
||||||
|
|
||||||
wr_regl(port, S3C2410_ULCON, ulcon);
|
wr_regl(port, S3C2410_ULCON, ulcon);
|
||||||
|
@ -1499,7 +1480,8 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
|
||||||
if (ourport->info->has_divslot)
|
if (ourport->info->has_divslot)
|
||||||
wr_regl(port, S3C2443_DIVSLOT, udivslot);
|
wr_regl(port, S3C2443_DIVSLOT, udivslot);
|
||||||
|
|
||||||
dbg("uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n",
|
dev_dbg(port->dev,
|
||||||
|
"uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n",
|
||||||
rd_regl(port, S3C2410_ULCON),
|
rd_regl(port, S3C2410_ULCON),
|
||||||
rd_regl(port, S3C2410_UCON),
|
rd_regl(port, S3C2410_UCON),
|
||||||
rd_regl(port, S3C2410_UFCON));
|
rd_regl(port, S3C2410_UFCON));
|
||||||
|
@ -1877,7 +1859,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
|
||||||
port->uartclk = 1;
|
port->uartclk = 1;
|
||||||
|
|
||||||
if (cfg->uart_flags & UPF_CONS_FLOW) {
|
if (cfg->uart_flags & UPF_CONS_FLOW) {
|
||||||
dbg("s3c24xx_serial_init_port: enabling flow control\n");
|
dev_dbg(port->dev, "enabling flow control\n");
|
||||||
port->flags |= UPF_CONS_FLOW;
|
port->flags |= UPF_CONS_FLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1889,7 +1871,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg("resource %pR)\n", res);
|
dev_dbg(port->dev, "resource %pR)\n", res);
|
||||||
|
|
||||||
port->membase = devm_ioremap(port->dev, res->start, resource_size(res));
|
port->membase = devm_ioremap(port->dev, res->start, resource_size(res));
|
||||||
if (!port->membase) {
|
if (!port->membase) {
|
||||||
|
@ -1951,7 +1933,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
|
||||||
wr_regl(port, S3C64XX_UINTSP, 0xf);
|
wr_regl(port, S3C64XX_UINTSP, 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg("port: map=%pa, mem=%p, irq=%d (%d,%d), clock=%u\n",
|
dev_dbg(port->dev, "port: map=%pa, mem=%p, irq=%d (%d,%d), clock=%u\n",
|
||||||
&port->mapbase, port->membase, port->irq,
|
&port->mapbase, port->membase, port->irq,
|
||||||
ourport->rx_irq, ourport->tx_irq, port->uartclk);
|
ourport->rx_irq, ourport->tx_irq, port->uartclk);
|
||||||
|
|
||||||
|
@ -2034,7 +2016,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
|
||||||
ourport->min_dma_size = max_t(int, ourport->port.fifosize,
|
ourport->min_dma_size = max_t(int, ourport->port.fifosize,
|
||||||
dma_get_cache_alignment());
|
dma_get_cache_alignment());
|
||||||
|
|
||||||
dbg("%s: initialising port %p...\n", __func__, ourport);
|
dev_dbg(&pdev->dev, "%s: initialising port %p...\n", __func__, ourport);
|
||||||
|
|
||||||
ret = s3c24xx_serial_init_port(ourport, pdev);
|
ret = s3c24xx_serial_init_port(ourport, pdev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -2048,7 +2030,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg("%s: adding port\n", __func__);
|
dev_dbg(&pdev->dev, "%s: adding port\n", __func__);
|
||||||
uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
|
uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
|
||||||
platform_set_drvdata(pdev, &ourport->port);
|
platform_set_drvdata(pdev, &ourport->port);
|
||||||
|
|
||||||
|
@ -2303,7 +2285,7 @@ s3c24xx_serial_get_options(struct uart_port *port, int *baud,
|
||||||
rate = 1;
|
rate = 1;
|
||||||
|
|
||||||
*baud = rate / (16 * (ubrdiv + 1));
|
*baud = rate / (16 * (ubrdiv + 1));
|
||||||
dbg("calculated baud %d\n", *baud);
|
dev_dbg(port->dev, "calculated baud %d\n", *baud);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2341,7 +2323,7 @@ s3c24xx_serial_console_setup(struct console *co, char *options)
|
||||||
else
|
else
|
||||||
s3c24xx_serial_get_options(port, &baud, &parity, &bits);
|
s3c24xx_serial_get_options(port, &baud, &parity, &bits);
|
||||||
|
|
||||||
dbg("s3c24xx_serial_console_setup: baud %d\n", baud);
|
dev_dbg(port->dev, "baud %d\n", baud);
|
||||||
|
|
||||||
return uart_set_options(port, co, baud, parity, bits, flow);
|
return uart_set_options(port, co, baud, parity, bits, flow);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue