Skip to contentSkip to conversation

drivers: char: simple cleanup

PATCH In review Michal Orzel 3 participants 7 messages Apr 4, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drivers: char: simple cleanup

Simple serial drivers cleanup. No functional change intended.

Michal Orzel (2):
drivers: char: Drop useless suspend/resume stubs in Arm drivers
char: lpuart: Drop useless variables from UART structure

 xen/drivers/char/cadence-uart.c    | 13 -------------
 xen/drivers/char/exynos4210-uart.c | 13 -------------
 xen/drivers/char/imx-lpuart.c      | 19 -------------------
 xen/drivers/char/meson-uart.c      | 13 -------------
 xen/drivers/char/mvebu-uart.c      | 13 -------------
 xen/drivers/char/omap-uart.c       | 13 -------------
 xen/drivers/char/pl011.c           | 13 -------------
 xen/drivers/char/scif-uart.c       | 13 -------------
 8 files changed, 110 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 drivers: char: Drop useless suspend/resume stubs in Arm drivers

On Arm we don't use console_{suspend,resume} and the corresponding stubs in serial drivers are being redundantly copied whenever a new driver is added. Drop them as well as useless .endboot = NULL assignment.

---
 xen/drivers/char/cadence-uart.c    | 13 -------------
 xen/drivers/char/exynos4210-uart.c | 13 -------------
 xen/drivers/char/imx-lpuart.c      | 13 -------------
 xen/drivers/char/meson-uart.c      | 13 -------------
 xen/drivers/char/mvebu-uart.c      | 13 -------------
 xen/drivers/char/omap-uart.c       | 13 -------------
 xen/drivers/char/pl011.c           | 13 -------------
 xen/drivers/char/scif-uart.c       | 13 -------------
 8 files changed, 104 deletions(-)
xen/drivers/char/cadence-uart.c +0 -13
index 3618fa88d868..b2f379833f02 100644
@@ -90,16 +90,6 @@ static void __init cuart_init_postirq(struct serial_port *port)
     cuart_write(uart, R_UART_IER, UART_SR_INTR_RTRIG);
 }
 
