Skip to content

Commit

Permalink
serial: 8250_lpss: Extract dw8250_do_set_termios() for common use
Browse files Browse the repository at this point in the history
Some of the code currently used in dw8250_set_termios(), byt_set_termios()
may be reused by other methods in the future. Extract it to a common helper
function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211005133026.21488-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
andy-shev authored and gregkh committed Oct 10, 2021
1 parent 0eb9da9 commit 7c4fc08
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
6 changes: 1 addition & 5 deletions drivers/tty/serial/8250/8250_dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,7 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios,
}
clk_prepare_enable(d->clk);

p->status &= ~UPSTAT_AUTOCTS;
if (termios->c_cflag & CRTSCTS)
p->status |= UPSTAT_AUTOCTS;

serial8250_do_set_termios(p, termios, old);
dw8250_do_set_termios(p, termios, old);
}

static void dw8250_set_ldisc(struct uart_port *p, struct ktermios *termios)
Expand Down
10 changes: 10 additions & 0 deletions drivers/tty/serial/8250/8250_dwlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ static void dw8250_set_divisor(struct uart_port *p, unsigned int baud,
serial8250_do_set_divisor(p, baud, quot, quot_frac);
}

void dw8250_do_set_termios(struct uart_port *p, struct ktermios *termios, struct ktermios *old)
{
p->status &= ~UPSTAT_AUTOCTS;
if (termios->c_cflag & CRTSCTS)
p->status |= UPSTAT_AUTOCTS;

serial8250_do_set_termios(p, termios, old);
}
EXPORT_SYMBOL_GPL(dw8250_do_set_termios);

void dw8250_setup_port(struct uart_port *p)
{
struct uart_8250_port *up = up_to_u8250p(p);
Expand Down
1 change: 1 addition & 0 deletions drivers/tty/serial/8250/8250_dwlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ struct dw8250_port_data {
u8 dlf_size;
};

void dw8250_do_set_termios(struct uart_port *p, struct ktermios *termios, struct ktermios *old);
void dw8250_setup_port(struct uart_port *p);
6 changes: 1 addition & 5 deletions drivers/tty/serial/8250/8250_lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,7 @@ static void byt_set_termios(struct uart_port *p, struct ktermios *termios,
reg |= BYT_PRV_CLK_EN | BYT_PRV_CLK_UPDATE;
writel(reg, p->membase + BYT_PRV_CLK);

p->status &= ~UPSTAT_AUTOCTS;
if (termios->c_cflag & CRTSCTS)
p->status |= UPSTAT_AUTOCTS;

serial8250_do_set_termios(p, termios, old);
dw8250_do_set_termios(p, termios, old);
}

static unsigned int byt_get_mctrl(struct uart_port *port)
Expand Down

0 comments on commit 7c4fc08

Please sign in to comment.