[PATCH] net: usb: qmi_wwan: add wrappers for subdriver methods

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

 



Signed-off-by: Bjørn Mork <bjorn@xxxxxxx>
---
Missed this one.  Which you'll probably want if you are going to suspend 
the device.  And explains why I return the pointer to the cdc-wdm
driver.



 drivers/net/usb/qmi_wwan.c |   55 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 3fd1afb..8f32301 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -196,6 +196,53 @@ static void qmi_wwan_unbind_shared(struct usbnet *dev, struct usb_interface *int
 	wdm_deregister(intf);
 }
 
+/* need these wrappers to make cdc-wdm happy */
+static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message)
+{
+	struct usbnet *dev = usb_get_intfdata(intf);
+	struct usb_driver *subdriver = (void *)dev->data[0];
+	int ret;
+
+	ret = usbnet_suspend(intf, message);
+	if (subdriver && subdriver->suspend)
+		ret = subdriver->suspend(intf, message);
+	return ret;
+}
+
+static int qmi_wwan_resume(struct usb_interface *intf)
+{
+	struct usbnet *dev = usb_get_intfdata(intf);
+	struct usb_driver *subdriver = (void *)dev->data[0];
+	int ret;
+
+	ret = usbnet_resume(intf);
+	if (subdriver && subdriver->resume)
+		ret = subdriver->resume(intf);
+	return ret;
+}
+
+static int qmi_wwan_pre_reset(struct usb_interface *intf)
+{
+	struct usbnet *dev = usb_get_intfdata(intf);
+	struct usb_driver *subdriver = (void *)dev->data[0];
+	int ret = 0;
+
+	if (subdriver && subdriver->pre_reset)
+		ret = subdriver->pre_reset(intf);
+	return ret;
+}
+
+static int qmi_wwan_post_reset(struct usb_interface *intf)
+{
+	struct usbnet *dev = usb_get_intfdata(intf);
+	struct usb_driver *subdriver = (void *)dev->data[0];
+	int ret = 0;
+
+	if (subdriver && subdriver->post_reset)
+		ret = subdriver->post_reset(intf);
+	return ret;
+}
+
 /* stolen from cdc_ether.c */
 static int qmi_wwan_manage_power(struct usbnet *dev, int on)
 {
@@ -249,9 +296,11 @@ static struct usb_driver qmi_wwan_driver = {
 	.id_table	      = products,
 	.probe		      =	usbnet_probe,
 	.disconnect	      = usbnet_disconnect,
-	.suspend	      = usbnet_suspend,
-	.resume		      =	usbnet_resume,
-	.reset_resume         = usbnet_resume,
+	.suspend	      = qmi_wwan_suspend,
+	.resume		      =	qmi_wwan_resume,
+	.reset_resume         = qmi_wwan_resume,
+	.pre_reset	      =	qmi_wwan_pre_reset,
+	.post_reset	      =	qmi_wwan_post_reset,
 	.supports_autosuspend = 1,
 };
 
-- 
1.7.8.3

--
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