-static void cuart_suspend(struct serial_port *port)
-{
-    BUG();
-}
-
-static void cuart_resume(struct serial_port *port)
-{
-    BUG();
-}
-
 static int cuart_tx_ready(struct serial_port *port)
 {
     struct cuart *uart = port->uart;
@@ -143,9 +133,6 @@ static const struct vuart_info *cuart_vuart(struct serial_port *port)
 static struct uart_driver __read_mostly cuart_driver = {
     .init_preirq  = cuart_init_preirq,
     .init_postirq = cuart_init_postirq,
-    .endboot      = NULL,
-    .suspend      = cuart_suspend,
-    .resume       = cuart_resume,
     .tx_ready     = cuart_tx_ready,
     .putc         = cuart_putc,
     .getc         = cuart_getc,
xen/drivers/char/exynos4210-uart.c +0 -13
index b29fd75c5a1c..58901df554cb 100644
@@ -212,16 +212,6 @@ static void __init exynos4210_uart_init_postirq(struct serial_port *port)
     exynos4210_write(uart, UMCON, exynos4210_read(uart, UMCON) | UMCON_INT_EN);
 }
 
-static void exynos4210_uart_suspend(struct serial_port *port)
-{
-    BUG(); // XXX
-}
-
-static void exynos4210_uart_resume(struct serial_port *port)
-{
-    BUG(); // XXX
-}
-
 static int exynos4210_uart_tx_ready(struct serial_port *port)
 {
     struct exynos4210_uart *uart = port->uart;
@@ -286,9 +276,6 @@ static const struct vuart_info *exynos4210_vuart_info(struct serial_port *port)
 static struct uart_driver __read_mostly exynos4210_uart_driver = {
     .init_preirq  = exynos4210_uart_init_preirq,
     .init_postirq = exynos4210_uart_init_postirq,
-    .endboot      = NULL,
-    .suspend      = exynos4210_uart_suspend,
-    .resume       = exynos4210_uart_resume,
     .tx_ready     = exynos4210_uart_tx_ready,
     .putc         = exynos4210_uart_putc,
     .getc         = exynos4210_uart_getc,
xen/drivers/char/imx-lpuart.c +0 -13
index 522680a25cec..faf4693b66e1 100644
@@ -101,16 +101,6 @@ static void __init imx_lpuart_init_postirq(struct serial_port *port)
     imx_lpuart_write(uart, UARTCTRL, temp);
 }
 
-static void imx_lpuart_suspend(struct serial_port *port)
-{
-    BUG();
-}
-
-static void imx_lpuart_resume(struct serial_port *port)
-{
-    BUG();
-}
-
 static int imx_lpuart_tx_ready(struct serial_port *port)
 {
     struct imx_lpuart *uart = port->uart;
@@ -185,9 +175,6 @@ static void imx_lpuart_stop_tx(struct serial_port *port)
 static struct uart_driver __read_mostly imx_lpuart_driver = {
     .init_preirq = imx_lpuart_init_preirq,
     .init_postirq = imx_lpuart_init_postirq,
-    .endboot = NULL,
-    .suspend = imx_lpuart_suspend,
-    .resume = imx_lpuart_resume,
     .tx_ready = imx_lpuart_tx_ready,
     .putc = imx_lpuart_putc,
     .getc = imx_lpuart_getc,
xen/drivers/char/meson-uart.c +0 -13
index 694381986d07..407a276085b7 100644
@@ -116,16 +116,6 @@ static void __init meson_uart_init_postirq(struct serial_port *port)
             (AML_UART_RX_INT_EN | AML_UART_TX_INT_EN));
 }
 
-static void meson_uart_suspend(struct serial_port *port)
-{
-    BUG();
-}
-
-static void meson_uart_resume(struct serial_port *port)
-{
-    BUG();
-}
-
 static void meson_uart_putc(struct serial_port *port, char c)
 {
     struct meson_uart *uart = port->uart;
@@ -191,9 +181,6 @@ static int meson_uart_tx_ready(struct serial_port *port)
 static struct uart_driver __read_mostly meson_uart_driver = {
     .init_preirq  = meson_uart_init_preirq,
     .init_postirq = meson_uart_init_postirq,
-    .endboot      = NULL,
-    .suspend      = meson_uart_suspend,
-    .resume       = meson_uart_resume,
     .putc         = meson_uart_putc,
     .getc         = meson_uart_getc,
     .tx_ready     = meson_uart_tx_ready,
xen/drivers/char/mvebu-uart.c +0 -13
index 1913fe8b5f91..db2418576ca5 100644
@@ -125,16 +125,6 @@ static void __init mvebu3700_uart_init_postirq(struct serial_port *port)
     mvebu3700_write(uart, UART_CTRL_REG, reg);
 }
 
-static void mvebu3700_uart_suspend(struct serial_port *port)
-{
-    BUG();
-}
-
-static void mvebu3700_uart_resume(struct serial_port *port)
-{
-    BUG();
-}
-
 static void mvebu3700_uart_putc(struct serial_port *port, char c)
 {
     struct mvebu3700_uart *uart = port->uart;
@@ -213,9 +203,6 @@ static int mvebu3700_uart_tx_ready(struct serial_port *port)
 static struct uart_driver __read_mostly mvebu3700_uart_driver = {
     .init_preirq  = mvebu3700_uart_init_preirq,
     .init_postirq = mvebu3700_uart_init_postirq,
-    .endboot      = NULL,
-    .suspend      = mvebu3700_uart_suspend,
-    .resume       = mvebu3700_uart_resume,
     .putc         = mvebu3700_uart_putc,
     .getc         = mvebu3700_uart_getc,
     .tx_ready     = mvebu3700_uart_tx_ready,
xen/drivers/char/omap-uart.c +0 -13
index e4f5be22894b..f4368c158c06 100644
@@ -242,16 +242,6 @@ static void __init omap_uart_init_postirq(struct serial_port *port)
     omap_write(uart, UART_IER, UART_IER_ERDAI|UART_IER_ETHREI|UART_IER_ELSI);
 }
 
-static void omap_uart_suspend(struct serial_port *port)
-{
-    BUG();
-}
-
-static void omap_uart_resume(struct serial_port *port)
-{
-    BUG();
-}
-
 static int omap_uart_tx_ready(struct serial_port *port)
 {
     struct omap_uart *uart = port->uart;
@@ -307,9 +297,6 @@ static const struct vuart_info *omap_vuart_info(struct serial_port *port)
 static struct uart_driver __read_mostly omap_uart_driver = {
     .init_preirq = omap_uart_init_preirq,
     .init_postirq = omap_uart_init_postirq,
-    .endboot = NULL,
-    .suspend = omap_uart_suspend,
-    .resume = omap_uart_resume,
     .tx_ready = omap_uart_tx_ready,
     .putc = omap_uart_putc,
     .getc = omap_uart_getc,
xen/drivers/char/pl011.c +0 -13
index 7260a988ca65..5f9913367d51 100644
@@ -166,16 +166,6 @@ static void __init pl011_init_postirq(struct serial_port *port)
     pl011_write(uart, IMSC, RTI|OEI|BEI|PEI|FEI|TXI|RXI);
 }
 
-static void pl011_suspend(struct serial_port *port)
-{
-    BUG(); // XXX
-}
-
-static void pl011_resume(struct serial_port *port)
-{
-    BUG(); // XXX
-}
-
 static int pl011_tx_ready(struct serial_port *port)
 {
     struct pl011 *uart = port->uart;
@@ -232,9 +222,6 @@ static void pl011_tx_start(struct serial_port *port)
 static struct uart_driver __read_mostly pl011_driver = {
     .init_preirq  = pl011_init_preirq,
     .init_postirq = pl011_init_postirq,
-    .endboot      = NULL,
-    .suspend      = pl011_suspend,
-    .resume       = pl011_resume,
     .tx_ready     = pl011_tx_ready,
     .putc         = pl011_putc,
     .getc         = pl011_getc,
xen/drivers/char/scif-uart.c +0 -13
index b7f86f882c85..757793ca4588 100644
@@ -195,16 +195,6 @@ static void __init scif_uart_init_postirq(struct serial_port *port)
                 params->irq_flags);
 }
 
-static void scif_uart_suspend(struct serial_port *port)
-{
-    BUG();
-}
-
-static void scif_uart_resume(struct serial_port *port)
-{
-    BUG();
-}
-
 static int scif_uart_tx_ready(struct serial_port *port)
 {
     struct scif_uart *uart = port->uart;
@@ -284,9 +274,6 @@ static void scif_uart_stop_tx(struct serial_port *port)
 static struct uart_driver __read_mostly scif_uart_driver = {
     .init_preirq  = scif_uart_init_preirq,
     .init_postirq = scif_uart_init_postirq,
-    .endboot      = NULL,
-    .suspend      = scif_uart_suspend,
-    .resume       = scif_uart_resume,
     .tx_ready     = scif_uart_tx_ready,
     .putc         = scif_uart_putc,
     .getc         = scif_uart_getc,
Signature · 1 line
2.25.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] drivers: char: Drop useless suspend/resume stubs in Arm drivers

Quoted 5 lines · Michal Orzel

On Arm we don't use console_{suspend,resume} and the corresponding stubs in serial drivers are being redundantly copied whenever a new driver is added. Drop them as well as useless .endboot = NULL assignment.

Since hook invocations are suitably guarded:

However, from a Misra perspective more wants doing here if suspend/resume indeed isn't wanted / needed on Arm: console_{suspend,resume}() are unreachable there, and hence want hiding behind some (presumably) CONFIG_HAS_*. In turn the two hooks then would also want making conditional upon that option actually being selected by an architecture.

Jan

#3 lore raw

Re: [PATCH 1/2] drivers: char: Drop useless suspend/resume stubs in Arm drivers

Hi Jan,

Quoted 11 lines · Jan Beulich
Quoted 5 lines · Michal Orzel

On Arm we don't use console_{suspend,resume} and the corresponding stubs in serial drivers are being redundantly copied whenever a new driver is added. Drop them as well as useless .endboot = NULL assignment.

Since hook invocations are suitably guarded:

thanks

Quoted 6 lines

However, from a Misra perspective more wants doing here if suspend/resume indeed isn't wanted / needed on Arm: console_{suspend,resume}() are unreachable there, and hence want hiding behind some (presumably) CONFIG_HAS_*. In turn the two hooks then would also want making conditional upon that option actually being selected by an architecture.

Yes, this will be handled in the future as part of the bigger activity to compile out unused code.

~Michal

#4 lore raw

Re: [PATCH 1/2] drivers: char: Drop useless suspend/resume stubs in Arm drivers

In reply to Jan Beulich
Quoted 9 lines · Jan Beulich
Quoted 5 lines · Michal Orzel

On Arm we don't use console_{suspend,resume} and the corresponding stubs in serial drivers are being redundantly copied whenever a new driver is added. Drop them as well as useless .endboot = NULL assignment.

Since hook invocations are suitably guarded:

#5 lore raw

PATCH 2/2 char: lpuart: Drop useless variables from UART structure

In reply to Michal Orzel

These variables are useless. They are being assigned a value which is never used since UART is expected to be pre-configured.

No functional change.

---
 xen/drivers/char/imx-lpuart.c | 6 ------
 1 file changed, 6 deletions(-)
xen/drivers/char/imx-lpuart.c +0 -6
index faf4693b66e1..7770d158bf59 100644
@@ -30,7 +30,6 @@
 #define imx_lpuart_write(uart, off, val) writel((val), (uart)->regs + (off))
 
 static struct imx_lpuart {
-    uint32_t baud, clock_hz, data_bits, parity, stop_bits, fifo_size;
     uint32_t irq;
     char __iomem *regs;
     struct irqaction irqaction;
@@ -197,11 +196,6 @@ static int __init imx_lpuart_init(struct dt_device_node *dev,
 
     uart = &imx8_com;
 
-    uart->baud = 115200;
-    uart->data_bits = 8;
-    uart->parity = 0;
-    uart->stop_bits = 1;
-
     res = dt_device_get_paddr(dev, 0, &addr, &size);
     if ( res )
     {
Signature · 1 line
2.25.1