[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210407103925.829-25-johan@kernel.org>
Date: Wed, 7 Apr 2021 12:39:25 +0200
From: Johan Hovold <johan@...nel.org>
To: Johan Hovold <johan@...nel.org>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 24/24] USB: serial: ftdi_sio: clean up TIOCSSERIAL
The TIOCSSERIAL implementation needs to compare the old flag and divisor
settings with the new to detect ASYNC_SPD changes, but there's no need
to copy all driver state to the stack for that.
While at it, unbreak the function parameter list.
Signed-off-by: Johan Hovold <johan@...nel.org>
---
drivers/usb/serial/ftdi_sio.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 9228e56a91c0..6f2659e59b2e 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1486,15 +1486,13 @@ static void get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
ss->custom_divisor = priv->custom_divisor;
}
-static int set_serial_info(struct tty_struct *tty,
- struct serial_struct *ss)
+static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
{
struct usb_serial_port *port = tty->driver_data;
struct ftdi_private *priv = usb_get_serial_port_data(port);
- struct ftdi_private old_priv;
+ int old_flags, old_divisor;
mutex_lock(&priv->cfg_lock);
- old_priv = *priv;
if (!capable(CAP_SYS_ADMIN)) {
if ((ss->flags ^ priv->flags) & ~ASYNC_USR_MASK) {
@@ -1503,14 +1501,17 @@ static int set_serial_info(struct tty_struct *tty,
}
}
+ old_flags = priv->flags;
+ old_divisor = priv->custom_divisor;
+
priv->flags = ss->flags & ASYNC_FLAGS;
priv->custom_divisor = ss->custom_divisor;
write_latency_timer(port);
- if ((priv->flags ^ old_priv.flags) & ASYNC_SPD_MASK ||
+ if ((priv->flags ^ old_flags) & ASYNC_SPD_MASK ||
((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST &&
- priv->custom_divisor != old_priv.custom_divisor)) {
+ priv->custom_divisor != old_divisor)) {
/* warn about deprecation unless clearing */
if (priv->flags & ASYNC_SPD_MASK)
--
2.26.3
Powered by blists - more mailing lists