From: Johan Hovold <jhovold@gmail.com>
To: Greg Kroah-Hartman <gregkh@suse.de>, Alan Cox <alan@linux.intel.com>
Cc: Oliver Neukum <oliver@neukum.org>,
Alan Stern <stern@rowland.harvard.edu>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Johan Hovold <jhovold@gmail.com>
Subject: [PATCH 3/4] USB: ftdi_sio: clean up read completion handler
Date: Wed, 7 Oct 2009 20:05:06 +0200 [thread overview]
Message-ID: <1254938707-6996-4-git-send-email-jhovold@gmail.com> (raw)
In-Reply-To: <1254938707-6996-1-git-send-email-jhovold@gmail.com>
Remove superfluous error checks in completion handler:
- No need to check private data and urb pointers as we check urb-status
before dereferencing priv (which is not freed until urb has been killed
on close).
- No need to check tty as it is checked again when processing.
- No need to check urb->number_of_packets on bulk urb.
Note that both private data and tty are checked again before processing
(possibly from work queue which also is cancelled on close).
Signed-off-by: Johan Hovold <jhovold@gmail.com>
---
drivers/usb/serial/ftdi_sio.c | 28 +---------------------------
1 files changed, 1 insertions(+), 27 deletions(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index bfb23d6..75c84d9 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2008,39 +2008,14 @@ static int ftdi_chars_in_buffer(struct tty_struct *tty)
static void ftdi_read_bulk_callback(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
- struct tty_struct *tty;
struct ftdi_private *priv;
int status = urb->status;
- if (urb->number_of_packets > 0) {
- dev_err(&port->dev, "%s transfer_buffer_length %d "
- "actual_length %d number of packets %d\n", __func__,
- urb->transfer_buffer_length,
- urb->actual_length, urb->number_of_packets);
- dev_err(&port->dev, "%s transfer_flags %x\n", __func__,
- urb->transfer_flags);
- }
-
dbg("%s - port %d", __func__, port->number);
if (port->port.count <= 0)
return;
- tty = tty_port_tty_get(&port->port);
- if (!tty) {
- dbg("%s - bad tty pointer - exiting", __func__);
- return;
- }
-
- priv = usb_get_serial_port_data(port);
- if (!priv) {
- dbg("%s - bad port private data pointer - exiting", __func__);
- goto out;
- }
-
- if (urb != port->read_urb)
- dev_err(&port->dev, "%s - Not my urb!\n", __func__);
-
if (status) {
/* This will happen at close every time so it is a dbg not an
err */
@@ -2048,9 +2023,8 @@ static void ftdi_read_bulk_callback(struct urb *urb)
goto out;
}
+ priv = usb_get_serial_port_data(port);
ftdi_process_read(&priv->rx_work.work);
-out:
- tty_kref_put(tty);
} /* ftdi_read_bulk_callback */
--
1.6.5.rc2
next prev parent reply other threads:[~2009-10-07 18:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-07 18:05 [PATCH 0/4]: USB: ftdi_sio: fix regression in 2.6.31 and clean up Johan Hovold
2009-10-07 18:05 ` [PATCH 1/4] USB: ftdi_sio: remove tty->low_latency Johan Hovold
2009-10-07 18:05 ` [PATCH 2/4] USB: ftdi_sio: remove unused rx_byte counter Johan Hovold
2009-10-07 18:05 ` Johan Hovold [this message]
2009-10-07 18:05 ` [PATCH 4/4] USB: ftdi_sio: re-implement read processing Johan Hovold
2009-10-07 19:33 ` [PATCH 0/4]: USB: ftdi_sio: fix regression in 2.6.31 and clean up Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1254938707-6996-4-git-send-email-jhovold@gmail.com \
--to=jhovold@gmail.com \
--cc=alan@linux.intel.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oliver@neukum.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®