LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [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: 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
    #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 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: 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>

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 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: 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>

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 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: 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 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

* serial drivers polishing
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

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

* [PATCH 26/41] drivers: tty: serial: sunzilog: use dev_info() instead of printk()
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 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>

Using dev_info() instead of printk() for more consistent output.
(prints device name, etc).

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 drivers/tty/serial/sunzilog.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index bc7af8b..6285bba 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -1489,14 +1489,12 @@ static int zs_probe(struct platform_device *op)
 		}
 		uart_inst++;
 	} else {
-		printk(KERN_INFO "%s: Keyboard at MMIO 0x%llx (irq = %d) "
+		dev_info(&op->dev, "Keyboard at MMIO 0x%llx (irq = %d) "
 		       "is a %s\n",
-		       dev_name(&op->dev),
 		       (unsigned long long) up[0].port.mapbase,
 		       op->archdata.irqs[0], sunzilog_type(&up[0].port));
-		printk(KERN_INFO "%s: Mouse at MMIO 0x%llx (irq = %d) "
+		dev_info(&op->dev, "Mouse at MMIO 0x%llx (irq = %d) "
 		       "is a %s\n",
-		       dev_name(&op->dev),
 		       (unsigned long long) up[1].port.mapbase,
 		       op->archdata.irqs[0], sunzilog_type(&up[1].port));
 		kbm_inst++;
-- 
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: 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 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 29/41] drivers: tty: serial: sunzilog: cleanup logging
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 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 warning:

    WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
    #1238: FILE: drivers/tty/serial/sunzilog.c:1238:
    +	printk(KERN_INFO "Console: ttyS%d (SunZilog zs%d)\n",

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 drivers/tty/serial/sunzilog.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index 85edb0d..dba723c 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -1235,7 +1235,7 @@ static int __init sunzilog_console_setup(struct console *con, char *options)
 	if (up->port.type != PORT_SUNZILOG)
 		return -1;
 
-	printk(KERN_INFO "Console: ttyS%d (SunZilog zs%d)\n",
+	pr_info("Console: ttyS%d (SunZilog zs%d)\n",
 	       (sunzilog_reg.minor - 64) + con->index, con->index);
 
 	/* Get firmware console settings.  */
@@ -1615,9 +1615,8 @@ static int __init sunzilog_init(void)
 		while (up) {
 			struct zilog_channel __iomem *channel;
 
-			/* printk(KERN_INFO
-			 *        "Enable IRQ for ZILOG Hardware %p\n",
-			 *        up);
+			/* pr_info("Enable IRQ for ZILOG Hardware %p\n",
+			 *         up);
 			 */
 			channel          = ZILOG_CHANNEL_FROM_PORT(&up->port);
 			up->flags       |= SUNZILOG_FLAG_ISR_HANDLER;
@@ -1655,9 +1654,8 @@ static void __exit sunzilog_exit(void)
 		while (up) {
 			struct zilog_channel __iomem *channel;
 
-			/* printk(KERN_INFO
-			 *        "Disable IRQ for ZILOG Hardware %p\n",
-			 *        up);
+			/* pr_info("Disable IRQ for ZILOG Hardware %p\n",
+			 *         up);
 			 */
 			channel          = ZILOG_CHANNEL_FROM_PORT(&up->port);
 			up->flags       &= ~SUNZILOG_FLAG_ISR_HANDLER;
-- 
1.9.1


^ permalink raw reply related

* [PATCH 32/41] drivers: tty: serial: 21285: define's for address/size, use mapsize field
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 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>

Instead of hardcoding raw numbers, add define's for the mmio address/size.
Also fill the mapsize field and use it on mem request/release calls, for
more consistency and allowing generic helpers to be used later.

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 drivers/tty/serial/21285.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/21285.c b/drivers/tty/serial/21285.c
index 32b3acf..90684cd 100644
--- a/drivers/tty/serial/21285.c
+++ b/drivers/tty/serial/21285.c
@@ -27,6 +27,9 @@
 #define SERIAL_21285_MAJOR	204
 #define SERIAL_21285_MINOR	4
 
+#define SERIAL_21285_ADDRESS	0x42000160
+#define SERIAL_21285_SIZE	32
+
 #define RXSTAT_DUMMY_READ	0x80000000
 #define RXSTAT_FRAME		(1 << 0)
 #define RXSTAT_PARITY		(1 << 1)
@@ -305,12 +308,14 @@ static const char *serial21285_type(struct uart_port *port)
 
 static void serial21285_release_port(struct uart_port *port)
 {
-	release_mem_region(port->mapbase, 32);
+	release_mem_region(port->mapbase, port->mapsize);
 }
 
 static int serial21285_request_port(struct uart_port *port)
 {
-	return request_mem_region(port->mapbase, 32, serial21285_name)
+	return request_mem_region(port->mapbase,
+				  port->mapsize,
+				  serial21285_name)
 			 != NULL ? 0 : -EBUSY;
 }
 
@@ -354,7 +359,8 @@ static int serial21285_verify_port(struct uart_port *port, struct serial_struct
 };
 
 static struct uart_port serial21285_port = {
-	.mapbase	= 0x42000160,
+	.mapbase	= SERIAL_21285_BASE,
+	.mapsize	= SERIAL_21285_SIZE,
 	.iotype		= UPIO_MEM,
 	.irq		= 0,
 	.fifosize	= 16,
-- 
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: 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 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 31/41] drivers: tty: serial: ioc4_serial: use pr_*() instead of printk()
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 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>

This fixes a bunch of checkpatch warnings:

    WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
    #930: FILE: drivers/tty/serial/ioc4_serial.c:930:
    +		printk(KERN_ERR

    WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
    #945: FILE: drivers/tty/serial/ioc4_serial.c:945:
    +			printk(KERN_ERR

    WARNING: printk() should include KERN_<LEVEL> facility level
    #1028: FILE: drivers/tty/serial/ioc4_serial.c:1028:
    +		printk ("%s : %d : mem 0x%p sio_ir 0x%x sio_ies 0x%x "

    WARNING: space prohibited between function name and open parenthesis '('
    #1028: FILE: drivers/tty/serial/ioc4_serial.c:1028:
    +		printk ("%s : %d : mem 0x%p sio_ir 0x%x sio_ies 0x%x "

    WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
    #1064: FILE: drivers/tty/serial/ioc4_serial.c:1064:
    +	printk(KERN_INFO "IOC4 firmware revision %d\n", ioc4_revid);

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #1066: FILE: drivers/tty/serial/ioc4_serial.c:1066:
    +		printk(KERN_WARNING

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #1080: FILE: drivers/tty/serial/ioc4_serial.c:1080:
    +			printk(KERN_WARNING

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #1870: FILE: drivers/tty/serial/ioc4_serial.c:1870:
    +			printk(KERN_WARNING "IOC4 serial: "

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #2170: FILE: drivers/tty/serial/ioc4_serial.c:2170:
+			printk(KERN_WARNING "IOC4 serial: "

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #2796: FILE: drivers/tty/serial/ioc4_serial.c:2796:
    +		printk(KERN_WARNING

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #2804: FILE: drivers/tty/serial/ioc4_serial.c:2804:
    +		printk(KERN_WARNING

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #2818: FILE: drivers/tty/serial/ioc4_serial.c:2818:
    +		printk(KERN_WARNING "ioc4_attach_one"

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #2828: FILE: drivers/tty/serial/ioc4_serial.c:2828:
    +		printk(KERN_WARNING

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #2861: FILE: drivers/tty/serial/ioc4_serial.c:2861:
    +		printk(KERN_WARNING

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #2917: FILE: drivers/tty/serial/ioc4_serial.c:2917:
    +		printk(KERN_WARNING

    WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
    #2923: FILE: drivers/tty/serial/ioc4_serial.c:2923:
    +		printk(KERN_WARNING

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 drivers/tty/serial/ioc4_serial.c | 39 +++++++++++++++------------------------
 1 file changed, 15 insertions(+), 24 deletions(-)

diff --git a/drivers/tty/serial/ioc4_serial.c b/drivers/tty/serial/ioc4_serial.c
index 21c1b8f..4ab67f1 100644
--- a/drivers/tty/serial/ioc4_serial.c
+++ b/drivers/tty/serial/ioc4_serial.c
@@ -927,8 +927,7 @@ static void handle_dma_error_intr(void *arg, uint32_t other_ir)
 	writel(hooks->intr_dma_error, &port->ip_mem->other_ir.raw);
 
 	if (readl(&port->ip_mem->pci_err_addr_l.raw) & IOC4_PCI_ERR_ADDR_VLD) {
-		printk(KERN_ERR
-			"PCI error address is 0x%llx, "
+		pr_err("PCI error address is 0x%llx, "
 				"master is serial port %c %s\n",
 		     (((uint64_t)readl(&port->ip_mem->pci_err_addr_h)
 							 << 32)
@@ -942,8 +941,7 @@ static void handle_dma_error_intr(void *arg, uint32_t other_ir)
 
 		if (readl(&port->ip_mem->pci_err_addr_l.raw)
 						& IOC4_PCI_ERR_ADDR_MUL_ERR) {
-			printk(KERN_ERR
-				"Multiple errors occurred\n");
+			pr_err("Multiple errors occurred\n");
 		}
 	}
 	spin_unlock_irqrestore(&port->ip_lock, flags);
@@ -1025,7 +1023,7 @@ static irqreturn_t ioc4_intr(int irq, void *arg)
 		unsigned long flag;
 
 		spin_lock_irqsave(&soft->is_ir_lock, flag);
-		printk ("%s : %d : mem 0x%p sio_ir 0x%x sio_ies 0x%x "
+		pr_debug("%s : %d : mem 0x%p sio_ir 0x%x sio_ies 0x%x "
 				"other_ir 0x%x other_ies 0x%x mask 0x%x\n",
 		     __func__, __LINE__,
 		     (void *)mem, readl(&mem->sio_ir.raw),
@@ -1061,9 +1059,9 @@ static inline int ioc4_attach_local(struct ioc4_driver_data *idd)
 	/* IOC4 firmware must be at least rev 62 */
 	pci_read_config_word(pdev, PCI_COMMAND_SPECIAL, &ioc4_revid);
 
-	printk(KERN_INFO "IOC4 firmware revision %d\n", ioc4_revid);
+	pr_info("IOC4 firmware revision %d\n", ioc4_revid);
 	if (ioc4_revid < ioc4_revid_min) {
-		printk(KERN_WARNING
+		pr_warn(
 		    "IOC4 serial not supported on firmware rev %d, "
 				"please upgrade to rev %d or higher\n",
 				ioc4_revid, ioc4_revid_min);
@@ -1077,8 +1075,7 @@ static inline int ioc4_attach_local(struct ioc4_driver_data *idd)
 							port_number++) {
 		port = kzalloc(sizeof(struct ioc4_port), GFP_KERNEL);
 		if (!port) {
-			printk(KERN_WARNING
-				"IOC4 serial memory not available for port\n");
+			pr_warn("IOC4 serial memory not available for port\n");
 			goto free;
 		}
 		spin_lock_init(&port->ip_lock);
@@ -1867,7 +1864,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
 		uint32_t shadow;
 
 		if ( loop_counter-- <= 0 ) {
-			printk(KERN_WARNING "IOC4 serial: "
+			pr_warn("IOC4 serial: "
 					"possible hang condition/"
 					"port stuck on interrupt.\n");
 			break;
@@ -2167,7 +2164,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
 		entry = (struct ring_entry *)((caddr_t)inring + cons_ptr);
 
 		if ( loop_counter-- <= 0 ) {
-			printk(KERN_WARNING "IOC4 serial: "
+			pr_warn("IOC4 serial: "
 					"possible hang condition/"
 					"port stuck on read.\n");
 			break;
@@ -2793,16 +2790,14 @@ static int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
 
 	if (!request_mem_region(tmp_addr1, sizeof(struct ioc4_serial),
 					"sioc4_uart")) {
-		printk(KERN_WARNING
-			"ioc4 (%p): unable to get request region for "
+		pr_warn("ioc4 (%p): unable to get request region for "
 				"uart space\n", (void *)idd->idd_pdev);
 		ret = -ENODEV;
 		goto out1;
 	}
 	serial = ioremap(tmp_addr1, sizeof(struct ioc4_serial));
 	if (!serial) {
-		printk(KERN_WARNING
-			 "ioc4 (%p) : unable to remap ioc4 serial register\n",
+		pr_warn("ioc4 (%p) : unable to remap ioc4 serial register\n",
 				(void *)idd->idd_pdev);
 		ret = -ENODEV;
 		goto out2;
@@ -2815,7 +2810,7 @@ static int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
 	control = kzalloc(sizeof(struct ioc4_control), GFP_KERNEL);
 
 	if (!control) {
-		printk(KERN_WARNING "ioc4_attach_one"
+		pr_warn("ioc4_attach_one"
 		       ": unable to get memory for the IOC4\n");
 		ret = -ENOMEM;
 		goto out2;
@@ -2825,8 +2820,7 @@ static int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
 	/* Allocate the soft structure */
 	soft = kzalloc(sizeof(struct ioc4_soft), GFP_KERNEL);
 	if (!soft) {
-		printk(KERN_WARNING
-		       "ioc4 (%p): unable to get memory for the soft struct\n",
+		pr_warn("ioc4 (%p): unable to get memory for the soft struct\n",
 		       (void *)idd->idd_pdev);
 		ret = -ENOMEM;
 		goto out3;
@@ -2858,8 +2852,7 @@ static int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
 				"sgi-ioc4serial", soft)) {
 		control->ic_irq = idd->idd_pdev->irq;
 	} else {
-		printk(KERN_WARNING
-		    "%s : request_irq fails for IRQ 0x%x\n ",
+		pr_warn("%s : request_irq fails for IRQ 0x%x\n ",
 			__func__, idd->idd_pdev->irq);
 	}
 	ret = ioc4_attach_local(idd);
@@ -2914,14 +2907,12 @@ static int __init ioc4_serial_init(void)
 
 	/* register with serial core */
 	if ((ret = uart_register_driver(&ioc4_uart_rs232)) < 0) {
-		printk(KERN_WARNING
-			"%s: Couldn't register rs232 IOC4 serial driver\n",
+		pr_warn("%s: Couldn't register rs232 IOC4 serial driver\n",
 			__func__);
 		goto out;
 	}
 	if ((ret = uart_register_driver(&ioc4_uart_rs422)) < 0) {
-		printk(KERN_WARNING
-			"%s: Couldn't register rs422 IOC4 serial driver\n",
+		pr_warn("%s: Couldn't register rs422 IOC4 serial driver\n",
 			__func__);
 		goto out_uart_rs232;
 	}
-- 
1.9.1


^ permalink raw reply related

* [PATCH 38/41] drivers: tty: serial: xilinx_uartps: fill mapsize and use it
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 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>

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/xilinx_uartps.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 74089f5..cf8ca66 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -953,15 +953,15 @@ static int cdns_uart_verify_port(struct uart_port *port,
  */
 static int cdns_uart_request_port(struct uart_port *port)
 {
-	if (!request_mem_region(port->mapbase, CDNS_UART_REGISTER_SPACE,
+	if (!request_mem_region(port->mapbase, port->mapsize,
 					 CDNS_UART_NAME)) {
 		return -ENOMEM;
 	}
 
-	port->membase = ioremap(port->mapbase, CDNS_UART_REGISTER_SPACE);
+	port->membase = ioremap(port->mapbase, port->mapsize);
 	if (!port->membase) {
 		dev_err(port->dev, "Unable to map registers\n");
-		release_mem_region(port->mapbase, CDNS_UART_REGISTER_SPACE);
+		release_mem_region(port->mapbase, port->mapsize);
 		return -ENOMEM;
 	}
 	return 0;
@@ -976,7 +976,7 @@ static int cdns_uart_request_port(struct uart_port *port)
  */
 static void cdns_uart_release_port(struct uart_port *port)
 {
-	release_mem_region(port->mapbase, CDNS_UART_REGISTER_SPACE);
+	release_mem_region(port->mapbase, port->mapsize);
 	iounmap(port->membase);
 	port->membase = NULL;
 }
@@ -1627,6 +1627,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
 	 * and triggers invocation of the config_port() entry point.
 	 */
 	port->mapbase = res->start;
+	port->mapsize = CDNS_UART_REGISTER_SPACE;
 	port->irq = irq;
 	port->dev = &pdev->dev;
 	port->uartclk = clk_get_rate(cdns_uart_data->uartclk);
-- 
1.9.1


^ permalink raw reply related

* [PATCH 39/41] drivers: tty: serial: pmac_zilog: fill mapsize and use it
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 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>

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/pmac_zilog.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index bcb5bf7..1fef014 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -88,6 +88,8 @@
 #define PMACZILOG_NAME		"ttyPZ"
 #endif
 
+#define PMZ_MAPSIZE		0x1000
+
 #define pmz_debug(fmt, arg...)	pr_debug("ttyPZ%d: " fmt, uap->port.line, ## arg)
 #define pmz_error(fmt, arg...)	pr_err("ttyPZ%d: " fmt, uap->port.line, ## arg)
 #define pmz_info(fmt, arg...)	pr_info("ttyPZ%d: " fmt, uap->port.line, ## arg)
@@ -1411,7 +1413,8 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
 	if (of_address_to_resource(np, 0, &r_ports))
 		return -ENODEV;
 	uap->port.mapbase = r_ports.start;
-	uap->port.membase = ioremap(uap->port.mapbase, 0x1000);
+	uap->port.mapsize = PMZ_MAPSIZE;
+	uap->port.membase = ioremap(uap->port.mapbase, uap->port.mapsize);
 
 	uap->control_reg = uap->port.membase;
 	uap->data_reg = uap->control_reg + 0x10;
@@ -1709,6 +1712,7 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
 		return -ENODEV;
 
 	uap->port.mapbase  = r_ports->start;
+	uap->port.mapsize  = PMZ_MAPSIZE;
 	uap->port.membase  = (unsigned char __iomem *) r_ports->start;
 	uap->port.iotype   = UPIO_MEM;
 	uap->port.irq      = irq;
-- 
1.9.1


^ permalink raw reply related

* [PATCH 37/41] drivers: tty: serial: 8250: simplify io resource size computation
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 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>

Simpily io resource size computation by setting mapsize field.

Some of the special cases handled by serial8250_port_size() can be
simplified by putting this data to corresponding platform data
or probe function.

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 arch/mips/alchemy/common/platform.c | 1 +
 drivers/tty/serial/8250/8250.h      | 1 +
 drivers/tty/serial/8250/8250_of.c   | 1 +
 drivers/tty/serial/8250/8250_port.c | 6 +-----
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index 1454d9f..226096d 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -51,6 +51,7 @@ static void alchemy_8250_pm(struct uart_port *port, unsigned int state,
 #define PORT(_base, _irq)					\
 	{							\
 		.mapbase	= _base,			\
+		.mapsize	= 0x1000,			\
 		.irq		= _irq,				\
 		.regshift	= 2,				\
 		.iotype		= UPIO_AU,			\
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 89e3f09..7984aad 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -105,6 +105,7 @@ struct serial8250_config {
 
 #define SERIAL8250_PORT(_base, _irq) SERIAL8250_PORT_FLAGS(_base, _irq, 0)
 
+#define SERIAL_RT2880_IOSIZE	0x100
 
 static inline int serial_in(struct uart_8250_port *up, int offset)
 {
diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index 0277479c..08157a1 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -185,6 +185,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
 
 	case PORT_RT2880:
 		port->iotype = UPIO_AU;
+		port->mapsize = SERIAL_RT2880_IOSIZE;
 		break;
 	}
 
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index d09af4c..51d6076 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2833,11 +2833,7 @@ unsigned int serial8250_port_size(struct uart_8250_port *pt)
 {
 	if (pt->port.mapsize)
 		return pt->port.mapsize;
-	if (pt->port.iotype == UPIO_AU) {
-		if (pt->port.type == PORT_RT2880)
-			return 0x100;
-		return 0x1000;
-	}
+
 	if (is_omap1_8250(pt))
 		return 0x16 << pt->port.regshift;
 
-- 
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: 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>

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 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: 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: 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 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: 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>

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 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: 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: 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 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: 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 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 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: 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>

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 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: 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 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 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: 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>

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 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: 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>

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 28/41] drivers: tty: serial: sunzilog: fix includes
From: Enrico Weigelt, metux IT consult @ 2019-04-27 12:52 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 warning:

    WARNING: Use #include <linux/io.h> instead of <asm/io.h>
    #38: FILE: drivers/tty/serial/sunzilog.c:38:
    +#include <asm/io.h>

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 drivers/tty/serial/sunzilog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index 17b0520..85edb0d 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -34,8 +34,8 @@
 #endif
 #include <linux/init.h>
 #include <linux/of_device.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/prom.h>
 #include <asm/setup.h>
-- 
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: 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 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


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox