mirror of
https://github.com/torvalds/linux.git
synced 2024-12-13 22:53:20 +00:00
USB: serial: io_edgeport: drop buffer-callback sanity checks
The driver write_room and chars_in_buffer callbacks used to incorrectly
return a negative errno in case they were called while or after the port
had been closed. The return value was later changed to zero by commit
d76f2f4462
("io_edgeport: Fix various bogus returns to the tty
layer") but the bogus sanity checks were left in place as were the
outdated function-header comments.
These callbacks will never be called for an uninitialised port so drop
the unnecessary sanity checks and the outdated comments.
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
This commit is contained in:
parent
dcbc0ae4f8
commit
9a8253a7c2
@ -1351,9 +1351,7 @@ exit_send:
|
||||
/*****************************************************************************
|
||||
* edge_write_room
|
||||
* this function is called by the tty driver when it wants to know how
|
||||
* many bytes of data we can accept for a specific port. If successful,
|
||||
* we return the amount of room that we have for this port (the txCredits)
|
||||
* otherwise we return a negative error number.
|
||||
* many bytes of data we can accept for a specific port.
|
||||
*****************************************************************************/
|
||||
static unsigned int edge_write_room(struct tty_struct *tty)
|
||||
{
|
||||
@ -1362,16 +1360,6 @@ static unsigned int edge_write_room(struct tty_struct *tty)
|
||||
unsigned int room;
|
||||
unsigned long flags;
|
||||
|
||||
if (edge_port == NULL)
|
||||
return 0;
|
||||
if (edge_port->closePending)
|
||||
return 0;
|
||||
|
||||
if (!edge_port->open) {
|
||||
dev_dbg(&port->dev, "%s - port not opened\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* total of both buffers is still txCredit */
|
||||
spin_lock_irqsave(&edge_port->ep_lock, flags);
|
||||
room = edge_port->txCredits - edge_port->txfifo.count;
|
||||
@ -1387,9 +1375,6 @@ static unsigned int edge_write_room(struct tty_struct *tty)
|
||||
* this function is called by the tty driver when it wants to know how
|
||||
* many bytes of data we currently have outstanding in the port (data that
|
||||
* has been written, but hasn't made it out the port yet)
|
||||
* If successful, we return the number of bytes left to be written in the
|
||||
* system,
|
||||
* Otherwise we return a negative error number.
|
||||
*****************************************************************************/
|
||||
static unsigned int edge_chars_in_buffer(struct tty_struct *tty)
|
||||
{
|
||||
@ -1398,16 +1383,6 @@ static unsigned int edge_chars_in_buffer(struct tty_struct *tty)
|
||||
unsigned int num_chars;
|
||||
unsigned long flags;
|
||||
|
||||
if (edge_port == NULL)
|
||||
return 0;
|
||||
if (edge_port->closePending)
|
||||
return 0;
|
||||
|
||||
if (!edge_port->open) {
|
||||
dev_dbg(&port->dev, "%s - port not opened\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&edge_port->ep_lock, flags);
|
||||
num_chars = edge_port->maxTxCredits - edge_port->txCredits +
|
||||
edge_port->txfifo.count;
|
||||
|
Loading…
Reference in New Issue
Block a user