diff options
author | Oliver Neukum <oneukum@suse.de> | 2011-07-13 07:54:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-22 18:21:16 -0400 |
commit | 53e77df25f64567ee1f55e7d76b8843689c79d9e (patch) | |
tree | aa124d50abe3cf7c20226ab2b2529ce32743be42 /drivers/usb/serial/ipw.c | |
parent | f02fe890ece7d695a5744b20525d45312382e6e4 (diff) |
USB: ipw: convert to usb-wwan framework
From 2d487c10136f76cf3705881d34868e8592839cfe Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@neukum.org>
Date: Tue, 12 Jul 2011 15:36:51 +0200
Subject: [PATCH] USB: ipw: convert to usb-wwan framework
This patch allows the ipw driver to use the multibuffer
infrastructure of usb-wwan. This improves speed.
Signed-off-by: Oliver Neukum<oneukum@suse.de>
Tested-by: Michal Hybner <dta081@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/ipw.c')
-rw-r--r-- | drivers/usb/serial/ipw.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index ca77e88836bd..5170799d6e94 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/usb.h> | 47 | #include <linux/usb.h> |
48 | #include <linux/usb/serial.h> | 48 | #include <linux/usb/serial.h> |
49 | #include <linux/uaccess.h> | 49 | #include <linux/uaccess.h> |
50 | #include "usb-wwan.h" | ||
50 | 51 | ||
51 | /* | 52 | /* |
52 | * Version Information | 53 | * Version Information |
@@ -185,7 +186,7 @@ static int ipw_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
185 | 186 | ||
186 | /*--2: Start reading from the device */ | 187 | /*--2: Start reading from the device */ |
187 | dbg("%s: setting up bulk read callback", __func__); | 188 | dbg("%s: setting up bulk read callback", __func__); |
188 | usb_serial_generic_open(tty, port); | 189 | usb_wwan_open(tty, port); |
189 | 190 | ||
190 | /*--3: Tell the modem to open the floodgates on the rx bulk channel */ | 191 | /*--3: Tell the modem to open the floodgates on the rx bulk channel */ |
191 | dbg("%s:asking modem for RxRead (RXBULK_ON)", __func__); | 192 | dbg("%s:asking modem for RxRead (RXBULK_ON)", __func__); |
@@ -219,6 +220,29 @@ static int ipw_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
219 | return 0; | 220 | return 0; |
220 | } | 221 | } |
221 | 222 | ||
223 | /* fake probe - only to allocate data structures */ | ||
224 | static int ipw_probe(struct usb_serial *serial, const struct usb_device_id *id) | ||
225 | { | ||
226 | struct usb_wwan_intf_private *data; | ||
227 | |||
228 | data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); | ||
229 | if (!data) | ||
230 | return -ENOMEM; | ||
231 | |||
232 | spin_lock_init(&data->susp_lock); | ||
233 | usb_set_serial_data(serial, data); | ||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | static void ipw_release(struct usb_serial *serial) | ||
238 | { | ||
239 | struct usb_wwan_intf_private *data = usb_get_serial_data(serial); | ||
240 | |||
241 | usb_wwan_release(serial); | ||
242 | usb_set_serial_data(serial, NULL); | ||
243 | kfree(data); | ||
244 | } | ||
245 | |||
222 | static void ipw_dtr_rts(struct usb_serial_port *port, int on) | 246 | static void ipw_dtr_rts(struct usb_serial_port *port, int on) |
223 | { | 247 | { |
224 | struct usb_device *dev = port->serial->dev; | 248 | struct usb_device *dev = port->serial->dev; |
@@ -285,7 +309,7 @@ static void ipw_close(struct usb_serial_port *port) | |||
285 | dev_err(&port->dev, | 309 | dev_err(&port->dev, |
286 | "Disabling bulk RxRead failed (error = %d)\n", result); | 310 | "Disabling bulk RxRead failed (error = %d)\n", result); |
287 | 311 | ||
288 | usb_serial_generic_close(port); | 312 | usb_wwan_close(port); |
289 | } | 313 | } |
290 | 314 | ||
291 | static struct usb_serial_driver ipw_device = { | 315 | static struct usb_serial_driver ipw_device = { |
@@ -297,9 +321,14 @@ static struct usb_serial_driver ipw_device = { | |||
297 | .usb_driver = &usb_ipw_driver, | 321 | .usb_driver = &usb_ipw_driver, |
298 | .id_table = usb_ipw_ids, | 322 | .id_table = usb_ipw_ids, |
299 | .num_ports = 1, | 323 | .num_ports = 1, |
324 | .disconnect = usb_wwan_disconnect, | ||
300 | .open = ipw_open, | 325 | .open = ipw_open, |
301 | .close = ipw_close, | 326 | .close = ipw_close, |
327 | .probe = ipw_probe, | ||
328 | .attach = usb_wwan_startup, | ||
329 | .release = ipw_release, | ||
302 | .dtr_rts = ipw_dtr_rts, | 330 | .dtr_rts = ipw_dtr_rts, |
331 | .write = usb_wwan_write, | ||
303 | }; | 332 | }; |
304 | 333 | ||
305 | 334 | ||