summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/io_edgeport.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2021-05-19 12:20:03 +0300
committerJohan Hovold <johan@kernel.org>2021-05-21 16:46:08 +0300
commit9a8253a7c2da1d78183029a46bf04fb7beb933eb (patch)
tree69f2213a1eb1261928da31ae004336a5a14bfcc5 /drivers/usb/serial/io_edgeport.c
parentdcbc0ae4f8fcdd4c873e7a9bac49ab84b0453813 (diff)
downloadlinux-9a8253a7c2da1d78183029a46bf04fb7beb933eb.tar.xz
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 d76f2f4462bb ("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>
Diffstat (limited to 'drivers/usb/serial/io_edgeport.c')
-rw-r--r--drivers/usb/serial/io_edgeport.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 1f8dff4390c7..ea4edf5eed27 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -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;