diff options
Diffstat (limited to 'drivers/usb/serial/qcserial.c')
| -rw-r--r-- | drivers/usb/serial/qcserial.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index c3ddb65c05f2..aa148c21ea40 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
| @@ -138,7 +138,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
| 138 | 138 | ||
| 139 | static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | 139 | static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
| 140 | { | 140 | { |
| 141 | struct usb_wwan_intf_private *data; | ||
| 142 | struct usb_host_interface *intf = serial->interface->cur_altsetting; | 141 | struct usb_host_interface *intf = serial->interface->cur_altsetting; |
| 143 | struct device *dev = &serial->dev->dev; | 142 | struct device *dev = &serial->dev->dev; |
| 144 | int retval = -ENODEV; | 143 | int retval = -ENODEV; |
| @@ -154,13 +153,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 154 | ifnum = intf->desc.bInterfaceNumber; | 153 | ifnum = intf->desc.bInterfaceNumber; |
| 155 | dev_dbg(dev, "This Interface = %d\n", ifnum); | 154 | dev_dbg(dev, "This Interface = %d\n", ifnum); |
| 156 | 155 | ||
| 157 | data = kzalloc(sizeof(struct usb_wwan_intf_private), | ||
| 158 | GFP_KERNEL); | ||
| 159 | if (!data) | ||
| 160 | return -ENOMEM; | ||
| 161 | |||
| 162 | spin_lock_init(&data->susp_lock); | ||
| 163 | |||
| 164 | if (nintf == 1) { | 156 | if (nintf == 1) { |
| 165 | /* QDL mode */ | 157 | /* QDL mode */ |
| 166 | /* Gobi 2000 has a single altsetting, older ones have two */ | 158 | /* Gobi 2000 has a single altsetting, older ones have two */ |
| @@ -253,20 +245,28 @@ done: | |||
| 253 | } | 245 | } |
| 254 | } | 246 | } |
| 255 | 247 | ||
| 256 | /* Set serial->private if not returning error */ | ||
| 257 | if (retval == 0) | ||
| 258 | usb_set_serial_data(serial, data); | ||
| 259 | else | ||
| 260 | kfree(data); | ||
| 261 | |||
| 262 | return retval; | 248 | return retval; |
| 263 | } | 249 | } |
| 264 | 250 | ||
| 251 | static int qc_attach(struct usb_serial *serial) | ||
| 252 | { | ||
| 253 | struct usb_wwan_intf_private *data; | ||
| 254 | |||
| 255 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
| 256 | if (!data) | ||
| 257 | return -ENOMEM; | ||
| 258 | |||
| 259 | spin_lock_init(&data->susp_lock); | ||
| 260 | |||
| 261 | usb_set_serial_data(serial, data); | ||
| 262 | |||
| 263 | return 0; | ||
| 264 | } | ||
| 265 | |||
| 265 | static void qc_release(struct usb_serial *serial) | 266 | static void qc_release(struct usb_serial *serial) |
| 266 | { | 267 | { |
| 267 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); | 268 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); |
| 268 | 269 | ||
| 269 | /* Free the private data allocated in qcprobe */ | ||
| 270 | usb_set_serial_data(serial, NULL); | 270 | usb_set_serial_data(serial, NULL); |
| 271 | kfree(priv); | 271 | kfree(priv); |
| 272 | } | 272 | } |
| @@ -285,8 +285,9 @@ static struct usb_serial_driver qcdevice = { | |||
| 285 | .write = usb_wwan_write, | 285 | .write = usb_wwan_write, |
| 286 | .write_room = usb_wwan_write_room, | 286 | .write_room = usb_wwan_write_room, |
| 287 | .chars_in_buffer = usb_wwan_chars_in_buffer, | 287 | .chars_in_buffer = usb_wwan_chars_in_buffer, |
| 288 | .attach = usb_wwan_startup, | 288 | .attach = qc_attach, |
| 289 | .release = qc_release, | 289 | .release = qc_release, |
| 290 | .port_probe = usb_wwan_port_probe, | ||
| 290 | .port_remove = usb_wwan_port_remove, | 291 | .port_remove = usb_wwan_port_remove, |
| 291 | #ifdef CONFIG_PM | 292 | #ifdef CONFIG_PM |
| 292 | .suspend = usb_wwan_suspend, | 293 | .suspend = usb_wwan_suspend, |
