Commit 80c95574 authored by Johan Hovold's avatar Johan Hovold Committed by Stefan Bader

USB: serial: whiteheat: fix line-speed endianness

BugLink: https://bugs.launchpad.net/bugs/1851549

commit 84968291 upstream.

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: default avatarJohan Hovold <johan@kernel.org>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191029102354.2733-3-johan@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 26c3416b
...@@ -681,6 +681,7 @@ static void firm_setup_port(struct tty_struct *tty) ...@@ -681,6 +681,7 @@ static void firm_setup_port(struct tty_struct *tty)
struct device *dev = &port->dev; struct device *dev = &port->dev;
struct whiteheat_port_settings port_settings; struct whiteheat_port_settings port_settings;
unsigned int cflag = tty->termios.c_cflag; unsigned int cflag = tty->termios.c_cflag;
speed_t baud;
port_settings.port = port->port_number + 1; port_settings.port = port->port_number + 1;
...@@ -741,11 +742,13 @@ static void firm_setup_port(struct tty_struct *tty) ...@@ -741,11 +742,13 @@ static void firm_setup_port(struct tty_struct *tty)
dev_dbg(dev, "%s - XON = %2x, XOFF = %2x\n", __func__, port_settings.xon, port_settings.xoff); dev_dbg(dev, "%s - XON = %2x, XOFF = %2x\n", __func__, port_settings.xon, port_settings.xoff);
/* get the baud rate wanted */ /* get the baud rate wanted */
port_settings.baud = tty_get_baud_rate(tty); baud = tty_get_baud_rate(tty);
dev_dbg(dev, "%s - baud rate = %d\n", __func__, port_settings.baud); port_settings.baud = cpu_to_le32(baud);
dev_dbg(dev, "%s - baud rate = %u\n", __func__, baud);
/* fixme: should set validated settings */ /* fixme: should set validated settings */
tty_encode_baud_rate(tty, port_settings.baud, port_settings.baud); tty_encode_baud_rate(tty, baud, baud);
/* handle any settings that aren't specified in the tty structure */ /* handle any settings that aren't specified in the tty structure */
port_settings.lloop = 0; port_settings.lloop = 0;
......
...@@ -91,7 +91,7 @@ struct whiteheat_simple { ...@@ -91,7 +91,7 @@ struct whiteheat_simple {
struct whiteheat_port_settings { struct whiteheat_port_settings {
__u8 port; /* port number (1 to N) */ __u8 port; /* port number (1 to N) */
__u32 baud; /* any value 7 - 460800, firmware calculates __le32 baud; /* any value 7 - 460800, firmware calculates
best fit; arrives little endian */ best fit; arrives little endian */
__u8 bits; /* 5, 6, 7, or 8 */ __u8 bits; /* 5, 6, 7, or 8 */
__u8 stop; /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */ __u8 stop; /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment