[PATCH v2 2/4] USB: mxu11x0: clean device control commands

From: Mathieu OTHACEHE
Date: Mon Jan 04 2016 - 13:50:22 EST


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@xxxxxxxxx>
---

Changes in v2:
* Only remove OPEN_PORT and START_PORT in open callback.

drivers/usb/serial/mxu11x0.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/serial/mxu11x0.c b/drivers/usb/serial/mxu11x0.c
index 6196073..7ad2727 100644
--- a/drivers/usb/serial/mxu11x0.c
+++ b/drivers/usb/serial/mxu11x0.c
@@ -833,20 +833,6 @@ static int mxu1_open(struct tty_struct *tty, struct usb_serial_port *port)
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 +852,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.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/