#include <linux/io.h>
 #include <linux/errno.h>
+#include <linux/serial.h>
 #include <linux/serial_reg.h>
 #include <asm/addrspace.h>
 #include <asm/setup.h>
        } while (1);
 }
 
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
-
 static void prom_putchar_ar71xx(char ch)
 {
        void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE));
 
-       prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
+       prom_putchar_wait(base + UART_LSR * 4, UART_LSR_BOTH_EMPTY,
+                         UART_LSR_BOTH_EMPTY);
        __raw_writel((unsigned char)ch, base + UART_TX * 4);
-       prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
+       prom_putchar_wait(base + UART_LSR * 4, UART_LSR_BOTH_EMPTY,
+                         UART_LSR_BOTH_EMPTY);
 }
 
 static void prom_putchar_ar933x(char ch)
 
 #define NUM_DISABLE_TIMEOUTS 3
 /* buffer timeout in ms */
 #define SPK_TIMEOUT 100
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
 
 #define spk_serial_tx_busy() \
-       ((inb(speakup_info.port_tts + UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY)
+       (!uart_lsr_tx_empty(inb(speakup_info.port_tts + UART_LSR)))
 
 #endif
 
        }
 }
 
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
-
 static void serial_putc(struct uart_port *port, unsigned char c)
 {
        unsigned int status;
 
        for (;;) {
                status = serial8250_early_in(port, UART_LSR);
-               if ((status & BOTH_EMPTY) == BOTH_EMPTY)
+               if (uart_lsr_tx_empty(status))
                        break;
                cpu_relax();
        }
 
 #define DEBUG_AUTOCONF(fmt...) do { } while (0)
 #endif
 
-#define BOTH_EMPTY     (UART_LSR_TEMT | UART_LSR_THRE)
-
 /*
  * Here we define the default xmit fifo size used for each type of UART.
  */
                if (uart_circ_empty(xmit))
                        break;
                if ((up->capabilities & UART_CAP_HFIFO) &&
-                   (serial_in(up, UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY)
+                   !uart_lsr_tx_empty(serial_in(up, UART_LSR)))
                        break;
                /* The BCM2835 MINI UART THRE bit is really a not-full bit. */
                if ((up->capabilities & UART_CAP_MINI) &&
 
        serial8250_rpm_put(up);
 
-       return (lsr & BOTH_EMPTY) == BOTH_EMPTY ? TIOCSER_TEMT : 0;
+       return uart_lsr_tx_empty(lsr) ? TIOCSER_TEMT : 0;
 }
 
 unsigned int serial8250_do_get_mctrl(struct uart_port *port)
        else
                serial_port_out(port, UART_IER, 0);
 
-       wait_for_xmitr(up, BOTH_EMPTY);
+       wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
        /*
         *      Send the character out.
         */
         *      Finally, wait for transmitter to become empty
         *      and restore the IER
         */
-       wait_for_xmitr(up, BOTH_EMPTY);
+       wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
        serial_port_out(port, UART_IER, ier);
        serial8250_rpm_put(up);
 }
         *      Finally, wait for transmitter to become empty
         *      and restore the IER
         */
-       wait_for_xmitr(up, BOTH_EMPTY);
+       wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
 
        if (em485) {
                mdelay(port->rs485.delay_rts_after_send);
 
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/console.h>
+#include <linux/serial.h>
 #include <linux/serial_reg.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
        return up->name;
 }
 
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
-
 static void __maybe_unused wait_for_xmitr(struct uart_omap_port *up)
 {
        unsigned int status, tmout = 10000;
                if (--tmout == 0)
                        break;
                udelay(1);
-       } while ((status & BOTH_EMPTY) != BOTH_EMPTY);
+       } while (!uart_lsr_tx_empty(status));
 
        /* Wait up to 1s for flow control if necessary */
        if (up->port.flags & UPF_CONS_FLOW) {
 
        for (;;) {
                status = omap_serial_early_in(port, UART_LSR);
-               if ((status & BOTH_EMPTY) == BOTH_EMPTY)
+               if (uart_lsr_tx_empty(status))
                        break;
                cpu_relax();
        }
 
  *Copyright (C) 2011 LAPIS Semiconductor Co., Ltd.
  */
 #include <linux/kernel.h>
+#include <linux/serial.h>
 #include <linux/serial_reg.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #define PCH_UART_HAL_LOOP              (PCH_UART_MCR_LOOP)
 #define PCH_UART_HAL_AFE               (PCH_UART_MCR_AFE)
 
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
-
 #define DEFAULT_UARTCLK   1843200 /*   1.8432 MHz */
 #define CMITC_UARTCLK   192000000 /* 192.0000 MHz */
 #define FRI2_64_UARTCLK  64000000 /*  64.0000 MHz */
         * Finally, wait for transmitter to become empty
         * and restore the IER
         */
-       wait_for_xmitr(priv, BOTH_EMPTY);
+       wait_for_xmitr(priv, UART_LSR_BOTH_EMPTY);
        iowrite8(ier, priv->membase + UART_IER);
 }
 #endif /* CONFIG_CONSOLE_POLL */
         *      Finally, wait for transmitter to become empty
         *      and restore the IER
         */
