[PATCH 3/3] qcserial: Use generic USB wwan code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make qcserial use the generic USB wwan code. This should result in a
performance improvement.

Signed-off-by: Matthew Garrett <mjg@xxxxxxxxxx>
---

This also has the fringe benefit of working around the kfifo issue, although
I still have no idea what the root cause is there.

 drivers/usb/serial/Kconfig    |    1 +
 drivers/usb/serial/qcserial.c |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index f1c7fa0..1dd04c1 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -474,6 +474,7 @@ config USB_SERIAL_OTI6858
 
 config USB_SERIAL_QUALCOMM
 	tristate "USB Qualcomm Serial modem"
+	select USB_WWAN
 	help
 	  Say Y here if you have a Qualcomm USB modem device.  These are
 	  usually wireless cellular modems.
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 433137a..f47c49d 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -15,6 +15,7 @@
 #include <linux/tty_flip.h>
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
+#include <linux/usb/usb-wwan.h>
 
 #define DRIVER_AUTHOR "Qualcomm Inc"
 #define DRIVER_DESC "Qualcomm USB Serial driver"
@@ -95,6 +96,7 @@ static struct usb_driver qcdriver = {
 static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 {
 	struct usb_host_interface *intf = serial->interface->cur_altsetting;
+	struct usb_wwan_intf_private *data;
 	int retval = -ENODEV;
 	__u8 nintf;
 	__u8 ifnum;
@@ -106,6 +108,13 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 	ifnum = intf->desc.bInterfaceNumber;
 	dbg("This Interface = %d", ifnum);
 
+	data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private),
+					 GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	spin_lock_init(&data->susp_lock);
+
 	switch (nintf) {
 	case 1:
 		/* QDL mode */
@@ -168,8 +177,22 @@ static struct usb_serial_driver qcdevice = {
 	.usb_driver          = &qcdriver,
 	.num_ports           = 1,
 	.probe               = qcprobe,
+        .open		     = usb_wwan_open,
+        .close		     = usb_wwan_close,
+        .write		     = usb_wwan_write,
+        .write_room	     = usb_wwan_write_room,
+        .chars_in_buffer     = usb_wwan_chars_in_buffer,
+        .attach		     = usb_wwan_startup,
+        .disconnect	     = usb_wwan_disconnect,
+        .release	     = usb_wwan_release,
+#ifdef CONFIG_PM
+        .suspend	     = usb_wwan_suspend,
+        .resume		     = usb_wwan_resume,
+#endif
 };
 
+
+
 static int __init qcinit(void)
 {
 	int retval;
-- 
1.6.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux