Skip to contentSkip to conversation

tty: baudrate: Synchronise baud_table[] and baud_bits[]

PATCH Superseded Andy Shevchenko 2 participants 5 messages Jan 14, 2020 – Jan 15, 2020 TTY layer and serial drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: baudrate: Synchronise baud_table[] and baud_bits[]

Synchronize baud rate tables for better readability. No functional change intended.

---
 drivers/tty/tty_baudrate.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)
drivers/tty/tty_baudrate.c +9 -15
index f438eaa68246..eb6b07f079c8 100644
@@ -17,8 +17,8 @@
  * include/asm/termbits.h file.
  */
 static const speed_t baud_table[] = {
-	0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
-	9600, 19200, 38400, 57600, 115200, 230400, 460800,
+	0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400,
+	4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800,
 #ifdef __sparc__
 	76800, 153600, 307200, 614400, 921600
 #else
@@ -27,22 +27,16 @@ static const speed_t baud_table[] = {
 #endif
 };
 
-#ifndef __sparc__
 static const tcflag_t baud_bits[] = {
-	B0, B50, B75, B110, B134, B150, B200, B300, B600,
-	B1200, B1800, B2400, B4800, B9600, B19200, B38400,
-	B57600, B115200, B230400, B460800, B500000, B576000,
-	B921600, B1000000, B1152000, B1500000, B2000000, B2500000,
-	B3000000, B3500000, B4000000
-};
+	B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400,
+	B4800, B9600, B19200, B38400, B57600, B115200, B230400, B460800,
+#ifdef __sparc__
+	B76800, B153600, B307200, B614400, B921600
 #else
-static const tcflag_t baud_bits[] = {
-	B0, B50, B75, B110, B134, B150, B200, B300, B600,
-	B1200, B1800, B2400, B4800, B9600, B19200, B38400,
-	B57600, B115200, B230400, B460800, B76800, B153600,
-	B307200, B614400, B921600
-};
+	B500000, B576000, B921600, B1000000, B1152000, B1500000, B2000000,
+	B2500000, B3000000, B3500000, B4000000
 #endif
+};
 
 static int n_baud_table = ARRAY_SIZE(baud_table);
 
Signature · 1 line
2.24.1
#1 lore raw
Quoted 1 line · Andy Shevchenko

Synchronize baud rate tables for better readability.

"Synchronize"? With what? Why? I'm all for cleaning up code, but this just seems totally gratuitous.

We have whole serial drivers with _THOUSANDS_ of checkpatch issues, and this is bothering you? :)

greg k-h

#2 lore raw
Quoted 4 lines · Greg Kroah-Hartman
Quoted 1 line · Andy Shevchenko

Synchronize baud rate tables for better readability.

"Synchronize"? With what?

Between each other. This SPARC thingy makes it's harder to follow.

Quoted 2 lines

Why? I'm all for cleaning up code, but this
just seems totally gratuitous.

Btw, while doing it I found that SPARC actually supports more baud rates than defined in those arrays. Without this patch I would not (easily) notice that. Should I also attach another patch and resend?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 7 lines · Andy Shevchenko
Quoted 4 lines · Greg Kroah-Hartman
Quoted 1 line · Andy Shevchenko

Synchronize baud rate tables for better readability.

"Synchronize"? With what?

Between each other. This SPARC thingy makes it's harder to follow.

Ok, be more specific please, a better changelog is key here.

Quoted 6 lines
Quoted 2 lines

Why? I'm all for cleaning up code, but this
just seems totally gratuitous.

Btw, while doing it I found that SPARC actually supports more baud rates than defined in those arrays. Without this patch I would not (easily) notice that. Should I also attach another patch and resend?

Yes, that might justify this patch's acceptance :)

thanks,

greg k-h

#4 lore raw
Quoted 11 lines · Greg Kroah-Hartman
Quoted 7 lines · Andy Shevchenko
Quoted 4 lines · Greg Kroah-Hartman
Quoted 1 line · Andy Shevchenko

Synchronize baud rate tables for better readability.

"Synchronize"? With what?

Between each other. This SPARC thingy makes it's harder to follow.

Ok, be more specific please, a better changelog is key here.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Why? I'm all for cleaning up code, but this
just seems totally gratuitous.

Btw, while doing it I found that SPARC actually supports more baud rates than defined in those arrays. Without this patch I would not (easily) notice that. Should I also attach another patch and resend?

Yes, that might justify this patch's acceptance :)

Done in v2.

Signature · 2 lines
With Best Regards,
Andy Shevchenko