Skip to content

Commit

Permalink
serial: Make ->set_termios() old ktermios const
Browse files Browse the repository at this point in the history
There should be no reason to adjust old ktermios which is going to get
discarded anyway.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220816115739.10928-7-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
ij-intel authored and gregkh committed Aug 30, 2022
1 parent 8b7d2d9 commit bec5b81
Show file tree
Hide file tree
Showing 82 changed files with 117 additions and 112 deletions.
2 changes: 1 addition & 1 deletion drivers/tty/serial/21285.c
Expand Up @@ -243,7 +243,7 @@ static void serial21285_shutdown(struct uart_port *port)

static void
serial21285_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned long flags;
unsigned int baud, quot, h_lcr, b;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_bcm7271.c
Expand Up @@ -755,7 +755,7 @@ static void set_clock_mux(struct uart_port *up, struct brcmuart_priv *priv,

static void brcmstb_set_termios(struct uart_port *up,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct uart_8250_port *p8250 = up_to_u8250p(up);
struct brcmuart_priv *priv = up->private_data;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_dw.c
Expand Up @@ -350,7 +350,7 @@ dw8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old)
}

static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned long newrate = tty_termios_baud_rate(termios) * 16;
struct dw8250_data *d = to_dw8250_data(p->private_data);
Expand Down
3 changes: 2 additions & 1 deletion drivers/tty/serial/8250/8250_dwlib.c
Expand Up @@ -92,7 +92,8 @@ 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)
void dw8250_do_set_termios(struct uart_port *p, struct ktermios *termios,
const struct ktermios *old)
{
p->status &= ~UPSTAT_AUTOCTS;
if (termios->c_cflag & CRTSCTS)
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_dwlib.h
Expand Up @@ -47,7 +47,7 @@ struct dw8250_data {
unsigned int uart_16550_compatible:1;
};

void dw8250_do_set_termios(struct uart_port *p, struct ktermios *termios, struct ktermios *old);
void dw8250_do_set_termios(struct uart_port *p, struct ktermios *termios, const struct ktermios *old);
void dw8250_setup_port(struct uart_port *p);

static inline struct dw8250_data *to_dw8250_data(struct dw8250_port_data *data)
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_fintek.c
Expand Up @@ -278,7 +278,7 @@ static void fintek_8250_set_max_fifo(struct fintek_8250 *pdata)

static void fintek_8250_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct fintek_8250 *pdata = port->private_data;
unsigned int baud = tty_termios_baud_rate(termios);
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_lpss.c
Expand Up @@ -70,7 +70,7 @@ static inline struct lpss8250 *to_lpss8250(struct dw8250_port_data *data)
}

