aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/serial/omninet.c43
1 files changed, 3 insertions, 40 deletions
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 7aaf9692b334..5739bf6f7200 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -33,8 +33,7 @@
33 33
34/* function prototypes */ 34/* function prototypes */
35static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port); 35static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port);
36static void omninet_close(struct usb_serial_port *port); 36static void omninet_process_read_urb(struct urb *urb);
37static void omninet_read_bulk_callback(struct urb *urb);
38static void omninet_write_bulk_callback(struct urb *urb); 37static void omninet_write_bulk_callback(struct urb *urb);
39static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, 38static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
40 const unsigned char *buf, int count); 39 const unsigned char *buf, int count);
@@ -61,11 +60,10 @@ static struct usb_serial_driver zyxel_omninet_device = {
61 .port_probe = omninet_port_probe, 60 .port_probe = omninet_port_probe,
62 .port_remove = omninet_port_remove, 61 .port_remove = omninet_port_remove,
63 .open = omninet_open, 62 .open = omninet_open,
64 .close = omninet_close,
65 .write = omninet_write, 63 .write = omninet_write,
66 .write_room = omninet_write_room, 64 .write_room = omninet_write_room,
67 .read_bulk_callback = omninet_read_bulk_callback,
68 .write_bulk_callback = omninet_write_bulk_callback, 65 .write_bulk_callback = omninet_write_bulk_callback,
66 .process_read_urb = omninet_process_read_urb,
69 .disconnect = omninet_disconnect, 67 .disconnect = omninet_disconnect,
70}; 68};
71 69
@@ -134,26 +132,13 @@ static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port)
134{ 132{
135 struct usb_serial *serial = port->serial; 133 struct usb_serial *serial = port->serial;
136 struct usb_serial_port *wport; 134 struct usb_serial_port *wport;
137 int result = 0;
138 135
139 wport = serial->port[1]; 136 wport = serial->port[1];
140 tty_port_tty_set(&wport->port, tty); 137 tty_port_tty_set(&wport->port, tty);
141 138
142 /* Start reading from the device */ 139 return usb_serial_generic_open(tty, port);
143 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
144 if (result)
145 dev_err(&port->dev,
146 "%s - failed submitting read urb, error %d\n",
147 __func__, result);
148 return result;
149}
150
151static void omninet_close(struct usb_serial_port *port)
152{
153 usb_kill_urb(port->read_urb);
154} 140}
155 141
156
157#define OMNINET_HEADERLEN 4 142#define OMNINET_HEADERLEN 4
158#define OMNINET_BULKOUTSIZE 64 143#define OMNINET_BULKOUTSIZE 64
159#define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN) 144#define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN)
@@ -175,28 +160,6 @@ static void omninet_process_read_urb(struct urb *urb)
175 tty_flip_buffer_push(&port->port); 160 tty_flip_buffer_push(&port->port);
176} 161}
177 162
178static void omninet_read_bulk_callback(struct urb *urb)
179{
180 struct usb_serial_port *port = urb->context;
181 int status = urb->status;
182 int result;
183
184 if (status) {
185 dev_dbg(&port->dev, "%s - nonzero read bulk status received: %d\n",
186 __func__, status);
187 return;
188 }
189
190 omninet_process_read_urb(urb);
191
192 /* Continue trying to always read */
193 result = usb_submit_urb(urb, GFP_ATOMIC);
194 if (result)
195 dev_err(&port->dev,
196 "%s - failed resubmitting read urb, error %d\n",
197 __func__, result);
198}
199
200static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, 163static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
201 const unsigned char *buf, int count) 164 const unsigned char *buf, int count)
202{ 165{