From: Mathieu OTHACEHE <m.othacehe@gmail.com>
To: johan@kernel.org, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
Mathieu OTHACEHE <m.othacehe@gmail.com>
Subject: [PATCH 2/3] USB: mxu11x0: clean device control commands
Date: Sun, 3 Jan 2016 15:26:00 +0100 [thread overview]
Message-ID: <1451831161-26792-3-git-send-email-m.othacehe@gmail.com> (raw)
In-Reply-To: <1451831161-26792-1-git-send-email-m.othacehe@gmail.com>
Sending OPEN and START commands twice is not necessary for this driver.
Also send STOP command at close.
Signed-off-by: Mathieu OTHACEHE <m.othacehe@gmail.com>
---
drivers/usb/serial/mxu11x0.c | 31 +++++++------------------------
1 file changed, 7 insertions(+), 24 deletions(-)
diff --git a/drivers/usb/serial/mxu11x0.c b/drivers/usb/serial/mxu11x0.c
index 0fe7eab..354fcb5 100644
--- a/drivers/usb/serial/mxu11x0.c
+++ b/drivers/usb/serial/mxu11x0.c
@@ -823,30 +823,6 @@ static int mxu1_open(struct tty_struct *tty, struct usb_serial_port *port)
goto unlink_int_urb;
}
- /*
- * reset the data toggle on the bulk endpoints to work around bug in
- * host controllers where things get out of sync some times
- */
- usb_clear_halt(serial->dev, port->write_urb->pipe);
- usb_clear_halt(serial->dev, port->read_urb->pipe);
-
- if (tty)
- mxu1_set_termios(tty, port, NULL);
-
- status = mxu1_send_ctrl_urb(serial, MXU1_OPEN_PORT,
- open_settings, MXU1_UART1_PORT);
- if (status) {
- dev_err(&port->dev, "cannot send open command: %d\n", status);
- goto unlink_int_urb;
- }
-
- status = mxu1_send_ctrl_urb(serial, MXU1_START_PORT,
- 0, MXU1_UART1_PORT);
- if (status) {
- dev_err(&port->dev, "cannot send start command: %d\n", status);
- goto unlink_int_urb;
- }
-
status = usb_serial_generic_open(tty, port);
if (status)
goto unlink_int_urb;
@@ -866,6 +842,13 @@ static void mxu1_close(struct usb_serial_port *port)
usb_serial_generic_close(port);
usb_kill_urb(port->interrupt_in_urb);
+ status = mxu1_send_ctrl_urb(port->serial, MXU1_STOP_PORT,
+ 0, MXU1_UART1_PORT);
+ if (status) {
+ dev_err(&port->dev, "failed to send stop port command: %d\n",
+ status);
+ }
+
status = mxu1_send_ctrl_urb(port->serial, MXU1_CLOSE_PORT,
0, MXU1_UART1_PORT);
if (status) {
--
2.6.2
next prev parent reply other threads:[~2016-01-03 14:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-03 14:25 [PATCH 0/3] USB: mxu11x0: fixes and follow ups Mathieu OTHACEHE
2016-01-03 14:25 ` [PATCH 1/3] USB: mxu11x0: fix memory leak on usb_serial private data Mathieu OTHACEHE
2016-01-03 16:27 ` Johan Hovold
2016-01-03 14:26 ` Mathieu OTHACEHE [this message]
2016-01-03 16:33 ` [PATCH 2/3] USB: mxu11x0: clean device control commands Johan Hovold
2016-01-03 14:26 ` [PATCH 3/3] USB: mxu11x0: move firmware download and endpoint testing to probe callback Mathieu OTHACEHE
2016-01-03 16:45 ` Johan Hovold
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=1451831161-26792-3-git-send-email-m.othacehe@gmail.com \
--to=m.othacehe@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.