mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 16:14:13 +08:00
serial: drivers: switch ch and flag to u8
Now that the serial layer explicitly expects 'u8' for flags and characters, propagate this type to drivers' (RX) routines. Note that amba-pl011's, clps711x's and st-asc's 'ch' are left unchanged because 'ch' contains not only a character, but whole status. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Tobias Klauser <tklauser@distanz.ch> Cc: Russell King <linux@armlinux.org.uk> Cc: Vineet Gupta <vgupta@kernel.org> Cc: Richard Genoud <richard.genoud@gmail.com> Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Claudiu Beznea <claudiu.beznea@microchip.com> Cc: Alexander Shiyan <shc_work@mail.ru> Cc: Baruch Siach <baruch@tkos.co.il> Cc: "Maciej W. Rozycki" <macro@orcam.me.uk> Cc: Taichi Sugaya <sugaya.taichi@socionext.com> Cc: Takao Orito <orito.takao@socionext.com> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Pengutronix Kernel Team <kernel@pengutronix.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: NXP Linux Team <linux-imx@nxp.com> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Cc: Alim Akhtar <alim.akhtar@samsung.com> Cc: Laxman Dewangan <ldewangan@nvidia.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Jonathan Hunter <jonathanh@nvidia.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: Hammer Hsieh <hammerh0314@gmail.com> Acked-by: Richard GENOUD <richard.genoud@gmail.com> Acked-by: Tobias Klauser <tklauser@distanz.ch> Acked-by: Thierry Reding <treding@nvidia.com> Acked-by: Maciej W. Rozycki <macro@orcam.me.uk> Link: https://lore.kernel.org/r/20230712081811.29004-11-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4d1fceb1b2
commit
fd2b55f86b
@ -117,7 +117,8 @@ static void serial21285_stop_rx(struct uart_port *port)
|
||||
static irqreturn_t serial21285_rx_chars(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_port *port = dev_id;
|
||||
unsigned int status, ch, flag, rxs, max_count = 256;
|
||||
unsigned int status, rxs, max_count = 256;
|
||||
u8 ch, flag;
|
||||
|
||||
status = *CSR_UARTFLG;
|
||||
while (!(status & 0x10) && max_count--) {
|
||||
|
@ -1706,8 +1706,7 @@ static void serial8250_enable_ms(struct uart_port *port)
|
||||
void serial8250_read_char(struct uart_8250_port *up, u16 lsr)
|
||||
{
|
||||
struct uart_port *port = &up->port;
|
||||
unsigned char ch;
|
||||
char flag = TTY_NORMAL;
|
||||
u8 ch, flag = TTY_NORMAL;
|
||||
|
||||
if (likely(lsr & UART_LSR_DR))
|
||||
ch = serial_in(up, UART_RX);
|
||||
|
@ -110,8 +110,8 @@ static void altera_jtaguart_set_termios(struct uart_port *port,
|
||||
|
||||
static void altera_jtaguart_rx_chars(struct uart_port *port)
|
||||
{
|
||||
unsigned char ch;
|
||||
unsigned long status;
|
||||
u8 ch;
|
||||
|
||||
while ((status = readl(port->membase + ALTERA_JTAGUART_DATA_REG)) &
|
||||
ALTERA_JTAGUART_DATA_RVALID_MSK) {
|
||||
|
@ -201,8 +201,8 @@ static void altera_uart_set_termios(struct uart_port *port,
|
||||
|
||||
static void altera_uart_rx_chars(struct uart_port *port)
|
||||
{
|
||||
unsigned char ch, flag;
|
||||
unsigned short status;
|
||||
u8 ch, flag;
|
||||
|
||||
while ((status = altera_uart_readl(port, ALTERA_UART_STATUS_REG)) &
|
||||
ALTERA_UART_STATUS_RRDY_MSK) {
|
||||
|
@ -112,7 +112,8 @@ static void pl010_enable_ms(struct uart_port *port)
|
||||
|
||||
static void pl010_rx_chars(struct uart_port *port)
|
||||
{
|
||||
unsigned int status, ch, flag, rsr, max_count = 256;
|
||||
unsigned int status, rsr, max_count = 256;
|
||||
u8 ch, flag;
|
||||
|
||||
status = readb(port->membase + UART01x_FR);
|
||||
while (UART_RX_DATA(status) && max_count--) {
|
||||
|
@ -307,9 +307,10 @@ static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
|
||||
*/
|
||||
static int pl011_fifo_to_tty(struct uart_amba_port *uap)
|
||||
{
|
||||
unsigned int ch, flag, fifotaken;
|
||||
unsigned int ch, fifotaken;
|
||||
int sysrq;
|
||||
u16 status;
|
||||
u8 flag;
|
||||
|
||||
for (fifotaken = 0; fifotaken != 256; fifotaken++) {
|
||||
status = pl011_read(uap, REG_FR);
|
||||
|
@ -70,8 +70,9 @@ static void apbuart_stop_rx(struct uart_port *port)
|
||||
|
||||
static void apbuart_rx_chars(struct uart_port *port)
|
||||
{
|
||||
unsigned int status, ch, rsr, flag;
|
||||
unsigned int status, rsr;
|
||||
unsigned int max_chars = port->fifosize;
|
||||
u8 ch, flag;
|
||||
|
||||
status = UART_GET_STATUS(port);
|
||||
|
||||
|
@ -205,7 +205,7 @@ static void arc_serial_rx_chars(struct uart_port *port, unsigned int status)
|
||||
* controller, which is indeed the Rx-FIFO.
|
||||
*/
|
||||
do {
|
||||
unsigned int ch, flg = TTY_NORMAL;
|
||||
u8 ch, flg = TTY_NORMAL;
|
||||
|
||||
/*
|
||||
* This could be an Rx Intr for err (no data),
|
||||
|
@ -1516,8 +1516,8 @@ static void atmel_rx_from_ring(struct uart_port *port)
|
||||
{
|
||||
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
|
||||
struct circ_buf *ring = &atmel_port->rx_ring;
|
||||
unsigned int flg;
|
||||
unsigned int status;
|
||||
u8 flg;
|
||||
|
||||
while (ring->head != ring->tail) {
|
||||
struct atmel_uart_char c;
|
||||
|
@ -92,8 +92,9 @@ static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_port *port = dev_id;
|
||||
struct clps711x_port *s = dev_get_drvdata(port->dev);
|
||||
unsigned int status, flg;
|
||||
unsigned int status;
|
||||
u16 ch;
|
||||
u8 flg;
|
||||
|
||||
for (;;) {
|
||||
u32 sysflg = 0;
|
||||
|
@ -136,8 +136,7 @@ static void digicolor_uart_rx(struct uart_port *port)
|
||||
spin_lock_irqsave(&port->lock, flags);
|
||||
|
||||
while (1) {
|
||||
u8 status, ch;
|
||||
unsigned int ch_flag;
|
||||
u8 status, ch, ch_flag;
|
||||
|
||||
if (digicolor_uart_rx_empty(port))
|
||||
break;
|
||||
|
@ -181,8 +181,8 @@ static inline void dz_receive_chars(struct dz_mux *mux)
|
||||
struct dz_port *dport = &mux->dport[0];
|
||||
struct uart_icount *icount;
|
||||
int lines_rx[DZ_NB_PORT] = { [0 ... DZ_NB_PORT - 1] = 0 };
|
||||
unsigned char ch, flag;
|
||||
u16 status;
|
||||
u8 ch, flag;
|
||||
int i;
|
||||
|
||||
while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) {
|
||||
|
@ -248,8 +248,8 @@ static void ip22zilog_maybe_update_regs(struct uart_ip22zilog_port *up,
|
||||
static bool ip22zilog_receive_chars(struct uart_ip22zilog_port *up,
|
||||
struct zilog_channel *channel)
|
||||
{
|
||||
unsigned char ch, flag;
|
||||
unsigned int r1;
|
||||
u8 ch, flag;
|
||||
bool push = up->port.state != NULL;
|
||||
|
||||
for (;;) {
|
||||
|
@ -215,8 +215,9 @@ static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx)
|
||||
|
||||
static int max3100_handlerx(struct max3100_port *s, u16 rx)
|
||||
{
|
||||
unsigned int ch, flg, status = 0;
|
||||
unsigned int status = 0;
|
||||
int ret = 0, cts;
|
||||
u8 ch, flg;
|
||||
|
||||
if (rx & MAX3100_R && s->rx_enabled) {
|
||||
dev_dbg(&s->spi->dev, "%s\n", __func__);
|
||||
|
@ -669,7 +669,8 @@ static void max310x_batch_read(struct uart_port *port, u8 *rxbuf, unsigned int l
|
||||
static void max310x_handle_rx(struct uart_port *port, unsigned int rxlen)
|
||||
{
|
||||
struct max310x_one *one = to_max310x_port(port);
|
||||
unsigned int sts, ch, flag, i;
|
||||
unsigned int sts, i;
|
||||
u8 ch, flag;
|
||||
|
||||
if (port->read_status_mask == MAX310X_LSR_RXOVR_BIT) {
|
||||
/* We are just reading, happily ignoring any error conditions.
|
||||
|
@ -281,7 +281,7 @@ static void mcf_set_termios(struct uart_port *port, struct ktermios *termios,
|
||||
static void mcf_rx_chars(struct mcf_uart *pp)
|
||||
{
|
||||
struct uart_port *port = &pp->port;
|
||||
unsigned char status, ch, flag;
|
||||
u8 status, ch, flag;
|
||||
|
||||
while ((status = readb(port->membase + MCFUART_USR)) & MCFUART_USR_RXREADY) {
|
||||
ch = readb(port->membase + MCFUART_URB);
|
||||
|
@ -148,8 +148,7 @@ static void mlb_usio_enable_ms(struct uart_port *port)
|
||||
static void mlb_usio_rx_chars(struct uart_port *port)
|
||||
{
|
||||
struct tty_port *ttyport = &port->state->port;
|
||||
unsigned long flag = 0;
|
||||
char ch = 0;
|
||||
u8 flag = 0, ch = 0;
|
||||
u8 status;
|
||||
int max_count = 2;
|
||||
|
||||
|
@ -616,9 +616,8 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s)
|
||||
|
||||
static void mxs_auart_rx_char(struct mxs_auart_port *s)
|
||||
{
|
||||
int flag;
|
||||
u32 stat;
|
||||
u8 c;
|
||||
u8 c, flag;
|
||||
|
||||
c = mxs_read(s, REG_DATA);
|
||||
stat = mxs_read(s, REG_STAT);
|
||||
|
@ -442,7 +442,7 @@ static unsigned int check_modem_status(struct uart_omap_port *up)
|
||||
|
||||
static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
|
||||
{
|
||||
unsigned int flag;
|
||||
u8 flag;
|
||||
|
||||
/*
|
||||
* Read one data character out to avoid stalling the receiver according
|
||||
@ -498,7 +498,7 @@ static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
|
||||
|
||||
static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr)
|
||||
{
|
||||
unsigned char ch = 0;
|
||||
u8 ch;
|
||||
|
||||
if (!(lsr & UART_LSR_DR))
|
||||
return;
|
||||
|
@ -90,7 +90,7 @@ static void serial_pxa_stop_rx(struct uart_port *port)
|
||||
|
||||
static inline void receive_chars(struct uart_pxa_port *up, int *status)
|
||||
{
|
||||
unsigned int ch, flag;
|
||||
u8 ch, flag;
|
||||
int max_count = 256;
|
||||
|
||||
do {
|
||||
|
@ -401,14 +401,14 @@ static void rp2_rx_chars(struct rp2_uart_port *up)
|
||||
|
||||
for (; bytes != 0; bytes--) {
|
||||
u32 byte = readw(up->base + RP2_DATA_BYTE) | RP2_DUMMY_READ;
|
||||
char ch = byte & 0xff;
|
||||
u8 ch = byte & 0xff;
|
||||
|
||||
if (likely(!(byte & RP2_DATA_BYTE_EXCEPTION_MASK))) {
|
||||
if (!uart_handle_sysrq_char(&up->port, ch))
|
||||
uart_insert_char(&up->port, byte, 0, ch,
|
||||
TTY_NORMAL);
|
||||
} else {
|
||||
char flag = TTY_NORMAL;
|
||||
u8 flag = TTY_NORMAL;
|
||||
|
||||
if (byte & RP2_DATA_BYTE_BREAK_m)
|
||||
flag = TTY_BREAK;
|
||||
|
@ -180,7 +180,8 @@ static void sa1100_enable_ms(struct uart_port *port)
|
||||
static void
|
||||
sa1100_rx_chars(struct sa1100_port *sport)
|
||||
{
|
||||
unsigned int status, ch, flg;
|
||||
unsigned int status;
|
||||
u8 ch, flg;
|
||||
|
||||
status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
|
||||
UTSR0_TO_SM(UART_GET_UTSR0(sport));
|
||||
|
@ -759,9 +759,10 @@ finish:
|
||||
static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport)
|
||||
{
|
||||
struct uart_port *port = &ourport->port;
|
||||
unsigned int ufcon, ch, flag, ufstat, uerstat;
|
||||
unsigned int ufcon, ufstat, uerstat;
|
||||
unsigned int fifocnt = 0;
|
||||
int max_count = port->fifosize;
|
||||
u8 ch, flag;
|
||||
|
||||
while (max_count-- > 0) {
|
||||
/*
|
||||
|
@ -331,8 +331,9 @@ static void sbd_receive_chars(struct sbd_port *sport)
|
||||
{
|
||||
struct uart_port *uport = &sport->port;
|
||||
struct uart_icount *icount;
|
||||
unsigned int status, ch, flag;
|
||||
unsigned int status;
|
||||
int count;
|
||||
u8 ch, flag;
|
||||
|
||||
for (count = 16; count; count--) {
|
||||
status = read_sbdchn(sport, R_DUART_STATUS);
|
||||
|
@ -578,8 +578,9 @@ static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen,
|
||||
unsigned int iir)
|
||||
{
|
||||
struct sc16is7xx_port *s = dev_get_drvdata(port->dev);
|
||||
unsigned int lsr = 0, ch, flag, bytes_read, i;
|
||||
unsigned int lsr = 0, bytes_read, i;
|
||||
bool read_lsr = (iir == SC16IS7XX_IIR_RLSE_SRC) ? true : false;
|
||||
u8 ch, flag;
|
||||
|
||||
if (unlikely(rxlen >= sizeof(s->buf))) {
|
||||
dev_warn_ratelimited(port->dev,
|
||||
|
@ -383,8 +383,7 @@ static void sccnxp_set_bit(struct uart_port *port, int sig, int state)
|
||||
|
||||
static void sccnxp_handle_rx(struct uart_port *port)
|
||||
{
|
||||
u8 sr;
|
||||
unsigned int ch, flag;
|
||||
u8 sr, ch, flag;
|
||||
|
||||
for (;;) {
|
||||
sr = sccnxp_port_read(port, SCCNXP_SR_REG);
|
||||
|
@ -434,10 +434,10 @@ static int tegra_set_baudrate(struct tegra_uart_port *tup, unsigned int baud)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char tegra_uart_decode_rx_error(struct tegra_uart_port *tup,
|
||||
static u8 tegra_uart_decode_rx_error(struct tegra_uart_port *tup,
|
||||
unsigned long lsr)
|
||||
{
|
||||
char flag = TTY_NORMAL;
|
||||
u8 flag = TTY_NORMAL;
|
||||
|
||||
if (unlikely(lsr & TEGRA_UART_LSR_ANY)) {
|
||||
if (lsr & UART_LSR_OE) {
|
||||
@ -642,9 +642,8 @@ static void tegra_uart_handle_rx_pio(struct tegra_uart_port *tup,
|
||||
struct tty_port *port)
|
||||
{
|
||||
do {
|
||||
char flag = TTY_NORMAL;
|
||||
unsigned long lsr = 0;
|
||||
unsigned char ch;
|
||||
u8 ch, flag = TTY_NORMAL;
|
||||
|
||||
lsr = tegra_uart_read(tup, UART_LSR);
|
||||
if (!(lsr & UART_LSR_DR))
|
||||
|
@ -246,11 +246,10 @@ static void serial_txx9_initialize(struct uart_port *up)
|
||||
static inline void
|
||||
receive_chars(struct uart_port *up, unsigned int *status)
|
||||
{
|
||||
unsigned char ch;
|
||||
unsigned int disr = *status;
|
||||
int max_count = 256;
|
||||
char flag;
|
||||
unsigned int next_ignore_status_mask;
|
||||
u8 ch, flag;
|
||||
|
||||
do {
|
||||
ch = sio_in(up, TXX9_SIRFIFO);
|
||||
|
@ -402,9 +402,9 @@ static char __ssp_receive_char(struct sifive_serial_port *ssp, char *is_empty)
|
||||
*/
|
||||
static void __ssp_receive_chars(struct sifive_serial_port *ssp)
|
||||
{
|
||||
unsigned char ch;
|
||||
char is_empty;
|
||||
int c;
|
||||
u8 ch;
|
||||
|
||||
for (c = SIFIVE_RX_FIFO_DEPTH; c > 0; --c) {
|
||||
ch = __ssp_receive_char(ssp, &is_empty);
|
||||
|
@ -558,7 +558,7 @@ static void sprd_break_ctl(struct uart_port *port, int break_state)
|
||||
}
|
||||
|
||||
static int handle_lsr_errors(struct uart_port *port,
|
||||
unsigned int *flag,
|
||||
u8 *flag,
|
||||
unsigned int *lsr)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -594,7 +594,8 @@ static inline void sprd_rx(struct uart_port *port)
|
||||
struct sprd_uart_port *sp = container_of(port, struct sprd_uart_port,
|
||||
port);
|
||||
struct tty_port *tty = &port->state->port;
|
||||
unsigned int ch, flag, lsr, max_count = SPRD_TIMEOUT;
|
||||
unsigned int lsr, max_count = SPRD_TIMEOUT;
|
||||
u8 ch, flag;
|
||||
|
||||
if (sp->rx_dma.enable) {
|
||||
sprd_uart_dma_irq(port);
|
||||
|
@ -250,7 +250,7 @@ static void asc_receive_chars(struct uart_port *port)
|
||||
struct tty_port *tport = &port->state->port;
|
||||
unsigned long status, mode;
|
||||
unsigned long c = 0;
|
||||
char flag;
|
||||
u8 flag;
|
||||
bool ignore_pe = false;
|
||||
|
||||
/*
|
||||
|
@ -321,7 +321,7 @@ static bool stm32_usart_pending_rx_pio(struct uart_port *port, u32 *sr)
|
||||
return false;
|
||||
}
|
||||
|
||||
static unsigned long stm32_usart_get_char_pio(struct uart_port *port)
|
||||
static u8 stm32_usart_get_char_pio(struct uart_port *port)
|
||||
{
|
||||
struct stm32_port *stm32_port = to_stm32_port(port);
|
||||
const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
|
||||
@ -338,10 +338,9 @@ static unsigned int stm32_usart_receive_chars_pio(struct uart_port *port)
|
||||
{
|
||||
struct stm32_port *stm32_port = to_stm32_port(port);
|
||||
const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
|
||||
unsigned long c;
|
||||
unsigned int size = 0;
|
||||
u32 sr;
|
||||
char flag;
|
||||
u8 c, flag;
|
||||
|
||||
while (stm32_usart_pending_rx_pio(port, &sr)) {
|
||||
sr |= USART_SR_DUMMY_RX;
|
||||
|
@ -231,7 +231,7 @@ static void transmit_chars(struct uart_port *port)
|
||||
static void receive_chars(struct uart_port *port)
|
||||
{
|
||||
unsigned int lsr = readl(port->membase + SUP_UART_LSR);
|
||||
unsigned int ch, flag;
|
||||
u8 ch, flag;
|
||||
|
||||
do {
|
||||
ch = readl(port->membase + SUP_UART_DATA);
|
||||
|
@ -539,8 +539,9 @@ static void zs_receive_chars(struct zs_port *zport)
|
||||
struct uart_port *uport = &zport->port;
|
||||
struct zs_scc *scc = zport->scc;
|
||||
struct uart_icount *icount;
|
||||
unsigned int avail, status, ch, flag;
|
||||
unsigned int avail, status;
|
||||
int count;
|
||||
u8 ch, flag;
|
||||
|
||||
for (count = 16; count; count--) {
|
||||
spin_lock(&scc->zlock);
|
||||
|
Loading…
Reference in New Issue
Block a user