Subject: linux-next: manual merge of the usb tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 24 Dec 2009 09:30:36 +1100

Hi Greg,

Today's linux-next merge of the usb tree got a conflict in
drivers/usb/serial/generic.c between commit
119eecc831a42bd090543568932e440c6831f1bb ("Fix usb_serial_probe() problem
introduced by the recent kfifo changes") from Linus' tree and commit
40b2ba0dfb62bed0f7cc6f699053d18ca4553e91 ("USB: serial: mct_usb232: add
drain on close") from the usb tree.

I fixed it up (see below) and can carry the fix for a while.  The result
needs checking.
-- 
Cheers,
Stephen Rothwell                    [email-masked]

diff --cc drivers/usb/serial/generic.c
index f1ea3a3,3eea1d8..0000000
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@@ -386,12 -386,15 +386,15 @@@ int usb_serial_generic_chars_in_buffer(
  
  	dbg("%s - port %d", __func__, port->number);
  
+ 	spin_lock_irqsave(&port->lock, flags);
  	if (serial->type->max_in_flight_urbs) {
- 		spin_lock_irqsave(&port->lock, flags);
  		chars = port->tx_bytes_flight;
- 		spin_unlock_irqrestore(&port->lock, flags);
- 	} else if (serial->num_bulk_out)
+ 	} else if (serial->num_bulk_out) {
+ 		/* This overcounts badly, but is good enough for drain wait. */
 -		chars = __kfifo_len(port->write_fifo);
 +		chars = kfifo_len(&port->write_fifo);
+ 		chars += port->write_urb_busy * port->bulk_out_size;
+ 	}
+ 	spin_unlock_irqrestore(&port->lock, flags);
  
  	dbg("%s - returns %d", __func__, chars);
  	return chars;