USB: serial: fix assumption that throttle/unthrottle cannot sleep
many serial subdrivers are clearly written as if throttle/unthrottle cannot sleep. This leads to unneeded atomic submissions. This patch converts affected drivers in a way to makes very clear that throttle/unthrottle can sleep. Thus future misdesigns can be avoided and efficiency and reliability improved. This removes any such assumption using GFP_KERNEL and spin_lock_irq() Signed-off-by: Oliver Neukum <oliver@neukum.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b2a5cf1bdc
commit
6383251545
@ -777,20 +777,19 @@ static void mct_u232_throttle(struct tty_struct *tty)
|
||||
{
|
||||
struct usb_serial_port *port = tty->driver_data;
|
||||
struct mct_u232_private *priv = usb_get_serial_port_data(port);
|
||||
unsigned long flags;
|
||||
unsigned int control_state;
|
||||
|
||||
dbg("%s - port %d", __func__, port->number);
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
spin_lock_irq(&priv->lock);
|
||||
priv->rx_flags |= THROTTLED;
|
||||
if (C_CRTSCTS(tty)) {
|
||||
priv->control_state &= ~TIOCM_RTS;
|
||||
control_state = priv->control_state;
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
spin_unlock_irq(&priv->lock);
|
||||
(void) mct_u232_set_modem_ctrl(port->serial, control_state);
|
||||
} else {
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
spin_unlock_irq(&priv->lock);
|
||||
}
|
||||
}
|
||||
|
||||
@ -799,20 +798,19 @@ static void mct_u232_unthrottle(struct tty_struct *tty)
|
||||
{
|
||||
struct usb_serial_port *port = tty->driver_data;
|
||||
struct mct_u232_private *priv = usb_get_serial_port_data(port);
|
||||
unsigned long flags;
|
||||
unsigned int control_state;
|
||||
|
||||
dbg("%s - port %d", __func__, port->number);
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
spin_lock_irq(&priv->lock);
|
||||
if ((priv->rx_flags & THROTTLED) && C_CRTSCTS(tty)) {
|
||||
priv->rx_flags &= ~THROTTLED;
|
||||
priv->control_state |= TIOCM_RTS;
|
||||
control_state = priv->control_state;
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
spin_unlock_irq(&priv->lock);
|
||||
(void) mct_u232_set_modem_ctrl(port->serial, control_state);
|
||||
} else {
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
spin_unlock_irq(&priv->lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user