Skip to content

Commit 3d7e59a

Browse files
Matthew Garrettgregkh
authored andcommitted
USB: qcserial: Use generic USB wwan code
Make qcserial use the generic USB wwan code. This should result in a performance improvement. Signed-off-by: Matthew Garrett <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8b4c6a3 commit 3d7e59a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

drivers/usb/serial/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ config USB_SERIAL_QCAUX
485485

486486
config USB_SERIAL_QUALCOMM
487487
tristate "USB Qualcomm Serial modem"
488+
select USB_SERIAL_WWAN
488489
help
489490
Say Y here if you have a Qualcomm USB modem device. These are
490491
usually wireless cellular modems.

drivers/usb/serial/qcserial.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <linux/tty_flip.h>
1616
#include <linux/usb.h>
1717
#include <linux/usb/serial.h>
18+
#include <linux/slab.h>
19+
#include "usb-wwan.h"
1820

1921
#define DRIVER_AUTHOR "Qualcomm Inc"
2022
#define DRIVER_DESC "Qualcomm USB Serial driver"
@@ -92,6 +94,7 @@ static struct usb_driver qcdriver = {
9294

9395
static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
9496
{
97+
struct usb_wwan_intf_private *data;
9598
int retval = -ENODEV;
9699
__u8 nintf;
97100
__u8 ifnum;
@@ -103,6 +106,13 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
103106
ifnum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
104107
dbg("This Interface = %d", ifnum);
105108

109+
data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private),
110+
GFP_KERNEL);
111+
if (!data)
112+
return -ENOMEM;
113+
114+
spin_lock_init(&data->susp_lock);
115+
106116
switch (nintf) {
107117
case 1:
108118
/* QDL mode */
@@ -161,6 +171,18 @@ static struct usb_serial_driver qcdevice = {
161171
.usb_driver = &qcdriver,
162172
.num_ports = 1,
163173
.probe = qcprobe,
174+
.open = usb_wwan_open,
175+
.close = usb_wwan_close,
176+
.write = usb_wwan_write,
177+
.write_room = usb_wwan_write_room,
178+
.chars_in_buffer = usb_wwan_chars_in_buffer,
179+
.attach = usb_wwan_startup,
180+
.disconnect = usb_wwan_disconnect,
181+
.release = usb_wwan_release,
182+
#ifdef CONFIG_PM
183+
.suspend = usb_wwan_suspend,
184+
.resume = usb_wwan_resume,
185+
#endif
164186
};
165187

166188
static int __init qcinit(void)

0 commit comments

Comments
 (0)