static void byt_set_termios(struct uart_port *p, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned int baud = tty_termios_baud_rate(termios);
struct lpss8250 *lpss = to_lpss8250(p->private_data);
Expand Down
5 changes: 2 additions & 3 deletions drivers/tty/serial/8250/8250_mid.c
Expand Up @@ -206,9 +206,8 @@ static void dnv_exit(struct mid8250 *mid)

/*****************************************************************************/

static void mid8250_set_termios(struct uart_port *p,
struct ktermios *termios,
struct ktermios *old)
static void mid8250_set_termios(struct uart_port *p, struct ktermios *termios,
const struct ktermios *old)
{
unsigned int baud = tty_termios_baud_rate(termios);
struct mid8250 *mid = p->private_data;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_mtk.c
Expand Up @@ -291,7 +291,7 @@ static void mtk8250_set_flow_ctrl(struct uart_8250_port *up, int mode)

static void
mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
static const unsigned short fraction_L_mapping[] = {
0, 1, 0x5, 0x15, 0x55, 0x57, 0x57, 0x77, 0x7F, 0xFF, 0xFF
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_omap.c
Expand Up @@ -350,7 +350,7 @@ static void omap8250_restore_regs(struct uart_8250_port *up)
*/
static void omap_8250_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct uart_8250_port *up = up_to_u8250p(port);
struct omap8250_priv *priv = up->port.private_data;
Expand Down
6 changes: 3 additions & 3 deletions drivers/tty/serial/8250/8250_port.c
Expand Up @@ -2653,7 +2653,7 @@ static void serial8250_set_divisor(struct uart_port *port, unsigned int baud,

static unsigned int serial8250_get_baud_rate(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned int tolerance = port->uartclk / 100;
unsigned int min;
Expand Down Expand Up @@ -2739,7 +2739,7 @@ EXPORT_SYMBOL_GPL(serial8250_update_uartclk);

void
serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct uart_8250_port *up = up_to_u8250p(port);
unsigned char cval;
Expand Down Expand Up @@ -2877,7 +2877,7 @@ EXPORT_SYMBOL(serial8250_do_set_termios);

static void
serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
if (port->set_termios)
port->set_termios(port, termios, old);
Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/serial/altera_jtaguart.c
Expand Up @@ -106,8 +106,8 @@ static void altera_jtaguart_break_ctl(struct uart_port *port, int break_state)
}

static void altera_jtaguart_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
struct ktermios *termios,
const struct ktermios *old)
{
/* Just copy the old termios settings back */
if (old)
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/altera_uart.c
Expand Up @@ -175,7 +175,7 @@ static void altera_uart_break_ctl(struct uart_port *port, int break_state)

static void altera_uart_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned long flags;
unsigned int baud, baudclk;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/amba-pl010.c
Expand Up @@ -370,7 +370,7 @@ static void pl010_shutdown(struct uart_port *port)

static void
pl010_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned int lcr_h, old_cr;
unsigned long flags;
Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/serial/amba-pl011.c
Expand Up @@ -2030,7 +2030,7 @@ pl011_setup_status_masks(struct uart_port *port, struct ktermios *termios)

static void
pl011_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct uart_amba_port *uap =
container_of(port, struct uart_amba_port, port);
Expand Down Expand Up @@ -2162,7 +2162,7 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,

static void
sbsa_uart_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct uart_amba_port *uap =
container_of(port, struct uart_amba_port, port);
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/apbuart.c
Expand Up @@ -228,7 +228,7 @@ static void apbuart_shutdown(struct uart_port *port)
}

static void apbuart_set_termios(struct uart_port *port,
struct ktermios *termios, struct ktermios *old)
struct ktermios *termios, const struct ktermios *old)
{
unsigned int cr;
unsigned long flags;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/ar933x_uart.c
Expand Up @@ -283,7 +283,7 @@ static void ar933x_uart_get_scale_step(unsigned int clk,

static void ar933x_uart_set_termios(struct uart_port *port,
struct ktermios *new,
struct ktermios *old)
const struct ktermios *old)
{
struct ar933x_uart_port *up =
container_of(port, struct ar933x_uart_port, port);
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/arc_uart.c
Expand Up @@ -351,7 +351,7 @@ static void arc_serial_shutdown(struct uart_port *port)

static void
arc_serial_set_termios(struct uart_port *port, struct ktermios *new,
struct ktermios *old)
const struct ktermios *old)
{
struct arc_uart_port *uart = to_arc_port(port);
unsigned int baud, uartl, uarth, hw_val;
Expand Down
5 changes: 3 additions & 2 deletions drivers/tty/serial/atmel_serial.c
Expand Up @@ -2124,8 +2124,9 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
/*
* Change the port parameters
*/
static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
static void atmel_set_termios(struct uart_port *port,
struct ktermios *termios,
const struct ktermios *old)
{
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
unsigned long flags;
Expand Down
5 changes: 2 additions & 3 deletions drivers/tty/serial/bcm63xx_uart.c
Expand Up @@ -492,9 +492,8 @@ static void bcm_uart_shutdown(struct uart_port *port)
/*
* serial core request to change current uart setting
*/
static void bcm_uart_set_termios(struct uart_port *port,
struct ktermios *new,
struct ktermios *old)
static void bcm_uart_set_termios(struct uart_port *port, struct ktermios *new,
const struct ktermios *old)
{
unsigned int ctl, baud, quot, ier;
unsigned long flags;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/clps711x.c
Expand Up @@ -251,7 +251,7 @@ static void uart_clps711x_shutdown(struct uart_port *port)

static void uart_clps711x_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
u32 ubrlcr;
unsigned int baud, quot;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/cpm_uart/cpm_uart_core.c
Expand Up @@ -484,7 +484,7 @@ static void cpm_uart_shutdown(struct uart_port *port)

static void cpm_uart_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
int baud;
unsigned long flags;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/digicolor-usart.c
Expand Up @@ -287,7 +287,7 @@ static void digicolor_uart_shutdown(struct uart_port *port)

static void digicolor_uart_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned int baud, divisor;
u8 config = 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/dz.c
Expand Up @@ -559,7 +559,7 @@ static void dz_reset(struct dz_port *dport)
}

static void dz_set_termios(struct uart_port *uport, struct ktermios *termios,
struct ktermios *old_termios)
const struct ktermios *old_termios)
{
struct dz_port *dport = to_dport(uport);
unsigned long flags;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/fsl_linflexuart.c
Expand Up @@ -401,7 +401,7 @@ static void linflex_shutdown(struct uart_port *port)

static void
linflex_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned long flags;
unsigned long cr, old_cr, cr1;
Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/serial/fsl_lpuart.c
Expand Up @@ -1833,7 +1833,7 @@ static void lpuart32_shutdown(struct uart_port *port)

static void
lpuart_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
unsigned long flags;
Expand Down Expand Up @@ -2073,7 +2073,7 @@ static void lpuart32_serial_setbrg(struct lpuart_port *sport,

static void
lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
unsigned long flags;
Expand Down
5 changes: 2 additions & 3 deletions drivers/tty/serial/icom.c
Expand Up @@ -1351,9 +1351,8 @@ static void icom_close(struct uart_port *port)
kref_put(&icom_port->adapter->kref, icom_kref_release);
}

static void icom_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old_termios)
static void icom_set_termios(struct uart_port *port, struct ktermios *termios,
const struct ktermios *old_termios)
{
struct icom_port *icom_port = to_icom_port(port);
int baud;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/imx.c
Expand Up @@ -1620,7 +1620,7 @@ static void imx_uart_flush_buffer(struct uart_port *port)

static void
imx_uart_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct imx_port *sport = (struct imx_port *)port;
unsigned long flags;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/ip22zilog.c
Expand Up @@ -873,7 +873,7 @@ ip22zilog_convert_to_zs(struct uart_ip22zilog_port *up, unsigned int cflag,
/* The port lock is not held. */
static void
ip22zilog_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct uart_ip22zilog_port *up =
container_of(port, struct uart_ip22zilog_port, port);
Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/serial/jsm/jsm_tty.c
Expand Up @@ -300,8 +300,8 @@ static void jsm_tty_close(struct uart_port *port)
}

static void jsm_tty_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old_termios)
struct ktermios *termios,
const struct ktermios *old_termios)
{
unsigned long lock_flags;
struct jsm_channel *channel =
Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/serial/lantiq.c
Expand Up @@ -405,8 +405,8 @@ lqasc_shutdown(struct uart_port *port)
}

static void
lqasc_set_termios(struct uart_port *port,
struct ktermios *new, struct ktermios *old)
lqasc_set_termios(struct uart_port *port, struct ktermios *new,
const struct ktermios *old)
{
unsigned int cflag;
unsigned int iflag;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/liteuart.c
Expand Up @@ -178,7 +178,7 @@ static void liteuart_shutdown(struct uart_port *port)
}

static void liteuart_set_termios(struct uart_port *port, struct ktermios *new,
struct ktermios *old)
const struct ktermios *old)
{
unsigned int baud;
unsigned long flags;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/lpc32xx_hs.c
Expand Up @@ -493,7 +493,7 @@ static void serial_lpc32xx_shutdown(struct uart_port *port)
/* port->lock is not held. */
static void serial_lpc32xx_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned long flags;
unsigned int baud, quot;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/max3100.c
Expand Up @@ -418,7 +418,7 @@ static void max3100_set_mctrl(struct uart_port *port, unsigned int mctrl)

static void
max3100_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
struct max3100_port *s = container_of(port,
struct max3100_port,
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/max310x.c
Expand Up @@ -906,7 +906,7 @@ static void max310x_break_ctl(struct uart_port *port, int break_state)

static void max310x_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned int lcr = 0, flow = 0;
int baud;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/mcf.c
Expand Up @@ -192,7 +192,7 @@ static void mcf_shutdown(struct uart_port *port)
/****************************************************************************/

static void mcf_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned long flags;
unsigned int baud, baudclk;
Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/serial/men_z135_uart.c
Expand Up @@ -646,8 +646,8 @@ static void men_z135_shutdown(struct uart_port *port)
}

static void men_z135_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
struct ktermios *termios,
const struct ktermios *old)
{
struct men_z135_port *uart = to_men_z135(port);
unsigned int baud;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/meson_uart.c
Expand Up @@ -335,7 +335,7 @@ static void meson_uart_change_speed(struct uart_port *port, unsigned long baud)

static void meson_uart_set_termios(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
const struct ktermios *old)
{
unsigned int cflags, iflags, baud;
unsigned long flags;
Expand Down

0 comments on commit bec5b81

Please sign in to comment.