netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/5] cdc_mbim + qmi_wwan trivial fixes
@ 2013-11-01 13:18 Bjørn Mork
       [not found] ` <1383311936-20954-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Bjørn Mork @ 2013-11-01 13:18 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: Bjørn Mork, linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum

This series fixes three problems Oliver pointed out during the
review of the new huawei_cdc_ncm driver:
http://patchwork.ozlabs.org/patch/278903/

That innocent driver only used cdc_mbim as a blueprint, and
all the blame should really have gone to me....

I do have a similar fix for the manage_power issue in the
cdc-wdm USB class driver as well.  It will be submitted to
linux-usb as soon as Greg opens up his mailbox again :-)


Bjørn Mork (5):
  net: cdc_mbim: manage_power should always set needs_remote_wakeup
  net: qmi_wwan: manage_power should always set needs_remote_wakeup
  net: qmi_wwan: no need to check for resume if suspend exists
  net: cdc_mbim: no need to check for resume if suspend exists
  net: cdc_mbim: fixup error return value

 drivers/net/usb/cdc_mbim.c |   16 ++++++----------
 drivers/net/usb/qmi_wwan.c |   12 +++++-------
 2 files changed, 11 insertions(+), 17 deletions(-)

-- 
1.7.10.4

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next 1/5] net: cdc_mbim: manage_power should always set needs_remote_wakeup
       [not found] ` <1383311936-20954-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
@ 2013-11-01 13:18   ` Bjørn Mork
  2013-11-01 13:18   ` [PATCH net-next 2/5] net: qmi_wwan: " Bjørn Mork
  2013-11-01 13:18   ` [PATCH net-next 5/5] net: cdc_mbim: fixup error return value Bjørn Mork
  2 siblings, 0 replies; 7+ messages in thread
From: Bjørn Mork @ 2013-11-01 13:18 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: Bjørn Mork, linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum

Reported-by: Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org>
Signed-off-by: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
---
 drivers/net/usb/cdc_mbim.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 25ba7ec..172059e 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -42,13 +42,11 @@ static int cdc_mbim_manage_power(struct usbnet *dev, int on)
 	if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) {
 		/* need autopm_get/put here to ensure the usbcore sees the new value */
 		rv = usb_autopm_get_interface(dev->intf);
-		if (rv < 0)
-			goto err;
 		dev->intf->needs_remote_wakeup = on;
-		usb_autopm_put_interface(dev->intf);
+		if (!rv)
+			usb_autopm_put_interface(dev->intf);
 	}
-err:
-	return rv;
+	return 0;
 }
 
 static int cdc_mbim_wdm_manage_power(struct usb_interface *intf, int status)
-- 
1.7.10.4

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 2/5] net: qmi_wwan: manage_power should always set needs_remote_wakeup
       [not found] ` <1383311936-20954-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
  2013-11-01 13:18   ` [PATCH net-next 1/5] net: cdc_mbim: manage_power should always set needs_remote_wakeup Bjørn Mork
@ 2013-11-01 13:18   ` Bjørn Mork
  2013-11-01 13:18   ` [PATCH net-next 5/5] net: cdc_mbim: fixup error return value Bjørn Mork
  2 siblings, 0 replies; 7+ messages in thread
From: Bjørn Mork @ 2013-11-01 13:18 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: Bjørn Mork, linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum

Reported-by: Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org>
Signed-off-by: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
---
 drivers/net/usb/qmi_wwan.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index e0a4a2b..5dd0d85 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -149,7 +149,7 @@ static const struct net_device_ops qmi_wwan_netdev_ops = {
 static int qmi_wwan_manage_power(struct usbnet *dev, int on)
 {
 	struct qmi_wwan_state *info = (void *)&dev->data;
-	int rv = 0;
+	int rv;
 
 	dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__,
 		atomic_read(&info->pmcount), on);
@@ -160,13 +160,11 @@ static int qmi_wwan_manage_power(struct usbnet *dev, int on)
 		 * the new value
 		 */
 		rv = usb_autopm_get_interface(dev->intf);
-		if (rv < 0)
-			goto err;
 		dev->intf->needs_remote_wakeup = on;
-		usb_autopm_put_interface(dev->intf);
+		if (!rv)
+			usb_autopm_put_interface(dev->intf);
 	}
-err:
-	return rv;
+	return 0;
 }
 
 static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on)
-- 
1.7.10.4

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 3/5] net: qmi_wwan: no need to check for resume if suspend exists
  2013-11-01 13:18 [PATCH net-next 0/5] cdc_mbim + qmi_wwan trivial fixes Bjørn Mork
       [not found] ` <1383311936-20954-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
