* [PATCH 24/41] drivers: tty: serial: timbuart: use dev_err() instead of printk()
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Using dev_err() instead of printk() for more consistent output.
(prints device name, etc).
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/timbuart.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c
index 19d38b5..dcce936 100644
--- a/drivers/tty/serial/timbuart.c
+++ b/drivers/tty/serial/timbuart.c
@@ -470,8 +470,7 @@ static int timbuart_probe(struct platform_device *dev)
err_register:
kfree(uart);
err_mem:
- printk(KERN_ERR "timberdale: Failed to register Timberdale UART: %d\n",
- err);
+ dev_err(&dev->dev, "Failed to register Timberdale UART: %d\n", err);
return err;
}
--
1.9.1
^ permalink raw reply related
* [PATCH 23/41] drivers: tty: serial: cpm_uart: fix styling issues
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix checkpatch errors:
ERROR: else should follow close brace '}'
#121: FILE: drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c:121:
+ }
+ else
WARNING: line over 80 characters
#150: FILE: drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c:150:
+ pinfo->tx_fifosize), (void __force *)pinfo->mem_addr,
WARNING: Block comments should align the * on each line
#66: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:66:
+ * Check, if transmit buffers are processed
+*/
WARNING: braces {} are not necessary for any arm of this statement
#170: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:170:
+ if (IS_SMC(pinfo)) {
[...]
+ } else {
[...]
WARNING: labels should not be indented
#292: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:292:
+ error_return:
ERROR: code indent should use tabs where possible
#299: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:299:
+^I^I BD_SC_OV | BD_SC_ID);$
WARNING: labels should not be indented
#319: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:319:
+ handle_error:
WARNING: line over 80 characters
#423: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:423:
+ setbits32(&pinfo->sccp->scc_gsmrl, (SCC_GSMRL_ENR | SCC_GSMRL_ENT));
ERROR: space required before the open parenthesis '('
#451: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:451:
+ while(!cpm_uart_tx_empty(port)) {
WARNING: Missing a blank line after declarations
#462: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:462:
+ smc_t __iomem *smcp = pinfo->smcp;
+ clrbits16(&smcp->smc_smcmr, SMCMR_REN | SMCMR_TEN);
WARNING: line over 80 characters
#466: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:466:
+ clrbits32(&sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
WARNING: Missing a blank line after declarations
#466: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:466:
+ scc_t __iomem *sccp = pinfo->sccp;
+ clrbits32(&sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
ERROR: code indent should use tabs where possible
#484: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:484:
+ struct ktermios *termios,$
WARNING: please, no spaces at the start of a line
#484: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:484:
+ struct ktermios *termios,$
ERROR: code indent should use tabs where possible
#485: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:485:
+ struct ktermios *old)$
WARNING: please, no spaces at the start of a line
#485: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:485:
+ struct ktermios *old)$
WARNING: line over 80 characters
#624: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:624:
+ /* Output in *one* operation, so we don't interrupt RX/TX if they
WARNING: Block comments use a trailing */ on a separate line
#625: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:625:
+ * were already enabled. */
WARNING: line over 80 characters
#629: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:629:
+ out_be16(&pinfo->sccup->scc_genscc.scc_mrblr, pinfo->rx_fifosize);
WARNING: line over 80 characters
#773: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:773:
+ mem_addr = pinfo->mem_addr + L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize);
ERROR: code indent should use tabs where possible
#797: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:797:
+^I (u8 __iomem *)pinfo->rx_bd_base - DPRAM_BASE);$
ERROR: code indent should use tabs where possible
#799: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:799:
+^I (u8 __iomem *)pinfo->tx_bd_base - DPRAM_BASE);$
ERROR: code indent should use tabs where possible
#836: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:836:
+^I SCC_GSMRL_MODE_UART | SCC_GSMRL_TDCR_16 | SCC_GSMRL_RDCR_16);$
ERROR: code indent should use tabs where possible
#859: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:859:
+^I (u8 __iomem *)pinfo->rx_bd_base - DPRAM_BASE);$
ERROR: code indent should use tabs where possible
#861: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:861:
+^I (u8 __iomem *)pinfo->tx_bd_base - DPRAM_BASE);$
WARNING: space prohibited between function name and open parenthesis '('
#866: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:866:
+#if defined (CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
WARNING: line over 80 characters
#921: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:921:
+ clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
WARNING: Missing a blank line after declarations
#462: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:462:
+ smc_t __iomem *smcp = pinfo->smcp;
+ clrbits16(&smcp->smc_smcmr,
WARNING: Missing a blank line after declarations
#467: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:467:
+ scc_t __iomem *sccp = pinfo->sccp;
+ clrbits32(&sccp->scc_gsmrl,
ERROR: code indent should use tabs where possible
#1151: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1151:
+ struct uart_cpm_port *pinfo)$
WARNING: please, no spaces at the start of a line
#1151: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1151:
+ struct uart_cpm_port *pinfo)$
ERROR: "(foo*)" should be "(foo *)"
#1161: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1161:
+ struct clk *clk = clk_get(NULL, (const char*)data);
WARNING: Missing a blank line after declarations
#1162: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1162:
+ struct clk *clk = clk_get(NULL, (const char*)data);
+ if (!IS_ERR(clk))
ERROR: code indent should use tabs where possible
#1169: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1169:
+^I^I^I "fsl,cpm-brg property.\n", np);$
ERROR: code indent should use tabs where possible
#1178: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1178:
+^I^I "fsl,cpm-command property.\n", np);$
ERROR: code indent should use tabs where possible
#1192: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1192:
WARNING: braces {} are not necessary for any arm of this statement
#1279: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1279:
+ if (unlikely(nolock)) {
[...]
+ } else {
[...]
WARNING: braces {} are not necessary for any arm of this statement
#1287: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1287:
+ if (unlikely(nolock)) {
[...]
+ } else {
[...]
WARNING: line over 80 characters
#1354: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1354:
+ clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
ERROR: Macros with complex values should be enclosed in parentheses
#1394: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1394:
+#define CPM_UART_CONSOLE &cpm_scc_uart_console
WARNING: Missing a blank line after declarations
#1437: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1437:
+ struct uart_cpm_port *pinfo = platform_get_drvdata(ofdev);
+ return uart_remove_one_port(&cpm_reg, &pinfo->port);
WARNING: please, no spaces at the start of a line
#1464: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1464:
+ };$
WARNING: Missing a blank line after declarations
#1469: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1469:
+ int ret = uart_register_driver(&cpm_reg);
+ if (ret)
WARNING: Missing a blank line after declarations
#1062: FILE: drivers/tty/serial/cpm_uart/cpm_uart_core.c:1062:
+ int i;
+ volatile cbd_t *bdp;
ERROR: "foo * bar" should be "foo *bar"
#19: FILE: drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h:19:
+static inline void cpm_set_scc_fcr(scc_uart_t __iomem * sup)
ERROR: "foo * bar" should be "foo *bar"
#25: FILE: drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h:25:
+static inline void cpm_set_smc_fcr(smc_uart_t __iomem * up)
WARNING: Improper SPDX comment style for 'drivers/tty/serial/cpm_uart/cpm_uart.h', please use '/*' instead
#1: FILE: drivers/tty/serial/cpm_uart/cpm_uart.h:1:
+// SPDX-License-Identifier: GPL-2.0
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#1: FILE: drivers/tty/serial/cpm_uart/cpm_uart.h:1:
+// SPDX-License-Identifier: GPL-2.0
WARNING: Block comments use * on subsequent lines
#106: FILE: drivers/tty/serial/cpm_uart/cpm_uart.h:106:
+/*
+ virtual to phys transtalion
ERROR: code indent should use tabs where possible
#109: FILE: drivers/tty/serial/cpm_uart/cpm_uart.h:109:
+ struct uart_cpm_port *pinfo)$
WARNING: please, no spaces at the start of a line
#109: FILE: drivers/tty/serial/cpm_uart/cpm_uart.h:109:
+ struct uart_cpm_port *pinfo)$
ERROR: code indent should use tabs where possible
#125: FILE: drivers/tty/serial/cpm_uart/cpm_uart.h:125:
+ struct uart_cpm_port *pinfo)$
WARNING: please, no spaces at the start of a line
#125: FILE: drivers/tty/serial/cpm_uart/cpm_uart.h:125:
+ struct uart_cpm_port *pinfo)$
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/cpm_uart/cpm_uart.h | 10 +--
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 95 ++++++++++++++++-------------
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h | 4 +-
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 6 +-
4 files changed, 64 insertions(+), 51 deletions(-)
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart/cpm_uart.h
index 9f175a9..e7e225f 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart.h
+++ b/drivers/tty/serial/cpm_uart/cpm_uart.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Driver for CPM (SCC/SMC) serial ports
*
@@ -103,10 +103,10 @@ void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
void scc4_lineif(struct uart_cpm_port *pinfo);
/*
- virtual to phys transtalion
-*/
+ * virtual to phys transtalion
+ */
static inline unsigned long cpu2cpm_addr(void *addr,
- struct uart_cpm_port *pinfo)
+ struct uart_cpm_port *pinfo)
{
int offset;
u32 val = (u32)addr;
@@ -122,7 +122,7 @@ static inline unsigned long cpu2cpm_addr(void *addr,
}
static inline void *cpm2cpu_addr(unsigned long addr,
- struct uart_cpm_port *pinfo)
+ struct uart_cpm_port *pinfo)
{
int offset;
u32 val = addr;
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index c831d31..4d6cea9 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -63,7 +63,7 @@
/*
* Check, if transmit buffers are processed
-*/
+ */
static unsigned int cpm_uart_tx_empty(struct uart_port *port)
{
struct uart_cpm_port *pinfo =
@@ -167,11 +167,10 @@ static void cpm_uart_start_tx(struct uart_port *port)
}
if (cpm_uart_tx_pump(port) != 0) {
- if (IS_SMC(pinfo)) {
+ if (IS_SMC(pinfo))
setbits8(&smcp->smc_smcm, SMCM_TX);
- } else {
+ else
setbits16(&sccp->scc_sccm, UART_SCCM_TX);
- }
}
}
@@ -289,14 +288,14 @@ static void cpm_uart_int_rx(struct uart_port *port)
return;
}
#endif
- error_return:
+error_return:
tty_insert_flip_char(tport, ch, flg);
} /* End while (i--) */
/* This BD is ready to be used again. Clear status. get next */
clrbits16(&bdp->cbd_sc, BD_SC_BR | BD_SC_FR | BD_SC_PR |
- BD_SC_OV | BD_SC_ID);
+ BD_SC_OV | BD_SC_ID);
setbits16(&bdp->cbd_sc, BD_SC_EMPTY);
if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
@@ -316,7 +315,7 @@ static void cpm_uart_int_rx(struct uart_port *port)
/* Error processing */
- handle_error:
+handle_error:
/* Statistics */
if (status & BD_SC_BR)
port->icount.brk++;
@@ -420,7 +419,8 @@ static int cpm_uart_startup(struct uart_port *port)
setbits16(&pinfo->smcp->smc_smcmr, (SMCMR_REN | SMCMR_TEN));
} else {
setbits16(&pinfo->sccp->scc_sccm, UART_SCCM_RX);
- setbits32(&pinfo->sccp->scc_gsmrl, (SCC_GSMRL_ENR | SCC_GSMRL_ENT));
+ setbits32(&pinfo->sccp->scc_gsmrl,
+ (SCC_GSMRL_ENR | SCC_GSMRL_ENT));
}
return 0;
@@ -448,7 +448,7 @@ static void cpm_uart_shutdown(struct uart_port *port)
/* If the port is not the console, disable Rx and Tx. */
if (!(pinfo->flags & FLAG_CONSOLE)) {
/* Wait for all the BDs marked sent */
- while(!cpm_uart_tx_empty(port)) {
+ while (!cpm_uart_tx_empty(port)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(2);
}
@@ -459,12 +459,17 @@ static void cpm_uart_shutdown(struct uart_port *port)
/* Stop uarts */
if (IS_SMC(pinfo)) {
smc_t __iomem *smcp = pinfo->smcp;
- clrbits16(&smcp->smc_smcmr, SMCMR_REN | SMCMR_TEN);
+
+ clrbits16(&smcp->smc_smcmr,
+ SMCMR_REN | SMCMR_TEN);
clrbits8(&smcp->smc_smcm, SMCM_RX | SMCM_TX);
} else {
scc_t __iomem *sccp = pinfo->sccp;
- clrbits32(&sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
- clrbits16(&sccp->scc_sccm, UART_SCCM_TX | UART_SCCM_RX);
+
+ clrbits32(&sccp->scc_gsmrl,
+ SCC_GSMRL_ENR | SCC_GSMRL_ENT);
+ clrbits16(&sccp->scc_sccm,
+ UART_SCCM_TX | UART_SCCM_RX);
}
/* Shut them really down and reinit buffer descriptors */
@@ -481,8 +486,8 @@ static void cpm_uart_shutdown(struct uart_port *port)
}
static void cpm_uart_set_termios(struct uart_port *port,
- struct ktermios *termios,
- struct ktermios *old)
+ struct ktermios *termios,
+ struct ktermios *old)
{
int baud;
unsigned long flags;
@@ -621,12 +626,14 @@ static void cpm_uart_set_termios(struct uart_port *port,
* present.
*/
prev_mode = in_be16(&smcp->smc_smcmr) & (SMCMR_REN | SMCMR_TEN);
- /* Output in *one* operation, so we don't interrupt RX/TX if they
- * were already enabled. */
+ /* Output in *one* operation, so we don't interrupt RX/TX if
+ * they were already enabled.
+ */
out_be16(&smcp->smc_smcmr, smcr_mk_clen(bits) | cval |
SMCMR_SM_UART | prev_mode);
} else {
- out_be16(&pinfo->sccup->scc_genscc.scc_mrblr, pinfo->rx_fifosize);
+ out_be16(&pinfo->sccup->scc_genscc.scc_mrblr,
+ pinfo->rx_fifosize);
out_be16(&pinfo->sccup->scc_maxidl, maxidl);
out_be16(&sccp->scc_psmr, (sbits << 12) | scval);
}
@@ -770,7 +777,8 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo)
* buffers in the buffer descriptors, and the
* virtual address for us to work with.
*/
- mem_addr = pinfo->mem_addr + L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize);
+ mem_addr = pinfo->mem_addr +
+ L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize);
bdp = pinfo->tx_cur = pinfo->tx_bd_base;
for (i = 0; i < (pinfo->tx_nrfifos - 1); i++, bdp++) {
out_be32(&bdp->cbd_bufaddr, cpu2cpm_addr(mem_addr, pinfo));
@@ -794,9 +802,9 @@ static void cpm_uart_init_scc(struct uart_cpm_port *pinfo)
/* Store address */
out_be16(&pinfo->sccup->scc_genscc.scc_rbase,
- (u8 __iomem *)pinfo->rx_bd_base - DPRAM_BASE);
+ (u8 __iomem *)pinfo->rx_bd_base - DPRAM_BASE);
out_be16(&pinfo->sccup->scc_genscc.scc_tbase,
- (u8 __iomem *)pinfo->tx_bd_base - DPRAM_BASE);
+ (u8 __iomem *)pinfo->tx_bd_base - DPRAM_BASE);
/* Set up the uart parameters in the
* parameter ram.
@@ -833,7 +841,7 @@ static void cpm_uart_init_scc(struct uart_cpm_port *pinfo)
*/
out_be32(&scp->scc_gsmrh, 0);
out_be32(&scp->scc_gsmrl,
- SCC_GSMRL_MODE_UART | SCC_GSMRL_TDCR_16 | SCC_GSMRL_RDCR_16);
+ SCC_GSMRL_MODE_UART | SCC_GSMRL_TDCR_16 | SCC_GSMRL_RDCR_16);
/* Enable rx interrupts and clear all pending events. */
out_be16(&scp->scc_sccm, 0);
@@ -856,14 +864,14 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo)
/* Store address */
out_be16(&pinfo->smcup->smc_rbase,
- (u8 __iomem *)pinfo->rx_bd_base - DPRAM_BASE);
+ (u8 __iomem *)pinfo->rx_bd_base - DPRAM_BASE);
out_be16(&pinfo->smcup->smc_tbase,
- (u8 __iomem *)pinfo->tx_bd_base - DPRAM_BASE);
+ (u8 __iomem *)pinfo->tx_bd_base - DPRAM_BASE);
/*
* In case SMC1 is being relocated...
*/
-#if defined (CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
+#if defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
out_be16(&up->smc_rbptr, in_be16(&pinfo->smcup->smc_rbase));
out_be16(&up->smc_tbptr, in_be16(&pinfo->smcup->smc_tbase));
out_be32(&up->smc_rstate, 0);
@@ -917,8 +925,10 @@ static int cpm_uart_request_port(struct uart_port *port)
clrbits8(&pinfo->smcp->smc_smcm, SMCM_RX | SMCM_TX);
clrbits16(&pinfo->smcp->smc_smcmr, SMCMR_REN | SMCMR_TEN);
} else {
- clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_TX | UART_SCCM_RX);
- clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
+ clrbits16(&pinfo->sccp->scc_sccm,
+ UART_SCCM_TX | UART_SCCM_RX);
+ clrbits32(&pinfo->sccp->scc_gsmrl,
+ SCC_GSMRL_ENR | SCC_GSMRL_ENT);
}
ret = cpm_uart_allocbuf(pinfo, 0);
@@ -1048,9 +1058,10 @@ static void cpm_uart_early_write(struct uart_cpm_port *pinfo,
static int poll_wait_key(char *obuf, struct uart_cpm_port *pinfo)
{
u_char c, *cp;
- volatile cbd_t *bdp;
int i;
+ volatile cbd_t *bdp;
+
/* Get the address of the host memory buffer.
*/
bdp = pinfo->rx_cur;
@@ -1138,7 +1149,7 @@ static void cpm_put_poll_char(struct uart_port *port,
struct uart_cpm_port cpm_uart_ports[UART_NR];
static int cpm_uart_init_port(struct device_node *np,
- struct uart_cpm_port *pinfo)
+ struct uart_cpm_port *pinfo)
{
const u32 *data;
void __iomem *mem, *pram;
@@ -1148,7 +1159,8 @@ static int cpm_uart_init_port(struct device_node *np,
data = of_get_property(np, "clock", NULL);
if (data) {
- struct clk *clk = clk_get(NULL, (const char*)data);
+ struct clk *clk = clk_get(NULL, (const char *)data);
+
if (!IS_ERR(clk))
pinfo->clk = clk;
}
@@ -1156,7 +1168,7 @@ static int cpm_uart_init_port(struct device_node *np,
data = of_get_property(np, "fsl,cpm-brg", &len);
if (!data || len != 4) {
dev_err(port->dev, "CPM UART %pOFn has no/invalid "
- "fsl,cpm-brg property.\n", np);
+ "fsl,cpm-brg property.\n", np);
return -EINVAL;
}
pinfo->brg = *data;
@@ -1165,7 +1177,7 @@ static int cpm_uart_init_port(struct device_node *np,
data = of_get_property(np, "fsl,cpm-command", &len);
if (!data || len != 4) {
dev_err(port->dev, "CPM UART %pOFn has no/invalid "
- "fsl,cpm-command property.\n", np);
+ "fsl,cpm-command property.\n", np);
return -EINVAL;
}
pinfo->command = *data;
@@ -1179,7 +1191,7 @@ static int cpm_uart_init_port(struct device_node *np,
pinfo->sccp = mem;
pinfo->sccup = pram = cpm_uart_map_pram(pinfo, np);
} else if (of_device_is_compatible(np, "fsl,cpm1-smc-uart") ||
- of_device_is_compatible(np, "fsl,cpm2-smc-uart")) {
+ of_device_is_compatible(np, "fsl,cpm2-smc-uart")) {
pinfo->flags |= FLAG_SMC;
pinfo->smcp = mem;
pinfo->smcup = pram = cpm_uart_map_pram(pinfo, np);
@@ -1266,19 +1278,17 @@ static void cpm_uart_console_write(struct console *co, const char *s,
unsigned long flags;
int nolock = oops_in_progress;
- if (unlikely(nolock)) {
+ if (unlikely(nolock))
local_irq_save(flags);
- } else {
+ else
spin_lock_irqsave(&pinfo->port.lock, flags);
- }
cpm_uart_early_write(pinfo, s, count, true);
- if (unlikely(nolock)) {
+ if (unlikely(nolock))
local_irq_restore(flags);
- } else {
+ else
spin_unlock_irqrestore(&pinfo->port.lock, flags);
- }
}
@@ -1341,7 +1351,8 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
out_be16(&pinfo->sccup->scc_brkcr, 0);
cpm_line_cr_cmd(pinfo, CPM_CR_GRA_STOP_TX);
clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_TX | UART_SCCM_RX);
- clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
+ clrbits32(&pinfo->sccp->scc_gsmrl,
+ SCC_GSMRL_ENR | SCC_GSMRL_ENT);
}
ret = cpm_uart_allocbuf(pinfo, 1);
@@ -1381,7 +1392,7 @@ static int __init cpm_uart_console_init(void)
console_initcall(cpm_uart_console_init);
-#define CPM_UART_CONSOLE &cpm_scc_uart_console
+#define CPM_UART_CONSOLE (&cpm_scc_uart_console)
#else
#define CPM_UART_CONSOLE NULL
#endif
@@ -1424,6 +1435,7 @@ static int cpm_uart_probe(struct platform_device *ofdev)
static int cpm_uart_remove(struct platform_device *ofdev)
{
struct uart_cpm_port *pinfo = platform_get_drvdata(ofdev);
+
return uart_remove_one_port(&cpm_reg, &pinfo->port);
}
@@ -1451,11 +1463,12 @@ static int cpm_uart_remove(struct platform_device *ofdev)
},
.probe = cpm_uart_probe,
.remove = cpm_uart_remove,
- };
+};
static int __init cpm_uart_init(void)
{
int ret = uart_register_driver(&cpm_reg);
+
if (ret)
return ret;
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h
index 18ec084..eafff96 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h
@@ -16,13 +16,13 @@ static inline void cpm_set_brg(int brg, int baud)
cpm_setbrg(brg, baud);
}
-static inline void cpm_set_scc_fcr(scc_uart_t __iomem * sup)
+static inline void cpm_set_scc_fcr(scc_uart_t __iomem *sup)
{
out_8(&sup->scc_genscc.scc_rfcr, SMC_EB);
out_8(&sup->scc_genscc.scc_tfcr, SMC_EB);
}
-static inline void cpm_set_smc_fcr(smc_uart_t __iomem * up)
+static inline void cpm_set_smc_fcr(smc_uart_t __iomem *up)
{
out_8(&up->smc_rfcr, SMC_EB);
out_8(&up->smc_tfcr, SMC_EB);
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
index a0fccda..154ac19 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
@@ -117,8 +117,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
if (is_con) {
mem_addr = kzalloc(memsz, GFP_NOWAIT);
dma_addr = virt_to_bus(mem_addr);
- }
- else
+ } else
mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr,
GFP_KERNEL);
@@ -148,7 +147,8 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos *
pinfo->rx_fifosize) +
L1_CACHE_ALIGN(pinfo->tx_nrfifos *
- pinfo->tx_fifosize), (void __force *)pinfo->mem_addr,
+ pinfo->tx_fifosize),
+ (void __force *)pinfo->mem_addr,
pinfo->dma_addr);
cpm_dpfree(pinfo->dp_addr);
--
1.9.1
^ permalink raw reply related
* [PATCH 22/41] drivers: tty: serial: cpm_uart: fix logging calls
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix checkpatch warnings by using pr_err():
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
#109: FILE: drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c:109:
+ printk(KERN_ERR
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
#128: FILE: drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c:128:
+ printk(KERN_ERR
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
+ printk(KERN_ERR
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c | 6 ++----
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
index 56fc527..aed61e9 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
@@ -71,8 +71,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos);
dp_offset = cpm_dpalloc(dpmemsz, 8);
if (IS_ERR_VALUE(dp_offset)) {
- printk(KERN_ERR
- "cpm_uart_cpm1.c: could not allocate buffer descriptors\n");
+ pr_err("cpm_uart_cpm1.c: could not allocate buffer descriptors\n");
return -ENOMEM;
}
dp_mem = cpm_dpram_addr(dp_offset);
@@ -90,8 +89,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
if (mem_addr == NULL) {
cpm_dpfree(dp_offset);
- printk(KERN_ERR
- "cpm_uart_cpm1.c: could not allocate coherent memory\n");
+ pr_err("cpm_uart_cpm1.c: could not allocate coherent memory\n");
return -ENOMEM;
}
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
index 40cfcf4..a0fccda 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
@@ -106,8 +106,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos);
dp_offset = cpm_dpalloc(dpmemsz, 8);
if (IS_ERR_VALUE(dp_offset)) {
- printk(KERN_ERR
- "cpm_uart_cpm.c: could not allocate buffer descriptors\n");
+ pr_err("cpm_uart_cpm.c: could not allocate buffer descriptors\n");
return -ENOMEM;
}
@@ -125,8 +124,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
if (mem_addr == NULL) {
cpm_dpfree(dp_offset);
- printk(KERN_ERR
- "cpm_uart_cpm.c: could not allocate coherent memory\n");
+ pr_err("cpm_uart_cpm.c: could not allocate coherent memory\n");
return -ENOMEM;
}
--
1.9.1
^ permalink raw reply related
* [PATCH 21/41] drivers: tty: serial: cpm_uart: fix includes
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fixing checkpatch warning:
WARNING: Use #include <linux/io.h> instead of <asm/io.h>
#25: FILE: drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c:25:
+#include <asm/io.h>
WARNING: Use #include <linux/io.h> instead of <asm/io.h>
+#include <asm/io.h>
WARNING: Use #include <linux/delay.h> instead of <asm/delay.h>
+#include <asm/delay.h>
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 4 ++--
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index 374b8bb..c831d31 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -33,10 +33,10 @@
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/delay.h>
-#include <asm/io.h>
#include <asm/irq.h>
-#include <asm/delay.h>
#include <asm/fs_pd.h>
#include <asm/udbg.h>
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
index ef1ae08..40cfcf4 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
@@ -21,8 +21,8 @@
#include <linux/device.h>
#include <linux/memblock.h>
#include <linux/dma-mapping.h>
+#include <linux/io.h>
-#include <asm/io.h>
#include <asm/irq.h>
#include <asm/fs_pd.h>
#include <asm/prom.h>
--
1.9.1
^ permalink raw reply related
* [PATCH 20/41] drivers: tty: serial: cpm_uart: use dev_err()/dev_warn() instead of printk()
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Using dev_err()/dev_warn() instead of printk() for more consistent output.
(prints device name, etc).
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 6 +++---
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index b929c7a..374b8bb 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -265,7 +265,7 @@ static void cpm_uart_int_rx(struct uart_port *port)
* later, which will be the next rx-interrupt or a timeout
*/
if (tty_buffer_request_room(tport, i) < i) {
- printk(KERN_WARNING "No room in flip buffer\n");
+ dev_warn(port->dev, "No room in flip buffer\n");
return;
}
@@ -1155,7 +1155,7 @@ static int cpm_uart_init_port(struct device_node *np,
if (!pinfo->clk) {
data = of_get_property(np, "fsl,cpm-brg", &len);
if (!data || len != 4) {
- printk(KERN_ERR "CPM UART %pOFn has no/invalid "
+ dev_err(port->dev, "CPM UART %pOFn has no/invalid "
"fsl,cpm-brg property.\n", np);
return -EINVAL;
}
@@ -1164,7 +1164,7 @@ static int cpm_uart_init_port(struct device_node *np,
data = of_get_property(np, "fsl,cpm-command", &len);
if (!data || len != 4) {
- printk(KERN_ERR "CPM UART %pOFn has no/invalid "
+ dev_err(port->dev, "CPM UART %pOFn has no/invalid "
"fsl,cpm-command property.\n", np);
return -EINVAL;
}
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
index 6a1cd03..ef1ae08 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
@@ -67,7 +67,7 @@ void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
return pram;
if (len != 2) {
- printk(KERN_WARNING "cpm_uart[%d]: device tree references "
+ dev_warn(port->dev, "cpm_uart[%d]: device tree references "
"SMC pram, using boot loader/wrapper pram mapping. "
"Please fix your device tree to reference the pram "
"base register instead.\n",
--
1.9.1
^ permalink raw reply related
* [PATCH 19/41] drivers: tty: serial: apbuart: fix code formatting
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix checkpatch warnings:
WARNING: line over 80 characters
#9: FILE: drivers/tty/serial/apbuart.c:9:
+ * Copyright (C) 2006 Daniel Hellstrom <daniel@gaisler.com>, Aeroflex Gaisler AB
WARNING: line over 80 characters
#11: FILE: drivers/tty/serial/apbuart.c:11:
+ * Copyright (C) 2009 Kristoffer Glembo <kristoffer@gaisler.com>, Aeroflex Gaisler AB
WARNING: line over 80 characters
#16: FILE: drivers/tty/serial/apbuart.c:16:
+#if defined(CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
WARNING: labels should not be indented
#122: FILE: drivers/tty/serial/apbuart.c:122:
+ ignore_char:
WARNING: Missing a blank line after declarations
#186: FILE: drivers/tty/serial/apbuart.c:186:
+ unsigned int status = UART_GET_STATUS(port);
+ return status & UART_STATUS_THE ? TIOCSER_TEMT : 0;
WARNING: Missing a blank line after declarations
#322: FILE: drivers/tty/serial/apbuart.c:322:
+ int ret = 0;
+ if (ser->type != PORT_UNKNOWN && ser->type != PORT_APBUART)
WARNING: Missing a blank line after declarations
#427: FILE: drivers/tty/serial/apbuart.c:427:
+ unsigned int status;
+ do {
WARNING: Missing a blank line after declarations
#463: FILE: drivers/tty/serial/apbuart.c:463:
+ unsigned int quot, status;
+ status = UART_GET_STATUS(port);
WARNING: line over 80 characters
#627: FILE: drivers/tty/serial/apbuart.c:627:
+ port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map));
WARNING: line over 80 characters
#634: FILE: drivers/tty/serial/apbuart.c:634:
+ port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line);
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/apbuart.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 89e19b6..515a562 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -6,12 +6,15 @@
*
* Copyright (C) 2000 Deep Blue Solutions Ltd.
* Copyright (C) 2003 Konrad Eisele <eiselekd@web.de>
- * Copyright (C) 2006 Daniel Hellstrom <daniel@gaisler.com>, Aeroflex Gaisler AB
+ * Copyright (C) 2006 Daniel Hellstrom <daniel@gaisler.com>,
+ * Aeroflex Gaisler AB
* Copyright (C) 2008 Gilead Kutnick <kutnickg@zin-tech.com>
- * Copyright (C) 2009 Kristoffer Glembo <kristoffer@gaisler.com>, Aeroflex Gaisler AB
+ * Copyright (C) 2009 Kristoffer Glembo <kristoffer@gaisler.com>,
+ * Aeroflex Gaisler AB
*/
-#if defined(CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+#if defined(CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE) \
+ && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
@@ -116,8 +119,7 @@ static void apbuart_rx_chars(struct uart_port *port)
uart_insert_char(port, rsr, UART_STATUS_OE, ch, flag);
-
- ignore_char:
+ignore_char:
status = UART_GET_STATUS(port);
}
@@ -181,6 +183,7 @@ static irqreturn_t apbuart_int(int irq, void *dev_id)
static unsigned int apbuart_tx_empty(struct uart_port *port)
{
unsigned int status = UART_GET_STATUS(port);
+
return status & UART_STATUS_THE ? TIOCSER_TEMT : 0;
}
@@ -317,6 +320,7 @@ static int apbuart_verify_port(struct uart_port *port,
struct serial_struct *ser)
{
int ret = 0;
+
if (ser->type != PORT_UNKNOWN && ser->type != PORT_APBUART)
ret = -EINVAL;
if (ser->irq < 0 || ser->irq >= NR_IRQS)
@@ -422,6 +426,7 @@ static void apbuart_flush_fifo(struct uart_port *port)
static void apbuart_console_putchar(struct uart_port *port, int ch)
{
unsigned int status;
+
do {
status = UART_GET_STATUS(port);
} while (!UART_TX_READY(status));
@@ -458,6 +463,7 @@ static void apbuart_console_putchar(struct uart_port *port, int ch)
if (UART_GET_CTRL(port) & (UART_CTRL_RE | UART_CTRL_TE)) {
unsigned int quot, status;
+
status = UART_GET_STATUS(port);
*parity = 'n';
@@ -622,14 +628,16 @@ static int __init grlib_apbuart_configure(void)
port = &grlib_apbuart_ports[line];
port->mapbase = addr;
- port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map));
+ port->membase = ioremap(addr,
+ sizeof(struct grlib_apbuart_regs_map));
port->irq = 0;
port->iotype = UPIO_MEM;
port->ops = &grlib_apbuart_ops;
port->flags = UPF_BOOT_AUTOCONF;
port->line = line;
port->uartclk = *freq_hz;
- port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line);
+ port->fifosize = apbuart_scan_fifo_size(
+ (struct uart_port *) port, line);
line++;
/* We support maximum UART_NR uarts ... */
--
1.9.1
^ permalink raw reply related
* [PATCH 18/41] drivers: tty: serial: apbuart: use dev_info() instead of printk()
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Using dev_err() instead of printk() for more consistent output.
(prints device name, etc).
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/apbuart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index d2b86f7..89e19b6 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -568,7 +568,7 @@ static int apbuart_probe(struct platform_device *op)
apbuart_flush_fifo((struct uart_port *) port);
- printk(KERN_INFO "grlib-apbuart at 0x%llx, irq %d\n",
+ dev_info(&pdev->pdev, "grlib-apbuart at 0x%llx, irq %d\n",
(unsigned long long) port->mapbase, port->irq);
return 0;
}
--
1.9.1
^ permalink raw reply related
* [PATCH 17/41] drivers: tty: serial: apbuart: fix logging calls
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix checkpatch warnings:
WARNING: Prefer using '"%s...", __func__' to using 'apbuart_console_setup', this function's name, in a string
#491: FILE: drivers/tty/serial/apbuart.c:491:
+ pr_debug("apbuart_console_setup co=%p, co->index=%i, options=%s\n",
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
#661: FILE: drivers/tty/serial/apbuart.c:661:
+ printk(KERN_INFO "Serial: GRLIB APBUART driver\n");
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
#666: FILE: drivers/tty/serial/apbuart.c:666:
+ printk(KERN_ERR "%s: uart_register_driver failed (%i)\n",
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
#673: FILE: drivers/tty/serial/apbuart.c:673:
+ printk(KERN_ERR
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/apbuart.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 60cd133..d2b86f7 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -482,8 +482,8 @@ static int __init apbuart_console_setup(struct console *co, char *options)
int parity = 'n';
int flow = 'n';
- pr_debug("apbuart_console_setup co=%p, co->index=%i, options=%s\n",
- co, co->index, options);
+ pr_debug("%s() co=%p, co->index=%i, options=%s\n",
+ __func__, co, co->index, options);
/*
* Check whether an invalid uart number has been specified, and
@@ -650,21 +650,20 @@ static int __init grlib_apbuart_init(void)
if (ret)
return ret;
- printk(KERN_INFO "Serial: GRLIB APBUART driver\n");
+ pr_info("Serial: GRLIB APBUART driver\n");
ret = uart_register_driver(&grlib_apbuart_driver);
if (ret) {
- printk(KERN_ERR "%s: uart_register_driver failed (%i)\n",
- __FILE__, ret);
+ pr_err("%s: uart_register_driver failed (%i)\n",
+ __func__, ret);
return ret;
}
ret = platform_driver_register(&grlib_apbuart_of_driver);
if (ret) {
- printk(KERN_ERR
- "%s: platform_driver_register failed (%i)\n",
- __FILE__, ret);
+ pr_err("%s: platform_driver_register failed (%i)\n",
+ __func__, ret);
uart_unregister_driver(&grlib_apbuart_driver);
return ret;
}
--
1.9.1
^ permalink raw reply related
* [PATCH 16/41] drivers: tty: serial: uartlite: fix overlong lines
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: lorenzo.pieralisi, linux-ia64, linux-serial, andrew, gregkh,
sudeep.holla, liviu.dudau, linux-mips, vz, linux, sparclinux,
khilman, macro, slemieux.tyco, matthias.bgg, jacmet,
linux-amlogic, andriy.shevchenko, linuxppc-dev, davem
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix checkpatch warnings:
WARNING: line over 80 characters
#283: FILE: drivers/tty/serial/uartlite.c:283:
+ ret = request_irq(port->irq, ulite_isr, IRQF_SHARED | IRQF_TRIGGER_RISING,
WARNING: Missing a blank line after declarations
#577: FILE: drivers/tty/serial/uartlite.c:577:
+ struct earlycon_device *device = console->data;
+ uart_console_write(&device->port, s, n, early_uartlite_putc);
WARNING: line over 80 characters
#590: FILE: drivers/tty/serial/uartlite.c:590:
+OF_EARLYCON_DECLARE(uartlite_b, "xlnx,opb-uartlite-1.00.b", early_uartlite_setup);
WARNING: line over 80 characters
#591: FILE: drivers/tty/serial/uartlite.c:591:
+OF_EARLYCON_DECLARE(uartlite_a, "xlnx,xps-uartlite-1.00.a", early_uartlite_setup);
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/uartlite.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 6f79353..0140cec 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -280,7 +280,8 @@ static int ulite_startup(struct uart_port *port)
return ret;
}
- ret = request_irq(port->irq, ulite_isr, IRQF_SHARED | IRQF_TRIGGER_RISING,
+ ret = request_irq(port->irq, ulite_isr,
+ IRQF_SHARED | IRQF_TRIGGER_RISING,
"uartlite", port);
if (ret)
return ret;
@@ -574,6 +575,7 @@ static void early_uartlite_write(struct console *console,
const char *s, unsigned int n)
{
struct earlycon_device *device = console->data;
+
uart_console_write(&device->port, s, n, early_uartlite_putc);
}
@@ -587,8 +589,10 @@ static int __init early_uartlite_setup(struct earlycon_device *device,
return 0;
}
EARLYCON_DECLARE(uartlite, early_uartlite_setup);
-OF_EARLYCON_DECLARE(uartlite_b, "xlnx,opb-uartlite-1.00.b", early_uartlite_setup);
-OF_EARLYCON_DECLARE(uartlite_a, "xlnx,xps-uartlite-1.00.a", early_uartlite_setup);
+OF_EARLYCON_DECLARE(uartlite_b, "xlnx,opb-uartlite-1.00.b",
+ early_uartlite_setup);
+OF_EARLYCON_DECLARE(uartlite_a, "xlnx,xps-uartlite-1.00.a",
+ early_uartlite_setup);
#endif /* CONFIG_SERIAL_UARTLITE_CONSOLE */
--
1.9.1
^ permalink raw reply related
* [PATCH 15/41] drivers: tty: serial: uartlite: fix use fix bare 'unsigned'
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix checkpatch warnings:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#562: FILE: drivers/tty/serial/uartlite.c:562:
+ unsigned retries = 1000000;
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#574: FILE: drivers/tty/serial/uartlite.c:574:
+ const char *s, unsigned n)
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/uartlite.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 4c28600..6f79353 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -559,7 +559,7 @@ static void early_uartlite_putc(struct uart_port *port, int c)
* we'll never timeout on a working UART.
*/
- unsigned retries = 1000000;
+ unsigned int retries = 1000000;
/* read status bit - 0x8 offset */
while (--retries && (readl(port->membase + 8) & (1 << 3)))
;
@@ -571,7 +571,7 @@ static void early_uartlite_putc(struct uart_port *port, int c)
}
static void early_uartlite_write(struct console *console,
- const char *s, unsigned n)
+ const char *s, unsigned int n)
{
struct earlycon_device *device = console->data;
uart_console_write(&device->port, s, n, early_uartlite_putc);
--
1.9.1
^ permalink raw reply related
* [PATCH 14/41] drivers: tty: serial: uartlite: remove unnecessary braces
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
checkpatch complains:
WARNING: braces {} are not necessary for any arm of this statement
#489: FILE: drivers/tty/serial/uartlite.c:489:
+ if (oops_in_progress) {
[...]
+ } else
[...]
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/uartlite.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index c322ab6..4c28600 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -486,9 +486,9 @@ static void ulite_console_write(struct console *co, const char *s,
unsigned int ier;
int locked = 1;
- if (oops_in_progress) {
+ if (oops_in_progress)
locked = spin_trylock_irqsave(&port->lock, flags);
- } else
+ else
spin_lock_irqsave(&port->lock, flags);
/* save and disable interrupt */
--
1.9.1
^ permalink raw reply related
* [PATCH 13/41] drivers: tty: serial: uartlite: fill mapsize and use it
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fill the struct uart_port->mapsize field and use it, insteaf of
hardcoded values in many places. This makes the code layout a bit
more consistent and easily allows using generic helpers for the
io memory handling.
Candidates for such helpers could be eg. the request+ioremap and
iounmap+release combinations.
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/uartlite.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 44d65bd..c322ab6 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -342,7 +342,7 @@ static const char *ulite_type(struct uart_port *port)
static void ulite_release_port(struct uart_port *port)
{
- release_mem_region(port->mapbase, ULITE_REGION);
+ release_mem_region(port->mapbase, port->mapsize);
iounmap(port->membase);
port->membase = NULL;
}
@@ -356,15 +356,15 @@ static int ulite_request_port(struct uart_port *port)
"ulite console: port=%p; port->mapbase=%llx\n",
port, (unsigned long long) port->mapbase);
- if (!request_mem_region(port->mapbase, ULITE_REGION, "uartlite")) {
+ if (!request_mem_region(port->mapbase, port->mapsize, "uartlite")) {
dev_err(port->dev, "Memory region busy\n");
return -EBUSY;
}
- port->membase = ioremap(port->mapbase, ULITE_REGION);
+ port->membase = ioremap(port->mapbase, port->mapsize);
if (!port->membase) {
dev_err(port->dev, "Unable to map registers\n");
- release_mem_region(port->mapbase, ULITE_REGION);
+ release_mem_region(port->mapbase, port->mapsize);
return -EBUSY;
}
@@ -649,6 +649,7 @@ static int ulite_assign(struct device *dev, int id, u32 base, int irq,
port->iotype = UPIO_MEM;
port->iobase = 1; /* mark port in use */
port->mapbase = base;
+ port->mapsize = ULITE_REGION;
port->membase = NULL;
port->ops = &ulite_ops;
port->irq = irq;
--
1.9.1
^ permalink raw reply related
* [PATCH 12/41] drivers: tty: serial: uartlite: use dev_dbg() instead of pr_debug()
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Using dev_dbg() instead of pr_debg() for more consistent output.
(prints device name, etc).
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/uartlite.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index b8b912b..44d65bd 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -352,7 +352,8 @@ static int ulite_request_port(struct uart_port *port)
struct uartlite_data *pdata = port->private_data;
int ret;
- pr_debug("ulite console: port=%p; port->mapbase=%llx\n",
+ dev_dbg(port->dev,
+ "ulite console: port=%p; port->mapbase=%llx\n",
port, (unsigned long long) port->mapbase);
if (!request_mem_region(port->mapbase, ULITE_REGION, "uartlite")) {
@@ -519,7 +520,8 @@ static int ulite_console_setup(struct console *co, char *options)
/* Has the device been initialized yet? */
if (!port->mapbase) {
- pr_debug("console on ttyUL%i not present\n", co->index);
+ dev_dbg(port->dev, "console on ttyUL%i not present\n",
+ co->index);
return -ENODEV;
}
--
1.9.1
^ permalink raw reply related
* [PATCH 11/41] drivers: tty: serial: sb1250-duart: fix formatting error
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
checkpatch complains:
ERROR: space required before the open parenthesis '('
#659: FILE: drivers/tty/serial/sb1250-duart.c:659:
+ if(refcount_dec_and_test(&duart->map_guard))
Just add this missing space to make checkpatch happy.
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/sb1250-duart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index ec74f09..0023ed0 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -656,7 +656,7 @@ static void sbd_release_port(struct uart_port *uport)
iounmap(uport->membase);
uport->membase = NULL;
- if(refcount_dec_and_test(&duart->map_guard))
+ if (refcount_dec_and_test(&duart->map_guard))
release_mem_region(duart->mapctrl, DUART_CHANREG_SPACING);
release_mem_region(uport->mapbase, uport->mapsize);
}
--
1.9.1
^ permalink raw reply related
* [PATCH 10/41] drivers: tty: serial: sb1250-duart: fix missing parentheses
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix checkpatch warning:
ERROR: Macros with complex values should be enclosed in parentheses
#911: FILE: drivers/tty/serial/sb1250-duart.c:911:
+#define SERIAL_SB1250_DUART_CONSOLE &sbd_console
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/sb1250-duart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index 1184226..ec74f09 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -908,7 +908,7 @@ static int __init sbd_serial_console_init(void)
console_initcall(sbd_serial_console_init);
-#define SERIAL_SB1250_DUART_CONSOLE &sbd_console
+#define SERIAL_SB1250_DUART_CONSOLE (&sbd_console)
#else
#define SERIAL_SB1250_DUART_CONSOLE NULL
#endif /* CONFIG_SERIAL_SB1250_DUART_CONSOLE */
--
1.9.1
^ permalink raw reply related
* [PATCH 09/41] drivers: tty: serial: sb1250-duart: fill mapsize and use it
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fill the struct uart_port->mapsize field and use it, insteaf of
hardcoded values in many places. This makes the code layout a bit
more consistent and easily allows using generic helpers for the
io memory handling.
Candidates for such helpers could be eg. the request+ioremap and
iounmap+release combinations.
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/sb1250-duart.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index 227af87..1184226 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -658,7 +658,7 @@ static void sbd_release_port(struct uart_port *uport)
if(refcount_dec_and_test(&duart->map_guard))
release_mem_region(duart->mapctrl, DUART_CHANREG_SPACING);
- release_mem_region(uport->mapbase, DUART_CHANREG_SPACING);
+ release_mem_region(uport->mapbase, uport->mapsize);
}
static int sbd_map_port(struct uart_port *uport)
@@ -668,7 +668,7 @@ static int sbd_map_port(struct uart_port *uport)
if (!uport->membase)
uport->membase = ioremap_nocache(uport->mapbase,
- DUART_CHANREG_SPACING);
+ uport->mapsize);
if (!uport->membase) {
dev_err(uport->dev, "Cannot map MMIO (base)\n");
return -ENOMEM;
@@ -693,7 +693,7 @@ static int sbd_request_port(struct uart_port *uport)
struct sbd_duart *duart = to_sport(uport)->duart;
int ret = 0;
- if (!request_mem_region(uport->mapbase, DUART_CHANREG_SPACING,
+ if (!request_mem_region(uport->mapbase, uport->mapsize,
"sb1250-duart")) {
pr_err(err);
return -EBUSY;
@@ -716,7 +716,7 @@ static int sbd_request_port(struct uart_port *uport)
}
}
if (ret) {
- release_mem_region(uport->mapbase, DUART_CHANREG_SPACING);
+ release_mem_region(uport->mapbase, uport->mapsize);
return ret;
}
return 0;
@@ -812,6 +812,7 @@ static void __init sbd_probe_duarts(void)
uport->ops = &sbd_ops;
uport->line = line;
uport->mapbase = SBD_CHANREGS(line);
+ uport->mapsize = DUART_CHANREG_SPACING;
}
}
}
--
1.9.1
^ permalink raw reply related
* [PATCH 08/41] drivers: tty: serial: sb1250-duart: fix checkpatch warning on printk()
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
checkpatch complaints:
WARNING: printk() should include KERN_<LEVEL> facility level
#698: FILE: drivers/tty/serial/sb1250-duart.c:698:
+ printk(err);
WARNING: printk() should include KERN_<LEVEL> facility level
#706: FILE: drivers/tty/serial/sb1250-duart.c:706:
+ printk(err);
Even though it's a false alarm here (the string is already prefixed
w/ KERN_ERR), it's nicer to use pr_err() here, which also makes
checkpatch happy.
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/sb1250-duart.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index b4342c8..227af87 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -689,13 +689,13 @@ static int sbd_map_port(struct uart_port *uport)
static int sbd_request_port(struct uart_port *uport)
{
- const char *err = KERN_ERR "sbd: Unable to reserve MMIO resource\n";
+ const char *err = "sbd: Unable to reserve MMIO resource\n";
struct sbd_duart *duart = to_sport(uport)->duart;
int ret = 0;
if (!request_mem_region(uport->mapbase, DUART_CHANREG_SPACING,
"sb1250-duart")) {
- printk(err);
+ pr_err(err);
return -EBUSY;
}
refcount_inc(&duart->map_guard);
@@ -703,7 +703,7 @@ static int sbd_request_port(struct uart_port *uport)
if (!request_mem_region(duart->mapctrl, DUART_CHANREG_SPACING,
"sb1250-duart")) {
refcount_dec(&duart->map_guard);
- printk(err);
+ pr_err(err);
ret = -EBUSY;
}
}
--
1.9.1
^ permalink raw reply related
* [PATCH 07/41] drivers: tty: serial: sb1250-duart: include <linux/io.h> instead of <asm/io.h>
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix checkpatch warning:
WARNING: Use #include <linux/io.h> instead of <asm/io.h>
#41: FILE: drivers/tty/serial/sb1250-duart.c:41:
+#include <asm/io.h>
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/sb1250-duart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index 655961c..b4342c8 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -38,7 +38,7 @@
#include <linux/types.h>
#include <linux/refcount.h>
-#include <asm/io.h>
+#include <linux/io.h>
#include <asm/war.h>
#include <asm/sibyte/sb1250.h>
--
1.9.1
^ permalink raw reply related
* [PATCH 06/41] drivers: tty: serial: sb1250-duart: use dev_err() instead of printk()
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Using dev_err() instead of printk() for more consistent output.
(prints device name, etc).
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/sb1250-duart.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index 329aced..655961c 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -663,7 +663,6 @@ static void sbd_release_port(struct uart_port *uport)
static int sbd_map_port(struct uart_port *uport)
{
- const char *err = KERN_ERR "sbd: Cannot map MMIO\n";
struct sbd_port *sport = to_sport(uport);
struct sbd_duart *duart = sport->duart;
@@ -671,7 +670,7 @@ static int sbd_map_port(struct uart_port *uport)
uport->membase = ioremap_nocache(uport->mapbase,
DUART_CHANREG_SPACING);
if (!uport->membase) {
- printk(err);
+ dev_err(uport->dev, "Cannot map MMIO (base)\n");
return -ENOMEM;
}
@@ -679,7 +678,7 @@ static int sbd_map_port(struct uart_port *uport)
sport->memctrl = ioremap_nocache(duart->mapctrl,
DUART_CHANREG_SPACING);
if (!sport->memctrl) {
- printk(err);
+ dev_err(uport->dev, "Cannot map MMIO (ctrl)\n");
iounmap(uport->membase);
uport->membase = NULL;
return -ENOMEM;
--
1.9.1
^ permalink raw reply related
* [PATCH 05/41] drivers: tty: serial: dz: use pr_info() instead of incomplete printk()
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix the checkpatch warning:
WARNING: printk() should include KERN_<LEVEL> facility level
#934: FILE: dz.c:934:
+ printk("%s%s\n", dz_name, dz_version);
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/dz.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index 559d076..e2670c4 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -931,7 +931,7 @@ static int __init dz_init(void)
if (IOASIC)
return -ENXIO;
- printk("%s%s\n", dz_name, dz_version);
+ pr_info("%s%s\n", dz_name, dz_version);
dz_init_ports();
--
1.9.1
^ permalink raw reply related
* [PATCH 04/41] drivers: tty: serial: dz: fix use fix bare 'unsigned'
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix checkpatch warnings:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#103: FILE: dz.c:103:
+static u16 dz_in(struct dz_port *dport, unsigned offset)
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#110: FILE: dz.c:110:
+static void dz_out(struct dz_port *dport, unsigned offset, u16 value)
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/dz.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index b3e9313..559d076 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -100,14 +100,14 @@ static inline struct dz_port *to_dport(struct uart_port *uport)
* ------------------------------------------------------------
*/
-static u16 dz_in(struct dz_port *dport, unsigned offset)
+static u16 dz_in(struct dz_port *dport, unsigned int offset)
{
void __iomem *addr = dport->port.membase + offset;
return readw(addr);
}
-static void dz_out(struct dz_port *dport, unsigned offset, u16 value)
+static void dz_out(struct dz_port *dport, unsigned int offset, u16 value)
{
void __iomem *addr = dport->port.membase + offset;
--
1.9.1
^ permalink raw reply related
* [PATCH 03/41] drivers: tty: serial: dz: fix missing parentheses
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Fix checkpatch warning:
ERROR: Macros with complex values should be enclosed in parentheses
#912: FILE: dz.c:912:
+#define SERIAL_DZ_CONSOLE &dz_console
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/dz.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index fd4f0cc..b3e9313 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -909,7 +909,7 @@ static int __init dz_serial_console_init(void)
console_initcall(dz_serial_console_init);
-#define SERIAL_DZ_CONSOLE &dz_console
+#define SERIAL_DZ_CONSOLE (&dz_console)
#else
#define SERIAL_DZ_CONSOLE NULL
#endif /* CONFIG_SERIAL_DZ_CONSOLE */
--
1.9.1
^ permalink raw reply related
* [PATCH 02/41] drivers: tty: serial: dz: include <linux/io.h> instead of <asm/io.h>
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
fixing checkpatch warning:
WARNING: Use #include <linux/io.h> instead of <asm/io.h>
#55: FILE: dz.c:55:
+#include <asm/io.h>
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/dz.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index 96e35af..fd4f0cc 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -52,7 +52,7 @@
#include <linux/atomic.h>
#include <asm/bootinfo.h>
-#include <asm/io.h>
+#include <linux/io.h>
#include <asm/dec/interrupts.h>
#include <asm/dec/kn01.h>
--
1.9.1
^ permalink raw reply related
* [PATCH 01/41] drivers: tty: serial: dz: use dev_err() instead of printk()
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
In-Reply-To: <1556369542-13247-1-git-send-email-info@metux.net>
Using dev_err() instead of printk() for more consistent output.
(prints device name, etc).
Signed-off-by: Enrico Weigelt <info@metux.net>
---
drivers/tty/serial/dz.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index 7b57e84..96e35af 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -416,7 +416,7 @@ static int dz_startup(struct uart_port *uport)
IRQF_SHARED, "dz", mux);
if (ret) {
atomic_add(-1, &mux->irq_guard);
- printk(KERN_ERR "dz: Cannot get IRQ %d!\n", dport->port.irq);
+ dev_err(uport->dev, "Cannot get IRQ %d!\n", dport->port.irq);
return ret;
}
@@ -680,7 +680,7 @@ static int dz_map_port(struct uart_port *uport)
uport->membase = ioremap_nocache(uport->mapbase,
dec_kn_slot_size);
if (!uport->membase) {
- printk(KERN_ERR "dz: Cannot map MMIO\n");
+ dev_err(uport->dev, "Cannot map MMIO\n");
return -ENOMEM;
}
return 0;
@@ -697,8 +697,8 @@ static int dz_request_port(struct uart_port *uport)
if (!request_mem_region(uport->mapbase, dec_kn_slot_size,
"dz")) {
atomic_add(-1, &mux->map_guard);
- printk(KERN_ERR
- "dz: Unable to reserve MMIO resource\n");
+ dev_err(uport->dev,
+ "Unable to reserve MMIO resource\n");
return -EBUSY;
}
}
--
1.9.1
^ permalink raw reply related
* serial drivers polishing
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:51 UTC (permalink / raw)
To: linux-kernel
Cc: gregkh, andrew, andriy.shevchenko, macro, vz, slemieux.tyco,
khilman, liviu.dudau, sudeep.holla, lorenzo.pieralisi, davem,
jacmet, linux, matthias.bgg, linux-mips, linux-serial, linux-ia64,
linux-amlogic, linuxppc-dev, sparclinux
Hello folks,
here's another attempt of polishing the serial drivers:
* lots of minor cleanups to make checkpatch happier
(eg. formatting, includes, inttypes, ...)
* use appropriate logging helpers instead of printk()
* consequent use of mapsize/mapbase fields:
the basic idea is, all drivers should fill mapbase/mapbase fields at
init time and later only use those fields, instead of hardcoded values
(later on, we can add generic helpers for the map/unmap stuff, etc)
* untwisting serial8250_port_size() at all:
move the iomem size probing to initialization time, move out some
platform specific magic to corresponding platform code, etc.
Unfortunately, I don't have the actual hardware to really test all
the code, so please let me know if there's something broken in here.
have fun,
--mtx
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox