diff options
| author | David S. Miller <davem@davemloft.net> | 2013-11-04 15:48:09 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-11-04 15:48:09 -0500 |
| commit | 6f9fed0bd2f82bafe1d8ab200916d9bd55b36c66 (patch) | |
| tree | b98db1c8f8f3f4d2ae128631c580c803ad0f705e | |
| parent | 96635fbd0b6c9113a374333092f40fc34fccb4f7 (diff) | |
| parent | e62416e8e4e086652cfc88b88921708964aac3b5 (diff) | |
Merge branch 'usbnet'
Bjørn Mork says:
====================
cdc_mbim + qmi_wwan trivial fixes
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 :-)
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/usb/cdc_mbim.c | 16 | ||||
| -rw-r--r-- | drivers/net/usb/qmi_wwan.c | 12 |
2 files changed, 11 insertions, 17 deletions
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index af76aaf08b6b..c9f3281506af 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c | |||
| @@ -44,13 +44,11 @@ static int cdc_mbim_manage_power(struct usbnet *dev, int on) | |||
| 44 | if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) { | 44 | if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) { |
| 45 | /* need autopm_get/put here to ensure the usbcore sees the new value */ | 45 | /* need autopm_get/put here to ensure the usbcore sees the new value */ |
| 46 | rv = usb_autopm_get_interface(dev->intf); | 46 | rv = usb_autopm_get_interface(dev->intf); |
| 47 | if (rv < 0) | ||
| 48 | goto err; | ||
| 49 | dev->intf->needs_remote_wakeup = on; | 47 | dev->intf->needs_remote_wakeup = on; |
| 50 | usb_autopm_put_interface(dev->intf); | 48 | if (!rv) |
| 49 | usb_autopm_put_interface(dev->intf); | ||
| 51 | } | 50 | } |
| 52 | err: | 51 | return 0; |
| 53 | return rv; | ||
| 54 | } | 52 | } |
| 55 | 53 | ||
| 56 | static int cdc_mbim_wdm_manage_power(struct usb_interface *intf, int status) | 54 | static int cdc_mbim_wdm_manage_power(struct usb_interface *intf, int status) |
| @@ -371,15 +369,13 @@ error: | |||
| 371 | 369 | ||
| 372 | static int cdc_mbim_suspend(struct usb_interface *intf, pm_message_t message) | 370 | static int cdc_mbim_suspend(struct usb_interface *intf, pm_message_t message) |
| 373 | { | 371 | { |
| 374 | int ret = 0; | 372 | int ret = -ENODEV; |
| 375 | struct usbnet *dev = usb_get_intfdata(intf); | 373 | struct usbnet *dev = usb_get_intfdata(intf); |
| 376 | struct cdc_mbim_state *info = (void *)&dev->data; | 374 | struct cdc_mbim_state *info = (void *)&dev->data; |
| 377 | struct cdc_ncm_ctx *ctx = info->ctx; | 375 | struct cdc_ncm_ctx *ctx = info->ctx; |
| 378 | 376 | ||
| 379 | if (ctx == NULL) { | 377 | if (!ctx) |
| 380 | ret = -1; | ||
| 381 | goto error; | 378 | goto error; |
| 382 | } | ||
| 383 | 379 | ||
| 384 | /* | 380 | /* |
| 385 | * Both usbnet_suspend() and subdriver->suspend() MUST return 0 | 381 | * Both usbnet_suspend() and subdriver->suspend() MUST return 0 |
| @@ -412,7 +408,7 @@ static int cdc_mbim_resume(struct usb_interface *intf) | |||
| 412 | if (ret < 0) | 408 | if (ret < 0) |
| 413 | goto err; | 409 | goto err; |
| 414 | ret = usbnet_resume(intf); | 410 | ret = usbnet_resume(intf); |
| 415 | if (ret < 0 && callsub && info->subdriver->suspend) | 411 | if (ret < 0 && callsub) |
| 416 | info->subdriver->suspend(intf, PMSG_SUSPEND); | 412 | info->subdriver->suspend(intf, PMSG_SUSPEND); |
| 417 | err: | 413 | err: |
| 418 | return ret; | 414 | return ret; |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index e0a4a2b08e45..23bdd5b9274d 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 = { | |||
| 149 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) | 149 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) |
| 150 | { | 150 | { |
| 151 | struct qmi_wwan_state *info = (void *)&dev->data; | 151 | struct qmi_wwan_state *info = (void *)&dev->data; |
| 152 | int rv = 0; | 152 | int rv; |
| 153 | 153 | ||
| 154 | dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, | 154 | dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, |
| 155 | atomic_read(&info->pmcount), on); | 155 | atomic_read(&info->pmcount), on); |
| @@ -160,13 +160,11 @@ static int qmi_wwan_manage_power(struct usbnet *dev, int on) | |||
| 160 | * the new value | 160 | * the new value |
| 161 | */ | 161 | */ |
| 162 | rv = usb_autopm_get_interface(dev->intf); | 162 | rv = usb_autopm_get_interface(dev->intf); |
| 163 | if (rv < 0) | ||
| 164 | goto err; | ||
| 165 | dev->intf->needs_remote_wakeup = on; | 163 | dev->intf->needs_remote_wakeup = on; |
| 166 | usb_autopm_put_interface(dev->intf); | 164 | if (!rv) |
| 165 | usb_autopm_put_interface(dev->intf); | ||
| 167 | } | 166 | } |
| 168 | err: | 167 | return 0; |
| 169 | return rv; | ||
| 170 | } | 168 | } |
| 171 | 169 | ||
| 172 | static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on) | 170 | static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on) |
| @@ -418,7 +416,7 @@ static int qmi_wwan_resume(struct usb_interface *intf) | |||
| 418 | if (ret < 0) | 416 | if (ret < 0) |
| 419 | goto err; | 417 | goto err; |
| 420 | ret = usbnet_resume(intf); | 418 | ret = usbnet_resume(intf); |
| 421 | if (ret < 0 && callsub && info->subdriver->suspend) | 419 | if (ret < 0 && callsub) |
| 422 | info->subdriver->suspend(intf, PMSG_SUSPEND); | 420 | info->subdriver->suspend(intf, PMSG_SUSPEND); |
| 423 | err: | 421 | err: |
| 424 | return ret; | 422 | return ret; |
