Re: [PATCH] USB: ftdi_sio: Remove tty->low_latency.

From: Oliver Neukum
Date: Sat Oct 03 2009 - 08:10:07 EST


Am Samstag, 3. Oktober 2009 13:42:29 schrieb Johan Hovold:
> +       spin_lock_irqsave(&port->lock, flags);
> +       if (!port->throttled) {
> +               spin_unlock_irqrestore(&port->lock, flags);
> +               ftdi_submit_read_urb(port, GFP_ATOMIC);
> +       } else
> +               spin_unlock_irqrestore(&port->lock, flags);
> +}
>  
>  static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
>  {
> @@ -2605,33 +2467,30 @@ static int ftdi_ioctl(struct tty_struct *tty,
> struct file *file, static void ftdi_throttle(struct tty_struct *tty)
[..]
> +       spin_lock_irqsave(&port->lock, flags);
> +       port->throttled = 1;
> +       spin_unlock_irqrestore(&port->lock, flags);
>  }
>  
> -
> -static void ftdi_unthrottle(struct tty_struct *tty)
> +void ftdi_unthrottle(struct tty_struct *tty)
[..]
> +       spin_lock_irqsave(&port->lock, flags);
> +       was_throttled = port->throttled;
> +       port->throttled = 0;
> +       spin_unlock_irqrestore(&port->lock, flags);
>  
> -       if (actually_throttled)
> -               schedule_delayed_work(&priv->rx_work, 0);
> +       if (was_throttled && !test_bit(ASYNCB_CLOSING, &port->port.flags))
> +               ftdi_submit_read_urb(port, GFP_KERNEL);
>  }

This unfortunately is incorrect. If an unthrottling happens before the read
callback runs you submit a running URB.

Regards
Oliver


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/