lkml.org 
[lkml]   [2010]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: USB: serial: kfifo_len locking
On Tue, 05 Jan 2010 12:09:19 +0100
Stefani Seibold <stefani@seibold.net> wrote:

> > 39 +++ b/drivers/usb/serial/generic.c
> > 40 @@ -369,8 +369,11 @@ int usb_serial_generic_write_room(struct
> > 41 room = port->bulk_out_size *
> > 42 (serial->type->max_in_flight_urbs -
> > 43 port->urbs_in_flight);
> > 44 - } else if (serial->num_bulk_out)
> > 45 + } else if (serial->num_bulk_out) {
> > 46 + /* This overcounts badly, but is good enough for drain wait. */
> > 47 room = kfifo_avail(&port->write_fifo);
> > 48 + room += port->write_urb_busy * port->bulk_out_size;
> > 49 + }
> > 50 spin_unlock_irqrestore(&port->lock, flags);

> > Which does not make any sense at all. Bad merge? What do you say Greg?
>
> I don't know where is your problem? This are two different functions
> usb_serial_generic_write_room() and usb_serial_generic_chars_in_buffer()

Looks like a bad merge indeed. The fix that accounts for the write
urb has to apply to chars_in_buffer, so that we can wait until until
it goes to zero.

Please feel free to fix up the kfifo API, I'll pick up the pieces
regarding the lost bytes on close after you're done.

-- Pete


\
 
 \ /
  Last update: 2010-01-05 18:03    [W:0.073 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site