summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2019-10-29 06:23:54 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-30 05:06:32 -0400
commit84968291d7924261c6a0624b9a72f952398e258b (patch)
treee765dcb1fc412a2f11d334c366fddbd48e2e6812
parent1251dab9e0a2c4d0d2d48370ba5baa095a5e8774 (diff)
USB: serial: whiteheat: fix line-speed endianness
Add missing endianness conversion when setting the line speed so that this driver might work also on big-endian machines. Also use an unsigned format specifier in the corresponding debug message. Signed-off-by: Johan Hovold <johan@kernel.org> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20191029102354.2733-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/whiteheat.c9
-rw-r--r--drivers/usb/serial/whiteheat.h2
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 76cabcb30d21..ca3bd58f2025 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -636,6 +636,7 @@ static void firm_setup_port(struct tty_struct *tty)
636 struct device *dev = &port->dev; 636 struct device *dev = &port->dev;
637 struct whiteheat_port_settings port_settings; 637 struct whiteheat_port_settings port_settings;
638 unsigned int cflag = tty->termios.c_cflag; 638 unsigned int cflag = tty->termios.c_cflag;
639 speed_t baud;
639 640
640 port_settings.port = port->port_number + 1; 641 port_settings.port = port->port_number + 1;
641 642
@@ -696,11 +697,13 @@ static void firm_setup_port(struct tty_struct *tty)
696 dev_dbg(dev, "%s - XON = %2x, XOFF = %2x\n", __func__, port_settings.xon, port_settings.xoff); 697 dev_dbg(dev, "%s - XON = %2x, XOFF = %2x\n", __func__, port_settings.xon, port_settings.xoff);
697 698
698 /* get the baud rate wanted */ 699 /* get the baud rate wanted */
699 port_settings.baud = tty_get_baud_rate(tty); 700 baud = tty_get_baud_rate(tty);
700 dev_dbg(dev, "%s - baud rate = %d\n", __func__, port_settings.baud); 701 port_settings.baud = cpu_to_le32(baud);
702 dev_dbg(dev, "%s - baud rate = %u\n", __func__, baud);
701 703
702 /* fixme: should set validated settings */ 704 /* fixme: should set validated settings */
703 tty_encode_baud_rate(tty, port_settings.baud, port_settings.baud); 705 tty_encode_baud_rate(tty, baud, baud);
706
704 /* handle any settings that aren't specified in the tty structure */ 707 /* handle any settings that aren't specified in the tty structure */
705 port_settings.lloop = 0; 708 port_settings.lloop = 0;
706 709
diff --git a/drivers/usb/serial/whiteheat.h b/drivers/usb/serial/whiteheat.h
index 00398149cd8d..269e727a92f9 100644
--- a/drivers/usb/serial/whiteheat.h
+++ b/drivers/usb/serial/whiteheat.h
@@ -87,7 +87,7 @@ struct whiteheat_simple {
87 87
88struct whiteheat_port_settings { 88struct whiteheat_port_settings {
89 __u8 port; /* port number (1 to N) */ 89 __u8 port; /* port number (1 to N) */
90 __u32 baud; /* any value 7 - 460800, firmware calculates 90 __le32 baud; /* any value 7 - 460800, firmware calculates
91 best fit; arrives little endian */ 91 best fit; arrives little endian */
92 __u8 bits; /* 5, 6, 7, or 8 */ 92 __u8 bits; /* 5, 6, 7, or 8 */
93 __u8 stop; /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */ 93 __u8 stop; /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */