OSDN Git Service

serial: Convert SERIAL_XMIT_SIZE to UART_XMIT_SIZE
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 24 Jun 2022 20:54:23 +0000 (23:54 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jun 2022 12:41:31 +0000 (14:41 +0200)
Both UART_XMIT_SIZE and SERIAL_XMIT_SIZE are defined. Make them all
UART_XMIT_SIZE.

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220624205424.12686-6-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/amiserial.c
drivers/tty/mips_ejtag_fdc.c
drivers/tty/serial/meson_uart.c
drivers/tty/serial/owl-uart.c
drivers/tty/serial/rda-uart.c
include/linux/serial.h

index afb2d37..5458e2b 100644 (file)
@@ -51,6 +51,7 @@
 #include <linux/seq_file.h>
 #include <linux/serial.h>
 #include <linux/serial_reg.h>
+#include <linux/serial_core.h>
 #include <linux/sched.h>
 #include <linux/signal.h>
 #include <linux/slab.h>
@@ -283,12 +284,12 @@ static void transmit_chars(struct serial_state *info)
 
        amiga_custom.serdat = info->xmit.buf[info->xmit.tail++] | 0x100;
        mb();
-       info->xmit.tail = info->xmit.tail & (SERIAL_XMIT_SIZE-1);
+       info->xmit.tail = info->xmit.tail & (UART_XMIT_SIZE - 1);
        info->icount.tx++;
 
        if (CIRC_CNT(info->xmit.head,
                     info->xmit.tail,
-                    SERIAL_XMIT_SIZE) < WAKEUP_CHARS)
+                    UART_XMIT_SIZE) < WAKEUP_CHARS)
                tty_wakeup(info->tport.tty);
 
 #ifdef SERIAL_DEBUG_INTR
@@ -708,13 +709,13 @@ static int rs_put_char(struct tty_struct *tty, unsigned char ch)
        local_irq_save(flags);
        if (CIRC_SPACE(info->xmit.head,
                       info->xmit.tail,
-                      SERIAL_XMIT_SIZE) == 0) {
+                      UART_XMIT_SIZE) == 0) {
                local_irq_restore(flags);
                return 0;
        }
 
        info->xmit.buf[info->xmit.head++] = ch;
-       info->xmit.head &= SERIAL_XMIT_SIZE-1;
+       info->xmit.head &= UART_XMIT_SIZE - 1;
        local_irq_restore(flags);
        return 1;
 }
@@ -753,15 +754,14 @@ static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count
        while (1) {
                c = CIRC_SPACE_TO_END(info->xmit.head,
                                      info->xmit.tail,
-                                     SERIAL_XMIT_SIZE);
+                                     UART_XMIT_SIZE);
                if (count < c)
                        c = count;
                if (c <= 0) {
                        break;
                }
                memcpy(info->xmit.buf + info->xmit.head, buf, c);
-               info->xmit.head = ((info->xmit.head + c) &
-                                  (SERIAL_XMIT_SIZE-1));
+               info->xmit.head = (info->xmit.head + c) & (UART_XMIT_SIZE - 1);
                buf += c;
                count -= c;
                ret += c;
@@ -788,14 +788,14 @@ static unsigned int rs_write_room(struct tty_struct *tty)
 {
        struct serial_state *info = tty->driver_data;
 
-       return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
+       return CIRC_SPACE(info->xmit.head, info->xmit.tail, UART_XMIT_SIZE);
 }
 
 static unsigned int rs_chars_in_buffer(struct tty_struct *tty)
 {
        struct serial_state *info = tty->driver_data;
 
-       return CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
+       return CIRC_CNT(info->xmit.head, info->xmit.tail, UART_XMIT_SIZE);
 }
 
 static void rs_flush_buffer(struct tty_struct *tty)
index 4990742..e81701a 100644 (file)
@@ -916,7 +916,7 @@ static int mips_ejtag_fdc_tty_probe(struct mips_cdmm_device *dev)
        mips_ejtag_fdc_write(priv, REG_FDCFG, cfg);
 
        /* Make each port's xmit FIFO big enough to fill FDC TX FIFO */
-       priv->xmit_size = min(tx_fifo * 4, (unsigned int)SERIAL_XMIT_SIZE);
+       priv->xmit_size = min(tx_fifo * 4, (unsigned int)UART_XMIT_SIZE);
 
        driver = tty_alloc_driver(NUM_TTY_CHANNELS, TTY_DRIVER_REAL_RAW);
        if (IS_ERR(driver))
index 4869c00..6c8db19 100644 (file)
@@ -162,7 +162,7 @@ static void meson_uart_start_tx(struct uart_port *port)
 
                ch = xmit->buf[xmit->tail];
                writel(ch, port->membase + AML_UART_WFIFO);
-               xmit->tail = (xmit->tail+1) & (SERIAL_XMIT_SIZE - 1);
+               xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
                port->icount.tx++;
        }
 
index 44d20e5..888e17e 100644 (file)
@@ -201,7 +201,7 @@ static void owl_uart_send_chars(struct uart_port *port)
 
                ch = xmit->buf[xmit->tail];
                owl_uart_write(port, ch, OWL_UART_TXDAT);
-               xmit->tail = (xmit->tail + 1) & (SERIAL_XMIT_SIZE - 1);
+               xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
                port->icount.tx++;
        }
 
index f556b49..feb2054 100644 (file)
@@ -353,7 +353,7 @@ static void rda_uart_send_chars(struct uart_port *port)
 
                ch = xmit->buf[xmit->tail];
                rda_uart_write(port, ch, RDA_UART_RXTX_BUFFER);
-               xmit->tail = (xmit->tail + 1) & (SERIAL_XMIT_SIZE - 1);
+               xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
                port->icount.tx++;
        }
 
index 0b8b7d7..70a9866 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef _LINUX_SERIAL_H
 #define _LINUX_SERIAL_H
 
-#include <asm/page.h>
 #include <uapi/linux/serial.h>
 
 /* Helper for dealing with UART_LCR_WLEN* defines */
@@ -25,11 +24,6 @@ struct async_icount {
        __u32   buf_overrun;
 };
 
-/*
- * The size of the serial xmit buffer is 1 page, or 4096 bytes
- */
-#define SERIAL_XMIT_SIZE PAGE_SIZE
-
 #include <linux/compiler.h>
 
 #endif /* _LINUX_SERIAL_H */