Re: USB: serial: kfifo_len locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 05 Jan 2010 12:09:19 +0100
Stefani Seibold <stefani@xxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux