Commit fbf947736968cbb0e55ec4b5d861d31a4a106c99

Authored by Johan Hovold
Committed by Greg Kroah-Hartman
1 parent a6c042f950

USB: omninet: switch to generic read implementation

Switch to the more efficient generic read implementation.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 3 additions and 40 deletions Side-by-side Diff

drivers/usb/serial/omninet.c
... ... @@ -33,8 +33,7 @@
33 33  
34 34 /* function prototypes */
35 35 static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port);
36   -static void omninet_close(struct usb_serial_port *port);
37   -static void omninet_read_bulk_callback(struct urb *urb);
  36 +static void omninet_process_read_urb(struct urb *urb);
38 37 static void omninet_write_bulk_callback(struct urb *urb);
39 38 static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
40 39 const unsigned char *buf, int count);
41 40  
42 41  
... ... @@ -61,11 +60,10 @@
61 60 .port_probe = omninet_port_probe,
62 61 .port_remove = omninet_port_remove,
63 62 .open = omninet_open,
64   - .close = omninet_close,
65 63 .write = omninet_write,
66 64 .write_room = omninet_write_room,
67   - .read_bulk_callback = omninet_read_bulk_callback,
68 65 .write_bulk_callback = omninet_write_bulk_callback,
  66 + .process_read_urb = omninet_process_read_urb,
69 67 .disconnect = omninet_disconnect,
70 68 };
71 69  
72 70  
73 71  
... ... @@ -134,26 +132,13 @@
134 132 {
135 133 struct usb_serial *serial = port->serial;
136 134 struct usb_serial_port *wport;
137   - int result = 0;
138 135  
139 136 wport = serial->port[1];
140 137 tty_port_tty_set(&wport->port, tty);
141 138  
142   - /* Start reading from the device */
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;
  139 + return usb_serial_generic_open(tty, port);
149 140 }
150 141  
151   -static void omninet_close(struct usb_serial_port *port)
152   -{
153   - usb_kill_urb(port->read_urb);
154   -}
155   -
156   -
157 142 #define OMNINET_HEADERLEN 4
158 143 #define OMNINET_BULKOUTSIZE 64
159 144 #define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN)
... ... @@ -173,28 +158,6 @@
173 158 hdr->oh_len);
174 159 tty_insert_flip_string(&port->port, data, data_len);
175 160 tty_flip_buffer_push(&port->port);
176   -}
177   -
178   -static 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 161 }
199 162  
200 163 static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,