linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>, Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Samuel Ortiz <samuel@sortiz.org>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-serial@vger.kernel.org, Johan Hovold <johan@kernel.org>
Subject: [PATCH 7/9] tty: rocket: drop broken alt-speed support
Date: Tue,  6 Jun 2017 12:54:39 +0200	[thread overview]
Message-ID: <20170606105441.689-8-johan@kernel.org> (raw)
In-Reply-To: <20170606105441.689-1-johan@kernel.org>

Setting an alt_speed using the ROCKET_SPD flags has been deprecated
since v2.1.69, and has been broken since commit 6865ff222cca ("TTY: do
not warn about setting speed via SPD_*") without anyone noticing.

To make things worse commit 6df3526b6649 ("rocket: first pass at termios
reporting") in v2.6.25 started reporting back the actual baud rate used,
something which also required 38400 to again be set whenever changing a
SPD flag.

Drop the broken alt-speed handling altogether, and add a ratelimited
warning about using TIOCCSERIAL to change speed as being deprecated.

Note that the rocket driver has never supported using a custom divisor
(ASYNC_SPD_CUST equivalent).

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/tty/rocket.c | 27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index b51a877da986..20d79a6007d5 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -947,18 +947,6 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
 
 		tty_port_set_initialized(&info->port, 1);
 
-		/*
-		 * Set up the tty->alt_speed kludge
-		 */
-		if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI)
-			tty->alt_speed = 57600;
-		if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI)
-			tty->alt_speed = 115200;
-		if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI)
-			tty->alt_speed = 230400;
-		if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP)
-			tty->alt_speed = 460800;
-
 		configure_r_port(tty, info, NULL);
 		if (C_BAUD(tty)) {
 			sSetDTR(cp);
@@ -1219,23 +1207,20 @@ static int set_config(struct tty_struct *tty, struct r_port *info,
 			return -EPERM;
 		}
 		info->flags = ((info->flags & ~ROCKET_USR_MASK) | (new_serial.flags & ROCKET_USR_MASK));
-		configure_r_port(tty, info, NULL);
 		mutex_unlock(&info->port.mutex);
 		return 0;
 	}
 
+	if ((new_serial.flags ^ info->flags) & ROCKET_SPD_MASK) {
+		/* warn about deprecation, unless clearing */
+		if (new_serial.flags & ROCKET_SPD_MASK)
+			dev_warn_ratelimited(tty->dev, "use of SPD flags is deprecated\n");
+	}
+
 	info->flags = ((info->flags & ~ROCKET_FLAGS) | (new_serial.flags & ROCKET_FLAGS));
 	info->port.close_delay = new_serial.close_delay;
 	info->port.closing_wait = new_serial.closing_wait;
 
-	if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI)
-		tty->alt_speed = 57600;
-	if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI)
-		tty->alt_speed = 115200;
-	if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI)
-		tty->alt_speed = 230400;
-	if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP)
-		tty->alt_speed = 460800;
 	mutex_unlock(&info->port.mutex);
 
 	configure_r_port(tty, info, NULL);
-- 
2.13.0

  parent reply	other threads:[~2017-06-06 10:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 10:54 [PATCH 0/9] tty: drop broken alt-speed handling Johan Hovold
2017-06-06 10:54 ` [PATCH 1/9] serial: rate limit custom-speed deprecation notice Johan Hovold
2017-06-06 10:54 ` [PATCH 2/9] USB: serial: ftdi_sio: simplify TIOCSSERIAL flag logic Johan Hovold
2017-06-06 10:54 ` [PATCH 3/9] USB: serial: ftdi_sio: remove broken alt-speed handling Johan Hovold
2017-06-06 10:54 ` [PATCH 4/9] tty: simserial: drop unused alt_speed handling Johan Hovold
2017-06-06 10:54 ` [PATCH 5/9] tty: amiserial: drop broken alt-speed support Johan Hovold
2017-06-06 10:54 ` [PATCH 6/9] tty: cyclades: " Johan Hovold
2017-06-06 10:54 ` Johan Hovold [this message]
2017-06-06 10:54 ` [PATCH 8/9] tty: ircomm: remove dead and broken ioctl code Johan Hovold
2017-06-06 11:27   ` Alan Cox
2017-06-13  9:48     ` Greg Kroah-Hartman
2017-06-13  9:57       ` Johan Hovold
2017-06-13 10:00         ` Johan Hovold
2017-06-13 10:01         ` Greg Kroah-Hartman
2017-06-06 10:54 ` [PATCH 9/9] tty: drop unused alt_speed from tty_struct Johan Hovold
2017-06-06 11:29 ` [PATCH 0/9] tty: drop broken alt-speed handling Alan Cox
2017-06-07  9:53 ` Andy Shevchenko
2017-06-13  9:55 ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170606105441.689-8-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=davem@davemloft.net \
    --cc=fenghua.yu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=samuel@sortiz.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).