@ 2013-11-01 13:18 ` Bjørn Mork
  2013-11-01 13:18 ` [PATCH net-next 4/5] net: cdc_mbim: " Bjørn Mork
  2013-11-04 20:48 ` [PATCH net-next 0/5] cdc_mbim + qmi_wwan trivial fixes David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: Bjørn Mork @ 2013-11-01 13:18 UTC (permalink / raw)
  To: netdev; +Cc: Bjørn Mork, linux-usb, Oliver Neukum

Reported-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 drivers/net/usb/qmi_wwan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 5dd0d85..23bdd5b 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -416,7 +416,7 @@ static int qmi_wwan_resume(struct usb_interface *intf)
 	if (ret < 0)
 		goto err;
 	ret = usbnet_resume(intf);
-	if (ret < 0 && callsub && info->subdriver->suspend)
+	if (ret < 0 && callsub)
 		info->subdriver->suspend(intf, PMSG_SUSPEND);
 err:
 	return ret;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 4/5] net: cdc_mbim: no need to check for resume if suspend exists
  2013-11-01 13:18 [PATCH net-next 0/5] cdc_mbim + qmi_wwan trivial fixes Bjørn Mork
       [not found] ` <1383311936-20954-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
  2013-11-01 13:18 ` [PATCH net-next 3/5] net: qmi_wwan: no need to check for resume if suspend exists Bjørn Mork
@ 2013-11-01 13:18 ` Bjørn Mork
  2013-11-04 20:48 ` [PATCH net-next 0/5] cdc_mbim + qmi_wwan trivial fixes David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: Bjørn Mork @ 2013-11-01 13:18 UTC (permalink / raw)
  To: netdev; +Cc: Bjørn Mork, linux-usb, Oliver Neukum

Reported-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 drivers/net/usb/cdc_mbim.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 172059e..862d137 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -352,7 +352,7 @@ static int cdc_mbim_resume(struct usb_interface *intf)
 	if (ret < 0)
 		goto err;
 	ret = usbnet_resume(intf);
-	if (ret < 0 && callsub && info->subdriver->suspend)
+	if (ret < 0 && callsub)
 		info->subdriver->suspend(intf, PMSG_SUSPEND);
 err:
 	return ret;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 5/5] net: cdc_mbim: fixup error return value
       [not found] ` <1383311936-20954-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
  2013-11-01 13:18   ` [PATCH net-next 1/5] net: cdc_mbim: manage_power should always set needs_remote_wakeup Bjørn Mork
  2013-11-01 13:18   ` [PATCH net-next 2/5] net: qmi_wwan: " Bjørn Mork
@ 2013-11-01 13:18   ` Bjørn Mork
  2 siblings, 0 replies; 7+ messages in thread
From: Bjørn Mork @ 2013-11-01 13:18 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: Bjørn Mork, linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum

Reported-by: Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org>
Signed-off-by: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
---
 drivers/net/usb/cdc_mbim.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 862d137..166e195 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -311,15 +311,13 @@ error:
 
 static int cdc_mbim_suspend(struct usb_interface *intf, pm_message_t message)
 {
-	int ret = 0;
+	int ret = -ENODEV;
 	struct usbnet *dev = usb_get_intfdata(intf);
 	struct cdc_mbim_state *info = (void *)&dev->data;
 	struct cdc_ncm_ctx *ctx = info->ctx;
 
-	if (ctx == NULL) {
-		ret = -1;
+	if (!ctx)
 		goto error;
-	}
 
 	/*
 	 * Both usbnet_suspend() and subdriver->suspend() MUST return 0
-- 
1.7.10.4

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 0/5] cdc_mbim + qmi_wwan trivial fixes
  2013-11-01 13:18 [PATCH net-next 0/5] cdc_mbim + qmi_wwan trivial fixes Bjørn Mork
                   ` (2 preceding siblings ...)
  2013-11-01 13:18 ` [PATCH net-next 4/5] net: cdc_mbim: " Bjørn Mork
@ 2013-11-04 20:48 ` David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2013-11-04 20:48 UTC (permalink / raw)
  To: bjorn; +Cc: netdev, linux-usb, oneukum

From: Bjørn Mork <bjorn@mork.no>
Date: Fri,  1 Nov 2013 14:18:51 +0100

> This series fixes three problems Oliver pointed out during the
> review of the new huawei_cdc_ncm driver:
> http://patchwork.ozlabs.org/patch/278903/
> 
> That innocent driver only used cdc_mbim as a blueprint, and
> all the blame should really have gone to me....
> 
> I do have a similar fix for the manage_power issue in the
> cdc-wdm USB class driver as well.  It will be submitted to
> linux-usb as soon as Greg opens up his mailbox again :-)

Looks good, applied, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-04 20:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-01 13:18 [PATCH net-next 0/5] cdc_mbim + qmi_wwan trivial fixes Bjørn Mork
     [not found] ` <1383311936-20954-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2013-11-01 13:18   ` [PATCH net-next 1/5] net: cdc_mbim: manage_power should always set needs_remote_wakeup Bjørn Mork
2013-11-01 13:18   ` [PATCH net-next 2/5] net: qmi_wwan: " Bjørn Mork
2013-11-01 13:18   ` [PATCH net-next 5/5] net: cdc_mbim: fixup error return value Bjørn Mork
2013-11-01 13:18 ` [PATCH net-next 3/5] net: qmi_wwan: no need to check for resume if suspend exists Bjørn Mork
2013-11-01 13:18 ` [PATCH net-next 4/5] net: cdc_mbim: " Bjørn Mork
2013-11-04 20:48 ` [PATCH net-next 0/5] cdc_mbim + qmi_wwan trivial fixes David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).