提交 6f9fed0b 编写于 作者: D David S. Miller

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: NDavid S. Miller <davem@davemloft.net>
...@@ -44,13 +44,11 @@ static int cdc_mbim_manage_power(struct usbnet *dev, int on) ...@@ -44,13 +44,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))) { 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 */ /* need autopm_get/put here to ensure the usbcore sees the new value */
rv = usb_autopm_get_interface(dev->intf); rv = usb_autopm_get_interface(dev->intf);
if (rv < 0)
goto err;
dev->intf->needs_remote_wakeup = on; dev->intf->needs_remote_wakeup = on;
usb_autopm_put_interface(dev->intf); if (!rv)
usb_autopm_put_interface(dev->intf);
} }
err: return 0;
return rv;
} }
static int cdc_mbim_wdm_manage_power(struct usb_interface *intf, int status) static int cdc_mbim_wdm_manage_power(struct usb_interface *intf, int status)
...@@ -371,15 +369,13 @@ static int cdc_mbim_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in) ...@@ -371,15 +369,13 @@ static int cdc_mbim_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
static int cdc_mbim_suspend(struct usb_interface *intf, pm_message_t message) 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 usbnet *dev = usb_get_intfdata(intf);
struct cdc_mbim_state *info = (void *)&dev->data; struct cdc_mbim_state *info = (void *)&dev->data;
struct cdc_ncm_ctx *ctx = info->ctx; struct cdc_ncm_ctx *ctx = info->ctx;
if (ctx == NULL) { if (!ctx)
ret = -1;
goto error; goto error;
}
/* /*
* Both usbnet_suspend() and subdriver->suspend() MUST return 0 * Both usbnet_suspend() and subdriver->suspend() MUST return 0
...@@ -412,7 +408,7 @@ static int cdc_mbim_resume(struct usb_interface *intf) ...@@ -412,7 +408,7 @@ static int cdc_mbim_resume(struct usb_interface *intf)
if (ret < 0) if (ret < 0)
goto err; goto err;
ret = usbnet_resume(intf); ret = usbnet_resume(intf);
if (ret < 0 && callsub && info->subdriver->suspend) if (ret < 0 && callsub)
info->subdriver->suspend(intf, PMSG_SUSPEND); info->subdriver->suspend(intf, PMSG_SUSPEND);
err: err:
return ret; return ret;
......
...@@ -149,7 +149,7 @@ static const struct net_device_ops qmi_wwan_netdev_ops = { ...@@ -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) static int qmi_wwan_manage_power(struct usbnet *dev, int on)
{ {
struct qmi_wwan_state *info = (void *)&dev->data; 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__, dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__,
atomic_read(&info->pmcount), on); atomic_read(&info->pmcount), on);
...@@ -160,13 +160,11 @@ static int qmi_wwan_manage_power(struct usbnet *dev, int on) ...@@ -160,13 +160,11 @@ static int qmi_wwan_manage_power(struct usbnet *dev, int on)
* the new value * the new value
*/ */
rv = usb_autopm_get_interface(dev->intf); rv = usb_autopm_get_interface(dev->intf);
if (rv < 0)
goto err;
dev->intf->needs_remote_wakeup = on; dev->intf->needs_remote_wakeup = on;
usb_autopm_put_interface(dev->intf); if (!rv)
usb_autopm_put_interface(dev->intf);
} }
err: return 0;
return rv;
} }
static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on) 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,7 +416,7 @@ static int qmi_wwan_resume(struct usb_interface *intf)
if (ret < 0) if (ret < 0)
goto err; goto err;
ret = usbnet_resume(intf); ret = usbnet_resume(intf);
if (ret < 0 && callsub && info->subdriver->suspend) if (ret < 0 && callsub)
info->subdriver->suspend(intf, PMSG_SUSPEND); info->subdriver->suspend(intf, PMSG_SUSPEND);
err: err:
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册