The mismerge in chars_in_buffer

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

 



Dear Greg:

I prepared a patch to fix-up the mismerge, it looks like this:

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index a5fbb25..d2dced6 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -370,9 +370,7 @@ int usb_serial_generic_write_room(struct tty_struct *tty)
 				(serial->type->max_in_flight_urbs -
 				 port->urbs_in_flight);
 	} else if (serial->num_bulk_out) {
-		/* This overcounts badly, but is good enough for drain wait. */
 		room = kfifo_avail(&port->write_fifo);
-		room += port->write_urb_busy * port->bulk_out_size;
 	}
 	spin_unlock_irqrestore(&port->lock, flags);
 
@@ -389,12 +387,15 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
 
 	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 += port->write_urb_busy * port->bulk_out_size;
+	}
+	spin_unlock_irqrestore(&port->lock, flags);
 
 	dbg("%s - returns %d", __func__, chars);
 	return chars;


But on second thought, this is probably a bad idea, because the commit
log is going to be fragmented and confusing. Can you instead drop my
patch that became mismerged? The file name is
 usb-serial-mct_usb232-add-drain-on-close.patch
I'll resubmit a correct version.

-- 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