-       wait_for_xmitr(priv, BOTH_EMPTY);
+       wait_for_xmitr(priv, UART_LSR_BOTH_EMPTY);
        iowrite8(ier, priv->membase + UART_IER);
 
        if (port_locked)
 
 #include <linux/init.h>
 #include <linux/console.h>
 #include <linux/sysrq.h>
+#include <linux/serial.h>
 #include <linux/serial_reg.h>
 #include <linux/circ_buf.h>
 #include <linux/delay.h>
 
 #ifdef CONFIG_SERIAL_PXA_CONSOLE
 
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
-
 /*
  *     Wait for transmitter & holding register to empty
  */
                if (--tmout == 0)
                        break;
                udelay(1);
-       } while ((status & BOTH_EMPTY) != BOTH_EMPTY);
+       } while (!uart_lsr_tx_empty(status));
 
        /* Wait up to 1s for flow control if necessary */
        if (up->port.flags & UPF_CONS_FLOW) {
 
 
 #ifdef CONFIG_SERIAL_SUNSU_CONSOLE
 
-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
-
 /*
  *     Wait for transmitter & holding register to empty
  */
                if (--tmout == 0)
                        break;
                udelay(1);
-       } while ((status & BOTH_EMPTY) != BOTH_EMPTY);
+       } while (!uart_lsr_tx_empty(status));
 
        /* Wait up to 1s for flow control if necessary */
        if (up->port.flags & UPF_CONS_FLOW) {
 
 
 #ifdef CONFIG_SERIAL_VR41XX_CONSOLE
 
-#define BOTH_EMPTY     (UART_LSR_TEMT | UART_LSR_THRE)
-
 static void wait_for_xmitr(struct uart_port *port)
 {
        int timeout = 10000;
                if (lsr & UART_LSR_BI)
                        lsr_break_flag[port->line] = UART_LSR_BI;
 
-               if ((lsr & BOTH_EMPTY) == BOTH_EMPTY)
+               if (uart_lsr_tx_empty(lsr))
                        break;
        } while (timeout-- > 0);
 
 
 #define _LINUX_SERIAL_H
 
 #include <uapi/linux/serial.h>
+#include <uapi/linux/serial_reg.h>
 
 /* Helper for dealing with UART_LCR_WLEN* defines */
 #define UART_LCR_WLEN(x)       ((x) - 5)
 
+/* FIFO and shifting register empty */
+#define UART_LSR_BOTH_EMPTY    (UART_LSR_TEMT | UART_LSR_THRE)
+
+static inline bool uart_lsr_tx_empty(u16 lsr)
+{
+       return (lsr & UART_LSR_BOTH_EMPTY) == UART_LSR_BOTH_EMPTY;
+}
+
 /*
  * Counters of the input lines (CTS, DSR, RI, CD) interrupts
  */