Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4483909ybx; Mon, 4 Nov 2019 14:11:21 -0800 (PST) X-Google-Smtp-Source: APXvYqwcJotCCsWcaQm28q7mbm/tE5HC8lsd0Cl97LazcAFx4ELe97E4ulKXq85xUJPc0Sx2Q6Ce X-Received: by 2002:a05:6402:339:: with SMTP id q25mr11689871edw.80.1572905481436; Mon, 04 Nov 2019 14:11:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572905481; cv=none; d=google.com; s=arc-20160816; b=cWsd3st6axvwNY9/xdE55eI3Lgjuq3DQ5w9T6NwxyHb71Q8z2pQU+Sory0QxV44EOr EaIgLexMFoVGK+Z9Xn7+Xr+cq9zcWFi0ALssDAZLG/vLCuC6ULfXZNKzjtyDQX/1NwSf rbO27wPnwTZ2UR2PAdzGZ8alvJOzx8BRLsaWIl7ZH96QtKyY9/4nk2OsUsY5uWk3h3zh 8EpSxCYGchQqV7M01nWolG4yM28+RtJRJdho5AEtzCy2g5/62KeHHoypVlqwtuNbOOw3 9tlWdly8KIuUs2rCLga5AKUPcb79d6/1jdr6qvbSU5g4yKUmIOlAohIAqmw51r67JsNQ f9wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5Hier5QgIBtjDD3GDraWRaWh7BvV6kq+Gz8//ahlvqs=; b=juhHxGXN/VXoDYvcTBVQvDLVklJdnnDoONLrvRjWAmEkCkb5avOO1UK5BQIBt/E8hA 4ZqK+xRGNN+2i1YZmhlRCvprlkX5ykiAB9fKDC620zmE6VxxpLhMUpWTnNqpEm64PFAj bY6KgbvET6+DuUacGbuaRiH11MjaFS0XdfLmQ07Zhp9Gah6oRuaJ/3fKQJpuzSwE6FI9 9okjtl4xx1bEJHxZI8ttRvwUWKjAZsNPEfjgzfKH1ixOZVRzGXT7E+pV2xkIrcofjiFp LCM/qHyU5lr+/b0yGH6GNBHxjIL+0feGi43+2E/ApC5GF6hm/pKvmWEdOL1JOt0hA154 6CUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zgygy+0w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o22si4971054eja.122.2019.11.04.14.10.58; Mon, 04 Nov 2019 14:11:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zgygy+0w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390328AbfKDWJB (ORCPT + 99 others); Mon, 4 Nov 2019 17:09:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:41964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388158AbfKDWI7 (ORCPT ); Mon, 4 Nov 2019 17:08:59 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 513DD214D8; Mon, 4 Nov 2019 22:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572905339; bh=VQ2RHPzTeIuQcWi/Zg/CjUHQV9IT6SYsRvS4+5Ue/ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zgygy+0wfMKSNO0IEeo8hL4ywaG9CBCf+Kq3yMdxE1lWgYX0+Heqd9zlC/SW6v34v s7R2jaR0DYjxhDpLzZyPSYrcvDU+6TyRg9Js84hPq8qdHLnOrTGRc1U4OZH/cXQ5Zm npM9dwZnoHSDEj8xauYFrlnDZN5xdzCTlqRNkoLs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 5.3 111/163] USB: serial: whiteheat: fix line-speed endianness Date: Mon, 4 Nov 2019 22:45:01 +0100 Message-Id: <20191104212148.291595521@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212140.046021995@linuxfoundation.org> References: <20191104212140.046021995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit 84968291d7924261c6a0624b9a72f952398e258b 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: Johan Hovold Cc: stable Link: https://lore.kernel.org/r/20191029102354.2733-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/whiteheat.c | 9 ++++++--- drivers/usb/serial/whiteheat.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -636,6 +636,7 @@ static void firm_setup_port(struct tty_s struct device *dev = &port->dev; struct whiteheat_port_settings port_settings; unsigned int cflag = tty->termios.c_cflag; + speed_t baud; port_settings.port = port->port_number + 1; @@ -696,11 +697,13 @@ static void firm_setup_port(struct tty_s dev_dbg(dev, "%s - XON = %2x, XOFF = %2x\n", __func__, port_settings.xon, port_settings.xoff); /* get the baud rate wanted */ - port_settings.baud = tty_get_baud_rate(tty); - dev_dbg(dev, "%s - baud rate = %d\n", __func__, port_settings.baud); + baud = tty_get_baud_rate(tty); + port_settings.baud = cpu_to_le32(baud); + dev_dbg(dev, "%s - baud rate = %u\n", __func__, baud); /* 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 */ port_settings.lloop = 0; --- a/drivers/usb/serial/whiteheat.h +++ b/drivers/usb/serial/whiteheat.h @@ -87,7 +87,7 @@ struct whiteheat_simple { struct whiteheat_port_settings { __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 */ __u8 bits; /* 5, 6, 7, or 8 */ __u8 stop; /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */