Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Oliver Neukum and committed by
Greg Kroah-Hartman
53e77df2 f02fe890

+31 -2
+31 -2
drivers/usb/serial/ipw.c
··· 47 47 #include <linux/usb.h> 48 48 #include <linux/usb/serial.h> 49 49 #include <linux/uaccess.h> 50 + #include "usb-wwan.h" 50 51 51 52 /* 52 53 * Version Information ··· 186 185 187 186 /*--2: Start reading from the device */ 188 187 dbg("%s: setting up bulk read callback", __func__); 189 - usb_serial_generic_open(tty, port); 188 + usb_wwan_open(tty, port); 190 189 191 190 /*--3: Tell the modem to open the floodgates on the rx bulk channel */ 192 191 dbg("%s:asking modem for RxRead (RXBULK_ON)", __func__); ··· 218 217 219 218 kfree(buf_flow_init); 220 219 return 0; 220 + } 221 + 222 + /* fake probe - only to allocate data structures */ 223 + static int ipw_probe(struct usb_serial *serial, const struct usb_device_id *id) 224 + { 225 + struct usb_wwan_intf_private *data; 226 + 227 + data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); 228 + if (!data) 229 + return -ENOMEM; 230 + 231 + spin_lock_init(&data->susp_lock); 232 + usb_set_serial_data(serial, data); 233 + return 0; 234 + } 235 + 236 + static void ipw_release(struct usb_serial *serial) 237 + { 238 + struct usb_wwan_intf_private *data = usb_get_serial_data(serial); 239 + 240 + usb_wwan_release(serial); 241 + usb_set_serial_data(serial, NULL); 242 + kfree(data); 221 243 } 222 244 223 245 static void ipw_dtr_rts(struct usb_serial_port *port, int on) ··· 309 285 dev_err(&port->dev, 310 286 "Disabling bulk RxRead failed (error = %d)\n", result); 311 287 312 - usb_serial_generic_close(port); 288 + usb_wwan_close(port); 313 289 } 314 290 315 291 static struct usb_serial_driver ipw_device = { ··· 321 297 .usb_driver = &usb_ipw_driver, 322 298 .id_table = usb_ipw_ids, 323 299 .num_ports = 1, 300 + .disconnect = usb_wwan_disconnect, 324 301 .open = ipw_open, 325 302 .close = ipw_close, 303 + .probe = ipw_probe, 304 + .attach = usb_wwan_startup, 305 + .release = ipw_release, 326 306 .dtr_rts = ipw_dtr_rts, 307 + .write = usb_wwan_write, 327 308 }; 328 309 329 310