* [PATCH 0/5] tty/serial termbits cleanups
@ 2022-05-11 10:11 Ilpo Järvinen
2022-05-11 10:11 ` [PATCH 1/5] tty/termbits: remove #ifdef CMSPAR that is always defined Ilpo Järvinen
` (4 more replies)
0 siblings, 5 replies; 13+ messages in thread
From: Ilpo Järvinen @ 2022-05-11 10:11 UTC (permalink / raw)
To: linux-serial, Greg KH; +Cc: Ilpo Järvinen
A few simple cleanups that I've come across while playing with the
termbits.
Ilpo Järvinen (5):
tty/termbits: remove #ifdef CMSPAR that is always defined
tty/termbits: remove #ifdef BOTHER that is always defined
tty/termbits: remove #ifdef IBSHIFT that is always defined
serial: fsl_lpuart: Remove unnecessary clearing for CRTSCTS
serial: jsm: Use B0 instead of 0
drivers/char/pcmcia/synclink_cs.c | 2 --
drivers/tty/amiserial.c | 2 --
drivers/tty/mxser.c | 2 --
drivers/tty/serial/8250/8250_port.c | 2 --
drivers/tty/serial/fsl_lpuart.c | 8 +++-----
drivers/tty/serial/jsm/jsm_cls.c | 8 +-------
drivers/tty/serial/jsm/jsm_neo.c | 8 +-------
drivers/tty/serial/sunsu.c | 2 --
drivers/tty/tty_baudrate.c | 31 ++++++-----------------------
drivers/tty/tty_ioctl.c | 2 --
drivers/usb/class/cdc-acm.h | 8 --------
drivers/usb/serial/ark3116.c | 3 +--
drivers/usb/serial/whiteheat.c | 4 ----
13 files changed, 12 insertions(+), 70 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/5] tty/termbits: remove #ifdef CMSPAR that is always defined
2022-05-11 10:11 [PATCH 0/5] tty/serial termbits cleanups Ilpo Järvinen
@ 2022-05-11 10:11 ` Ilpo Järvinen
2022-05-13 7:01 ` Johan Hovold
2022-05-11 10:11 ` Ilpo Järvinen
` (3 subsequent siblings)
4 siblings, 1 reply; 13+ messages in thread
From: Ilpo Järvinen @ 2022-05-11 10:11 UTC (permalink / raw)
To: linux-serial, Greg KH, Arnd Bergmann, Jiri Slaby,
David S. Miller, Oliver Neukum, Johan Hovold, linux-kernel,
sparclinux, linux-usb
Cc: Ilpo Järvinen
CMSPAR is defined by all architectures.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/char/pcmcia/synclink_cs.c | 2 --
drivers/tty/amiserial.c | 2 --
drivers/tty/serial/8250/8250_port.c | 2 --
drivers/tty/serial/jsm/jsm_cls.c | 6 ------
drivers/tty/serial/jsm/jsm_neo.c | 6 ------
drivers/tty/serial/sunsu.c | 2 --
drivers/usb/class/cdc-acm.h | 8 --------
drivers/usb/serial/ark3116.c | 3 +--
drivers/usb/serial/whiteheat.c | 4 ----
9 files changed, 1 insertion(+), 34 deletions(-)
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 78baba55a8b5..c20f2cb784e8 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -1432,10 +1432,8 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty)
info->params.parity = ASYNC_PARITY_ODD;
else
info->params.parity = ASYNC_PARITY_EVEN;
-#ifdef CMSPAR
if (cflag & CMSPAR)
info->params.parity = ASYNC_PARITY_SPACE;
-#endif
}
/* calculate number of jiffies to transmit a full
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 533d02b38e02..afb2d373dd47 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -588,10 +588,8 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
}
if (!(cflag & PARODD))
cval |= UART_LCR_EPAR;
-#ifdef CMSPAR
if (cflag & CMSPAR)
cval |= UART_LCR_SPAR;
-#endif
/* Determine divisor based on baud rate */
baud = tty_get_baud_rate(tty);
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 5591f18f2ea9..78b6dedc43e6 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2620,10 +2620,8 @@ static unsigned char serial8250_compute_lcr(struct uart_8250_port *up,
}
if (!(c_cflag & PARODD))
cval |= UART_LCR_EPAR;
-#ifdef CMSPAR
if (c_cflag & CMSPAR)
cval |= UART_LCR_SPAR;
-#endif
return cval;
}
diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c
index 444f233ebd1f..046b624e5f71 100644
--- a/drivers/tty/serial/jsm/jsm_cls.c
+++ b/drivers/tty/serial/jsm/jsm_cls.c
@@ -723,14 +723,8 @@ static void cls_param(struct jsm_channel *ch)
if (!(ch->ch_c_cflag & PARODD))
lcr |= UART_LCR_EPAR;
- /*
- * Not all platforms support mark/space parity,
- * so this will hide behind an ifdef.
- */
-#ifdef CMSPAR
if (ch->ch_c_cflag & CMSPAR)
lcr |= UART_LCR_SPAR;
-#endif
if (ch->ch_c_cflag & CSTOPB)
lcr |= UART_LCR_STOP;
diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index 110696cdaa1d..0cf586c10688 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -997,14 +997,8 @@ static void neo_param(struct jsm_channel *ch)
if (!(ch->ch_c_cflag & PARODD))
lcr |= UART_LCR_EPAR;
- /*
- * Not all platforms support mark/space parity,
- * so this will hide behind an ifdef.
- */
-#ifdef CMSPAR
if (ch->ch_c_cflag & CMSPAR)
lcr |= UART_LCR_SPAR;
-#endif
if (ch->ch_c_cflag & CSTOPB)
lcr |= UART_LCR_STOP;
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index c31389114b86..fff50b5b82eb 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -798,10 +798,8 @@ sunsu_change_speed(struct uart_port *port, unsigned int cflag,
cval |= UART_LCR_PARITY;
if (!(cflag & PARODD))
cval |= UART_LCR_EPAR;
-#ifdef CMSPAR
if (cflag & CMSPAR)
cval |= UART_LCR_SPAR;
-#endif
/*
* Work around a bug in the Oxford Semiconductor 952 rev B
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
index 3aa7f0a3ad71..d26ecd15be60 100644
--- a/drivers/usb/class/cdc-acm.h
+++ b/drivers/usb/class/cdc-acm.h
@@ -7,14 +7,6 @@
*
*/
-/*
- * CMSPAR, some architectures can't have space and mark parity.
- */
-
-#ifndef CMSPAR
-#define CMSPAR 0
-#endif
-
/*
* Major and minor numbers.
*/
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index c0e4df87ff22..39eaa7b97c40 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -208,10 +208,9 @@ static void ark3116_set_termios(struct tty_struct *tty,
lcr |= UART_LCR_PARITY;
if (!(cflag & PARODD))
lcr |= UART_LCR_EPAR;
-#ifdef CMSPAR
if (cflag & CMSPAR)
lcr |= UART_LCR_SPAR;
-#endif
+
/* handshake control */
hcr = (cflag & CRTSCTS) ? 0x03 : 0x00;
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 06aad0d727dd..332fb92ae575 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -30,10 +30,6 @@
#include <linux/usb/ezusb.h>
#include "whiteheat.h" /* WhiteHEAT specific commands */
-#ifndef CMSPAR
-#define CMSPAR 0
-#endif
-
/*
* Version Information
*/
--
2.30.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/5] tty/termbits: remove #ifdef BOTHER that is always defined
2022-05-11 10:11 [PATCH 0/5] tty/serial termbits cleanups Ilpo Järvinen
@ 2022-05-11 10:11 ` Ilpo Järvinen
2022-05-11 10:11 ` Ilpo Järvinen
` (3 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: Ilpo Järvinen @ 2022-05-11 10:11 UTC (permalink / raw)
To: linux-serial, Greg KH, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
linux-arm-kernel, linux-kernel
Cc: Ilpo Järvinen
BOTHER is defined by all architectures.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/tty/mxser.c | 2 --
drivers/tty/tty_baudrate.c | 20 +++++---------------
drivers/tty/tty_ioctl.c | 2 --
3 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 6ebd3e4ed859..9ea7bd059d0f 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -528,7 +528,6 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)
outb(quot >> 8, info->ioaddr + UART_DLM); /* MS of divisor */
outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */
-#ifdef BOTHER
if (C_BAUD(tty) == BOTHER) {
quot = MXSER_BAUD_BASE % newspd;
quot *= 8;
@@ -540,7 +539,6 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)
mxser_set_must_enum_value(info->ioaddr, quot);
} else
-#endif
mxser_set_must_enum_value(info->ioaddr, 0);
return 0;
diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c
index d903e111dbcb..07bbbfee5635 100644
--- a/drivers/tty/tty_baudrate.c
+++ b/drivers/tty/tty_baudrate.c
@@ -61,11 +61,10 @@ speed_t tty_termios_baud_rate(struct ktermios *termios)
cbaud = termios->c_cflag & CBAUD;
-#ifdef BOTHER
/* Magic token for arbitrary speed via c_ispeed/c_ospeed */
if (cbaud == BOTHER)
return termios->c_ospeed;
-#endif
+
if (cbaud & CBAUDEX) {
cbaud &= ~CBAUDEX;
@@ -97,11 +96,11 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios)
if (cbaud == B0)
return tty_termios_baud_rate(termios);
-#ifdef BOTHER
+
/* Magic token for arbitrary speed via c_ispeed*/
if (cbaud == BOTHER)
return termios->c_ispeed;
-#endif
+
if (cbaud & CBAUDEX) {
cbaud &= ~CBAUDEX;
@@ -157,7 +156,6 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
if (((termios->c_cflag >> IBSHIFT) & CBAUD) != B0)
ibinput = 1; /* An input speed was specified */
#endif
-#ifdef BOTHER
/* If the user asked for a precise weird speed give a precise weird
* answer. If they asked for a Bfoo speed they may have problems
* digesting non-exact replies so fuzz a bit.
@@ -170,7 +168,7 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
}
if (((termios->c_cflag >> IBSHIFT) & CBAUD) == BOTHER)
iclose = 0;
-#endif
+
termios->c_cflag &= ~CBAUD;
#ifdef IBSHIFT
termios->c_cflag &= ~(CBAUD << IBSHIFT);
@@ -205,11 +203,7 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
}
} while (++i < n_baud_table);
- /*
- * If we found no match then use BOTHER if provided or warn
- * the user their platform maintainer needs to wake up if not.
- */
-#ifdef BOTHER
+ /* If we found no match then use BOTHER. */
if (ofound == -1)
termios->c_cflag |= BOTHER;
/* Set exact input bits only if the input and output differ or the
@@ -217,10 +211,6 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
*/
if (ifound == -1 && (ibaud != obaud || ibinput))
termios->c_cflag |= (BOTHER << IBSHIFT);
-#else
- if (ifound == -1 || ofound == -1)
- pr_warn_once("tty: Unable to return correct speed data as your architecture needs updating.\n");
-#endif
}
EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate);
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 63181925ec1a..adae687f654b 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -562,10 +562,8 @@ static int set_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb)
termios.c_cc[VKILL] = tmp.sg_kill;
set_sgflags(&termios, tmp.sg_flags);
/* Try and encode into Bfoo format */
-#ifdef BOTHER
tty_termios_encode_baud_rate(&termios, termios.c_ispeed,
termios.c_ospeed);
-#endif
up_write(&tty->termios_rwsem);
tty_set_termios(tty, &termios);
return 0;
--
2.30.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/5] tty/termbits: remove #ifdef BOTHER that is always defined
@ 2022-05-11 10:11 ` Ilpo Järvinen
0 siblings, 0 replies; 13+ messages in thread
From: Ilpo Järvinen @ 2022-05-11 10:11 UTC (permalink / raw)
To: linux-serial, Greg KH, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
linux-arm-kernel, linux-kernel
Cc: Ilpo Järvinen
BOTHER is defined by all architectures.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/tty/mxser.c | 2 --
drivers/tty/tty_baudrate.c | 20 +++++---------------
drivers/tty/tty_ioctl.c | 2 --
3 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 6ebd3e4ed859..9ea7bd059d0f 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -528,7 +528,6 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)
outb(quot >> 8, info->ioaddr + UART_DLM); /* MS of divisor */
outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */
-#ifdef BOTHER
if (C_BAUD(tty) == BOTHER) {
quot = MXSER_BAUD_BASE % newspd;
quot *= 8;
@@ -540,7 +539,6 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)
mxser_set_must_enum_value(info->ioaddr, quot);
} else
-#endif
mxser_set_must_enum_value(info->ioaddr, 0);
return 0;
diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c
index d903e111dbcb..07bbbfee5635 100644
--- a/drivers/tty/tty_baudrate.c
+++ b/drivers/tty/tty_baudrate.c
@@ -61,11 +61,10 @@ speed_t tty_termios_baud_rate(struct ktermios *termios)
cbaud = termios->c_cflag & CBAUD;
-#ifdef BOTHER
/* Magic token for arbitrary speed via c_ispeed/c_ospeed */
if (cbaud == BOTHER)
return termios->c_ospeed;
-#endif
+
if (cbaud & CBAUDEX) {
cbaud &= ~CBAUDEX;
@@ -97,11 +96,11 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios)
if (cbaud == B0)
return tty_termios_baud_rate(termios);
-#ifdef BOTHER
+
/* Magic token for arbitrary speed via c_ispeed*/
if (cbaud == BOTHER)
return termios->c_ispeed;
-#endif
+
if (cbaud & CBAUDEX) {
cbaud &= ~CBAUDEX;
@@ -157,7 +156,6 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
if (((termios->c_cflag >> IBSHIFT) & CBAUD) != B0)
ibinput = 1; /* An input speed was specified */
#endif
-#ifdef BOTHER
/* If the user asked for a precise weird speed give a precise weird
* answer. If they asked for a Bfoo speed they may have problems
* digesting non-exact replies so fuzz a bit.
@@ -170,7 +168,7 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
}
if (((termios->c_cflag >> IBSHIFT) & CBAUD) == BOTHER)
iclose = 0;
-#endif
+
termios->c_cflag &= ~CBAUD;
#ifdef IBSHIFT
termios->c_cflag &= ~(CBAUD << IBSHIFT);
@@ -205,11 +203,7 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
}
} while (++i < n_baud_table);
- /*
- * If we found no match then use BOTHER if provided or warn
- * the user their platform maintainer needs to wake up if not.
- */
-#ifdef BOTHER
+ /* If we found no match then use BOTHER. */
if (ofound == -1)
termios->c_cflag |= BOTHER;
/* Set exact input bits only if the input and output differ or the
@@ -217,10 +211,6 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
*/
if (ifound == -1 && (ibaud != obaud || ibinput))
termios->c_cflag |= (BOTHER << IBSHIFT);
-#else
- if (ifound == -1 || ofound == -1)
- pr_warn_once("tty: Unable to return correct speed data as your architecture needs updating.\n");
-#endif
}
EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate);
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 63181925ec1a..adae687f654b 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -562,10 +562,8 @@ static int set_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb)
termios.c_cc[VKILL] = tmp.sg_kill;
set_sgflags(&termios, tmp.sg_flags);
/* Try and encode into Bfoo format */
-#ifdef BOTHER
tty_termios_encode_baud_rate(&termios, termios.c_ispeed,
termios.c_ospeed);
-#endif
up_write(&tty->termios_rwsem);
tty_set_termios(tty, &termios);
return 0;
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/5] tty/termbits: remove #ifdef IBSHIFT that is always defined
2022-05-11 10:11 [PATCH 0/5] tty/serial termbits cleanups Ilpo Järvinen
2022-05-11 10:11 ` [PATCH 1/5] tty/termbits: remove #ifdef CMSPAR that is always defined Ilpo Järvinen
2022-05-11 10:11 ` Ilpo Järvinen
@ 2022-05-11 10:11 ` Ilpo Järvinen
2022-05-13 7:10 ` Johan Hovold
2022-05-11 10:11 ` [PATCH 4/5] serial: fsl_lpuart: Remove unnecessary clearing for CRTSCTS Ilpo Järvinen
2022-05-11 10:11 ` [PATCH 5/5] serial: jsm: Use B0 instead of 0 Ilpo Järvinen
4 siblings, 1 reply; 13+ messages in thread
From: Ilpo Järvinen @ 2022-05-11 10:11 UTC (permalink / raw)
To: linux-serial, Greg KH, Jiri Slaby, linux-kernel; +Cc: Ilpo Järvinen
IBSHIFT is defined by all architectures.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/tty/tty_baudrate.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c
index 07bbbfee5635..d10318956c97 100644
--- a/drivers/tty/tty_baudrate.c
+++ b/drivers/tty/tty_baudrate.c
@@ -91,7 +91,6 @@ EXPORT_SYMBOL(tty_termios_baud_rate);
speed_t tty_termios_input_baud_rate(struct ktermios *termios)
{
-#ifdef IBSHIFT
unsigned int cbaud = (termios->c_cflag >> IBSHIFT) & CBAUD;
if (cbaud == B0)
@@ -110,9 +109,6 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios)
cbaud += 15;
}
return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
-#else /* IBSHIFT */
- return tty_termios_baud_rate(termios);
-#endif /* IBSHIFT */
}
EXPORT_SYMBOL(tty_termios_input_baud_rate);
@@ -152,10 +148,9 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
termios->c_ispeed = ibaud;
termios->c_ospeed = obaud;
-#ifdef IBSHIFT
if (((termios->c_cflag >> IBSHIFT) & CBAUD) != B0)
ibinput = 1; /* An input speed was specified */
-#endif
+
/* If the user asked for a precise weird speed give a precise weird
* answer. If they asked for a Bfoo speed they may have problems
* digesting non-exact replies so fuzz a bit.
@@ -170,9 +165,7 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
iclose = 0;
termios->c_cflag &= ~CBAUD;
-#ifdef IBSHIFT
termios->c_cflag &= ~(CBAUD << IBSHIFT);
-#endif
/*
* Our goal is to find a close match to the standard baud rate
@@ -194,12 +187,10 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
*/
if (ofound == i && !ibinput)
ifound = i;
-#ifdef IBSHIFT
else {
ifound = i;
termios->c_cflag |= (baud_bits[i] << IBSHIFT);
}
-#endif
}
} while (++i < n_baud_table);
--
2.30.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/5] serial: fsl_lpuart: Remove unnecessary clearing for CRTSCTS
2022-05-11 10:11 [PATCH 0/5] tty/serial termbits cleanups Ilpo Järvinen
` (2 preceding siblings ...)
2022-05-11 10:11 ` [PATCH 3/5] tty/termbits: remove #ifdef IBSHIFT " Ilpo Järvinen
@ 2022-05-11 10:11 ` Ilpo Järvinen
2022-05-13 7:11 ` Johan Hovold
2022-05-11 10:11 ` [PATCH 5/5] serial: jsm: Use B0 instead of 0 Ilpo Järvinen
4 siblings, 1 reply; 13+ messages in thread
From: Ilpo Järvinen @ 2022-05-11 10:11 UTC (permalink / raw)
To: linux-serial, Greg KH, Jiri Slaby, linux-kernel; +Cc: Ilpo Järvinen
if (termios->c_cflag & CRTSCTS) guarantees that CRTSCTS is not ever set
in the else block so clearing it is unnecessary.
While at it, remove also one pair of extra parenthesis.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/tty/serial/fsl_lpuart.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 75b3c36c13bc..d3bb46cb7185 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -2110,12 +2110,10 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
if (sport->port.rs485.flags & SER_RS485_ENABLED)
termios->c_cflag &= ~CRTSCTS;
- if (termios->c_cflag & CRTSCTS) {
- modem |= (UARTMODIR_RXRTSE | UARTMODIR_TXCTSE);
- } else {
- termios->c_cflag &= ~CRTSCTS;
+ if (termios->c_cflag & CRTSCTS)
+ modem |= UARTMODIR_RXRTSE | UARTMODIR_TXCTSE;
+ else
modem &= ~(UARTMODIR_RXRTSE | UARTMODIR_TXCTSE);
- }
if (termios->c_cflag & CSTOPB)
bd |= UARTBAUD_SBNS;
--
2.30.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/5] serial: jsm: Use B0 instead of 0
2022-05-11 10:11 [PATCH 0/5] tty/serial termbits cleanups Ilpo Järvinen
` (3 preceding siblings ...)
2022-05-11 10:11 ` [PATCH 4/5] serial: fsl_lpuart: Remove unnecessary clearing for CRTSCTS Ilpo Järvinen
@ 2022-05-11 10:11 ` Ilpo Järvinen
2022-05-13 7:14 ` Johan Hovold
4 siblings, 1 reply; 13+ messages in thread
From: Ilpo Järvinen @ 2022-05-11 10:11 UTC (permalink / raw)
To: linux-serial, Greg KH, Jiri Slaby, linux-kernel; +Cc: Ilpo Järvinen
Use B0 to check zero baudrate rather than literal 0.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/tty/serial/jsm/jsm_cls.c | 2 +-
drivers/tty/serial/jsm/jsm_neo.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c
index 046b624e5f71..ca05e84a7c90 100644
--- a/drivers/tty/serial/jsm/jsm_cls.c
+++ b/drivers/tty/serial/jsm/jsm_cls.c
@@ -689,7 +689,7 @@ static void cls_param(struct jsm_channel *ch)
/*
* If baud rate is zero, flush queues, and set mval to drop DTR.
*/
- if ((ch->ch_c_cflag & (CBAUD)) == 0) {
+ if ((ch->ch_c_cflag & (CBAUD)) == B0) {
ch->ch_r_head = 0;
ch->ch_r_tail = 0;
ch->ch_e_head = 0;
diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index 0cf586c10688..95bebf2a73d3 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -938,7 +938,7 @@ static void neo_param(struct jsm_channel *ch)
/*
* If baud rate is zero, flush queues, and set mval to drop DTR.
*/
- if ((ch->ch_c_cflag & (CBAUD)) == 0) {
+ if ((ch->ch_c_cflag & (CBAUD)) == B0) {
ch->ch_r_head = ch->ch_r_tail = 0;
ch->ch_e_head = ch->ch_e_tail = 0;
--
2.30.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/5] tty/termbits: remove #ifdef CMSPAR that is always defined
2022-05-11 10:11 ` [PATCH 1/5] tty/termbits: remove #ifdef CMSPAR that is always defined Ilpo Järvinen
@ 2022-05-13 7:01 ` Johan Hovold
0 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-05-13 7:01 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: linux-serial, Greg KH, Arnd Bergmann, Jiri Slaby,
David S. Miller, Oliver Neukum, linux-kernel, sparclinux,
linux-usb
On Wed, May 11, 2022 at 01:11:35PM +0300, Ilpo Järvinen wrote:
> CMSPAR is defined by all architectures.
For the sake of reviewers please say something about when this changed.
Also no need to be so verbose in your Subjects
tty: remove CMSPAR ifdefs
works just fine and is more in line with the prefix typically used for
this subsystem.
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/char/pcmcia/synclink_cs.c | 2 --
> drivers/tty/amiserial.c | 2 --
> drivers/tty/serial/8250/8250_port.c | 2 --
> drivers/tty/serial/jsm/jsm_cls.c | 6 ------
> drivers/tty/serial/jsm/jsm_neo.c | 6 ------
> drivers/tty/serial/sunsu.c | 2 --
> drivers/usb/class/cdc-acm.h | 8 --------
> drivers/usb/serial/ark3116.c | 3 +--
> drivers/usb/serial/whiteheat.c | 4 ----
> 9 files changed, 1 insertion(+), 34 deletions(-)
The change itself looks good otherwise.
Reviewed-by: Johan Hovold <johan@kernel.org>
> diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
> index 78baba55a8b5..c20f2cb784e8 100644
> --- a/drivers/char/pcmcia/synclink_cs.c
> +++ b/drivers/char/pcmcia/synclink_cs.c
> @@ -1432,10 +1432,8 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty)
> info->params.parity = ASYNC_PARITY_ODD;
> else
> info->params.parity = ASYNC_PARITY_EVEN;
> -#ifdef CMSPAR
> if (cflag & CMSPAR)
> info->params.parity = ASYNC_PARITY_SPACE;
> -#endif
> }
>
> /* calculate number of jiffies to transmit a full
> diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
> index 533d02b38e02..afb2d373dd47 100644
> --- a/drivers/tty/amiserial.c
> +++ b/drivers/tty/amiserial.c
> @@ -588,10 +588,8 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
> }
> if (!(cflag & PARODD))
> cval |= UART_LCR_EPAR;
> -#ifdef CMSPAR
> if (cflag & CMSPAR)
> cval |= UART_LCR_SPAR;
> -#endif
>
> /* Determine divisor based on baud rate */
> baud = tty_get_baud_rate(tty);
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 5591f18f2ea9..78b6dedc43e6 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -2620,10 +2620,8 @@ static unsigned char serial8250_compute_lcr(struct uart_8250_port *up,
> }
> if (!(c_cflag & PARODD))
> cval |= UART_LCR_EPAR;
> -#ifdef CMSPAR
> if (c_cflag & CMSPAR)
> cval |= UART_LCR_SPAR;
> -#endif
>
> return cval;
> }
> diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c
> index 444f233ebd1f..046b624e5f71 100644
> --- a/drivers/tty/serial/jsm/jsm_cls.c
> +++ b/drivers/tty/serial/jsm/jsm_cls.c
> @@ -723,14 +723,8 @@ static void cls_param(struct jsm_channel *ch)
> if (!(ch->ch_c_cflag & PARODD))
> lcr |= UART_LCR_EPAR;
>
> - /*
> - * Not all platforms support mark/space parity,
> - * so this will hide behind an ifdef.
> - */
> -#ifdef CMSPAR
> if (ch->ch_c_cflag & CMSPAR)
> lcr |= UART_LCR_SPAR;
> -#endif
>
> if (ch->ch_c_cflag & CSTOPB)
> lcr |= UART_LCR_STOP;
> diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
> index 110696cdaa1d..0cf586c10688 100644
> --- a/drivers/tty/serial/jsm/jsm_neo.c
> +++ b/drivers/tty/serial/jsm/jsm_neo.c
> @@ -997,14 +997,8 @@ static void neo_param(struct jsm_channel *ch)
> if (!(ch->ch_c_cflag & PARODD))
> lcr |= UART_LCR_EPAR;
>
> - /*
> - * Not all platforms support mark/space parity,
> - * so this will hide behind an ifdef.
> - */
> -#ifdef CMSPAR
> if (ch->ch_c_cflag & CMSPAR)
> lcr |= UART_LCR_SPAR;
> -#endif
>
> if (ch->ch_c_cflag & CSTOPB)
> lcr |= UART_LCR_STOP;
> diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
> index c31389114b86..fff50b5b82eb 100644
> --- a/drivers/tty/serial/sunsu.c
> +++ b/drivers/tty/serial/sunsu.c
> @@ -798,10 +798,8 @@ sunsu_change_speed(struct uart_port *port, unsigned int cflag,
> cval |= UART_LCR_PARITY;
> if (!(cflag & PARODD))
> cval |= UART_LCR_EPAR;
> -#ifdef CMSPAR
> if (cflag & CMSPAR)
> cval |= UART_LCR_SPAR;
> -#endif
>
> /*
> * Work around a bug in the Oxford Semiconductor 952 rev B
> diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
> index 3aa7f0a3ad71..d26ecd15be60 100644
> --- a/drivers/usb/class/cdc-acm.h
> +++ b/drivers/usb/class/cdc-acm.h
> @@ -7,14 +7,6 @@
> *
> */
>
> -/*
> - * CMSPAR, some architectures can't have space and mark parity.
> - */
> -
> -#ifndef CMSPAR
> -#define CMSPAR 0
> -#endif
> -
> /*
> * Major and minor numbers.
> */
> diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
> index c0e4df87ff22..39eaa7b97c40 100644
> --- a/drivers/usb/serial/ark3116.c
> +++ b/drivers/usb/serial/ark3116.c
> @@ -208,10 +208,9 @@ static void ark3116_set_termios(struct tty_struct *tty,
> lcr |= UART_LCR_PARITY;
> if (!(cflag & PARODD))
> lcr |= UART_LCR_EPAR;
> -#ifdef CMSPAR
> if (cflag & CMSPAR)
> lcr |= UART_LCR_SPAR;
> -#endif
> +
> /* handshake control */
> hcr = (cflag & CRTSCTS) ? 0x03 : 0x00;
>
> diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
> index 06aad0d727dd..332fb92ae575 100644
> --- a/drivers/usb/serial/whiteheat.c
> +++ b/drivers/usb/serial/whiteheat.c
> @@ -30,10 +30,6 @@
> #include <linux/usb/ezusb.h>
> #include "whiteheat.h" /* WhiteHEAT specific commands */
>
> -#ifndef CMSPAR
> -#define CMSPAR 0
> -#endif
> -
> /*
> * Version Information
> */
Johan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/5] tty/termbits: remove #ifdef BOTHER that is always defined
2022-05-11 10:11 ` Ilpo Järvinen
@ 2022-05-13 7:07 ` Johan Hovold
-1 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-05-13 7:07 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: linux-serial, Greg KH, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
linux-arm-kernel, linux-kernel
On Wed, May 11, 2022 at 01:11:36PM +0300, Ilpo Järvinen wrote:
> BOTHER is defined by all architectures.
This changed quite recently so please mention the commit in question.
No need for the verbose Subject here either.
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/tty/mxser.c | 2 --
> drivers/tty/tty_baudrate.c | 20 +++++---------------
> drivers/tty/tty_ioctl.c | 2 --
> 3 files changed, 5 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
> index 6ebd3e4ed859..9ea7bd059d0f 100644
> --- a/drivers/tty/mxser.c
> +++ b/drivers/tty/mxser.c
> @@ -528,7 +528,6 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)
> outb(quot >> 8, info->ioaddr + UART_DLM); /* MS of divisor */
> outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */
>
> -#ifdef BOTHER
> if (C_BAUD(tty) == BOTHER) {
> quot = MXSER_BAUD_BASE % newspd;
> quot *= 8;
> @@ -540,7 +539,6 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)
>
> mxser_set_must_enum_value(info->ioaddr, quot);
> } else
> -#endif
> mxser_set_must_enum_value(info->ioaddr, 0);
When removing the ifdef, please add the missing bracket to the else
branch as per the coding standard.
Johan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/5] tty/termbits: remove #ifdef BOTHER that is always defined
@ 2022-05-13 7:07 ` Johan Hovold
0 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-05-13 7:07 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: linux-serial, Greg KH, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
linux-arm-kernel, linux-kernel
On Wed, May 11, 2022 at 01:11:36PM +0300, Ilpo Järvinen wrote:
> BOTHER is defined by all architectures.
This changed quite recently so please mention the commit in question.
No need for the verbose Subject here either.
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/tty/mxser.c | 2 --
> drivers/tty/tty_baudrate.c | 20 +++++---------------
> drivers/tty/tty_ioctl.c | 2 --
> 3 files changed, 5 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
> index 6ebd3e4ed859..9ea7bd059d0f 100644
> --- a/drivers/tty/mxser.c
> +++ b/drivers/tty/mxser.c
> @@ -528,7 +528,6 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)
> outb(quot >> 8, info->ioaddr + UART_DLM); /* MS of divisor */
> outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */
>
> -#ifdef BOTHER
> if (C_BAUD(tty) == BOTHER) {
> quot = MXSER_BAUD_BASE % newspd;
> quot *= 8;
> @@ -540,7 +539,6 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)
>
> mxser_set_must_enum_value(info->ioaddr, quot);
> } else
> -#endif
> mxser_set_must_enum_value(info->ioaddr, 0);
When removing the ifdef, please add the missing bracket to the else
branch as per the coding standard.
Johan
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/5] tty/termbits: remove #ifdef IBSHIFT that is always defined
2022-05-11 10:11 ` [PATCH 3/5] tty/termbits: remove #ifdef IBSHIFT " Ilpo Järvinen
@ 2022-05-13 7:10 ` Johan Hovold
0 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-05-13 7:10 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: linux-serial, Greg KH, Jiri Slaby, linux-kernel
On Wed, May 11, 2022 at 01:11:37PM +0300, Ilpo Järvinen wrote:
> IBSHIFT is defined by all architectures.
This also changed recently so mention the commit in question.
Subject is overly verbose here too.
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/tty/tty_baudrate.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c
> index 07bbbfee5635..d10318956c97 100644
> --- a/drivers/tty/tty_baudrate.c
> +++ b/drivers/tty/tty_baudrate.c
> @@ -194,12 +187,10 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
> */
> if (ofound == i && !ibinput)
> ifound = i;
> -#ifdef IBSHIFT
> else {
> ifound = i;
> termios->c_cflag |= (baud_bits[i] << IBSHIFT);
> }
> -#endif
Please add the missing brackets to the if branch when removing the ifdef.
Johan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/5] serial: fsl_lpuart: Remove unnecessary clearing for CRTSCTS
2022-05-11 10:11 ` [PATCH 4/5] serial: fsl_lpuart: Remove unnecessary clearing for CRTSCTS Ilpo Järvinen
@ 2022-05-13 7:11 ` Johan Hovold
0 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-05-13 7:11 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: linux-serial, Greg KH, Jiri Slaby, linux-kernel
On Wed, May 11, 2022 at 01:11:38PM +0300, Ilpo Järvinen wrote:
> if (termios->c_cflag & CRTSCTS) guarantees that CRTSCTS is not ever set
> in the else block so clearing it is unnecessary.
>
> While at it, remove also one pair of extra parenthesis.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 5/5] serial: jsm: Use B0 instead of 0
2022-05-11 10:11 ` [PATCH 5/5] serial: jsm: Use B0 instead of 0 Ilpo Järvinen
@ 2022-05-13 7:14 ` Johan Hovold
0 siblings, 0 replies; 13+ messages in thread
From: Johan Hovold @ 2022-05-13 7:14 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: linux-serial, Greg KH, Jiri Slaby, linux-kernel
On Wed, May 11, 2022 at 01:11:39PM +0300, Ilpo Järvinen wrote:
> Use B0 to check zero baudrate rather than literal 0.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/tty/serial/jsm/jsm_cls.c | 2 +-
> drivers/tty/serial/jsm/jsm_neo.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c
> index 046b624e5f71..ca05e84a7c90 100644
> --- a/drivers/tty/serial/jsm/jsm_cls.c
> +++ b/drivers/tty/serial/jsm/jsm_cls.c
> @@ -689,7 +689,7 @@ static void cls_param(struct jsm_channel *ch)
> /*
> * If baud rate is zero, flush queues, and set mval to drop DTR.
> */
> - if ((ch->ch_c_cflag & (CBAUD)) == 0) {
> + if ((ch->ch_c_cflag & (CBAUD)) == B0) {
Sure, why not. How about dropping the unnecessary parenthesis around
CBAUD while at it?
Johan
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-05-13 7:14 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 10:11 [PATCH 0/5] tty/serial termbits cleanups Ilpo Järvinen
2022-05-11 10:11 ` [PATCH 1/5] tty/termbits: remove #ifdef CMSPAR that is always defined Ilpo Järvinen
2022-05-13 7:01 ` Johan Hovold
2022-05-11 10:11 ` [PATCH 2/5] tty/termbits: remove #ifdef BOTHER " Ilpo Järvinen
2022-05-11 10:11 ` Ilpo Järvinen
2022-05-13 7:07 ` Johan Hovold
2022-05-13 7:07 ` Johan Hovold
2022-05-11 10:11 ` [PATCH 3/5] tty/termbits: remove #ifdef IBSHIFT " Ilpo Järvinen
2022-05-13 7:10 ` Johan Hovold
2022-05-11 10:11 ` [PATCH 4/5] serial: fsl_lpuart: Remove unnecessary clearing for CRTSCTS Ilpo Järvinen
2022-05-13 7:11 ` Johan Hovold
2022-05-11 10:11 ` [PATCH 5/5] serial: jsm: Use B0 instead of 0 Ilpo Järvinen
2022-05-13 7:14 ` Johan Hovold
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.