From: YAMANE Toshiaki <yamanetoshi@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Devendra Naga <devendra.aaru@gmail.com>,
Rusty Russell <rusty@rustcorp.com.au>,
Alan Stern <stern@rowland.harvard.edu>,
Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
YAMANE Toshiaki <yamanetoshi@gmail.com>
Subject: [PATCH 4/4] staging/serqt_usb2: refactor qt_unthrottle() in serqt_usb2.c
Date: Sat, 10 Nov 2012 06:34:27 +0900 [thread overview]
Message-ID: <1352496867-7349-1-git-send-email-yamanetoshi@gmail.com> (raw)
In-Reply-To: <1352496782-7246-1-git-send-email-yamanetoshi@gmail.com>
Modified to eliminate the deep nesting.
Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
---
drivers/staging/serqt_usb2/serqt_usb2.c | 39 ++++++++++++++++++-------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c
index 4c475ed..f68a855 100644
--- a/drivers/staging/serqt_usb2/serqt_usb2.c
+++ b/drivers/staging/serqt_usb2/serqt_usb2.c
@@ -1473,12 +1473,32 @@ static void qt_throttle(struct tty_struct *tty)
mutex_unlock(&qt_port->lock);
}
+static void qt_submit_urb_from_unthrottle(struct usb_serial_port *port,
+ struct usb_serial *serial)
+{
+ int result;
+
+ /* Start reading from the device */
+ usb_fill_bulk_urb(port->read_urb, serial->dev,
+ usb_rcvbulkpipe(serial->dev,
+ port->bulk_in_endpointAddress),
+ port->read_urb->transfer_buffer,
+ port->read_urb->transfer_buffer_length,
+ qt_read_bulk_callback, port);
+
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
+
+ if (result)
+ dev_err(&port->dev,
+ "%s - failed restarting read urb, error %d\n",
+ __func__, result);
+}
+
static void qt_unthrottle(struct tty_struct *tty)
{
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial = get_usb_serial(port, __func__);
struct quatech_port *qt_port;
- unsigned int result;
if (!serial)
return;
@@ -1494,21 +1514,8 @@ static void qt_unthrottle(struct tty_struct *tty)
dev_dbg(&port->dev, "%s - qt_port->RxHolding = 0\n", __func__);
/* if we have a bulk endpoint, start it up */
- if ((serial->num_bulk_in) && (qt_port->ReadBulkStopped == 1)) {
- /* Start reading from the device */
- usb_fill_bulk_urb(port->read_urb, serial->dev,
- usb_rcvbulkpipe(serial->dev,
- port->bulk_in_endpointAddress),
- port->read_urb->transfer_buffer,
- port->read_urb->
- transfer_buffer_length,
- qt_read_bulk_callback, port);
- result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
- if (result)
- dev_err(&port->dev,
- "%s - failed restarting read urb, error %d\n",
- __func__, result);
- }
+ if ((serial->num_bulk_in) && (qt_port->ReadBulkStopped == 1))
+ qt_submit_urb_from_unthrottle(port, serial);
}
mutex_unlock(&qt_port->lock);
}
--
1.7.9.5
prev parent reply other threads:[~2012-11-09 21:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-09 21:33 [PATCH 1/4] staging/serqt_usb2: fixed line over issue " YAMANE Toshiaki
2012-11-09 21:33 ` [PATCH 2/4] staging/serqt_usb2: refactor qt_read_bulk_callback() " YAMANE Toshiaki
2012-11-14 12:41 ` Dan Carpenter
2012-11-14 20:09 ` YAMANE Toshiaki
2012-11-15 20:01 ` YAMANE Toshiaki
2012-11-15 20:18 ` Dan Carpenter
2012-11-15 20:32 ` YAMANE Toshiaki
2012-11-15 20:43 ` Dan Carpenter
2012-11-15 20:53 ` YAMANE Toshiaki
2012-11-09 21:34 ` [PATCH 3/4] staging/serqt_usb2: refactor qt_open() " YAMANE Toshiaki
2012-11-09 21:34 ` YAMANE Toshiaki [this message]
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=1352496867-7349-1-git-send-email-yamanetoshi@gmail.com \
--to=yamanetoshi@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=devendra.aaru@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@redhat.com \
--cc=rusty@rustcorp.com.au \
--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
Powered by JetHome