mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: David Cohen <david.a.cohen@linux.intel.com>
Cc: <balbi@ti.com>, <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: gadget: call gadget driver's ->suspend/->resume
Date: Fri, 17 Apr 2015 14:43:27 -0500	[thread overview]
Message-ID: <20150417194327.GM2823@saruman.tx.rr.com> (raw)
In-Reply-To: <1429296116-3062-1-git-send-email-david.a.cohen@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2637 bytes --]

On Fri, Apr 17, 2015 at 11:41:56AM -0700, David Cohen wrote:
> From: Felipe Balbi <balbi@ti.com>

missing the required:

[ Upstream commit bc5ba2e0b829c9397f96df1191c7d2319ebc36d9 ]

> 
> When going into bus suspend/resume we _must_
> call gadget driver's ->suspend/->resume callbacks
> accordingly. This patch implements that very feature
> which has been missing forever.
> 
> Cc: <stable@vger.kernel.org> # 3.14
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
> ---
> 
> Hi,
> 
> This patch was introduced on v3.15.
> But the issue it fixes already existed on v3.14 and v3.14 is a long term
> support version.

Can you show me a log of this breaking anywhere ? Why do you consider
this a bug fix ? What sort of drawbacks did you notice ?

> I propose to backport it over there as well.
> 
> BR, David
> ---
> 
>  drivers/usb/dwc3/gadget.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 8f6738d46b14..1bb752736c32 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2012,6 +2012,24 @@ static void dwc3_disconnect_gadget(struct dwc3 *dwc)
>  	}
>  }
>  
> +static void dwc3_suspend_gadget(struct dwc3 *dwc)
> +{
> +	if (dwc->gadget_driver && dwc->gadget_driver->disconnect) {

you also need Dan Carperter's commit which fixes this cut & paste error.
That's commit 73a30bfc0d526db899033165db6f95c427e70505

> +		spin_unlock(&dwc->lock);
> +		dwc->gadget_driver->suspend(&dwc->gadget);
> +		spin_lock(&dwc->lock);
> +	}
> +}
> +
> +static void dwc3_resume_gadget(struct dwc3 *dwc)
> +{
> +	if (dwc->gadget_driver && dwc->gadget_driver->disconnect) {
> +		spin_unlock(&dwc->lock);
> +		dwc->gadget_driver->resume(&dwc->gadget);
> +		spin_lock(&dwc->lock);
> +	}
> +}
> +
>  static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum)
>  {
>  	struct dwc3_ep *dep;
> @@ -2391,6 +2409,23 @@ static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc,
>  
>  	dwc->link_state = next;
>  
> +	switch (next) {
> +	case DWC3_LINK_STATE_U1:
> +		if (dwc->speed == USB_SPEED_SUPER)
> +			dwc3_suspend_gadget(dwc);
> +		break;
> +	case DWC3_LINK_STATE_U2:
> +	case DWC3_LINK_STATE_U3:
> +		dwc3_suspend_gadget(dwc);
> +		break;
> +	case DWC3_LINK_STATE_RESUME:
> +		dwc3_resume_gadget(dwc);
> +		break;
> +	default:
> +		/* do nothing */
> +		break;
> +	}
> +
>  	dev_vdbg(dwc->dev, "%s link %d\n", __func__, dwc->link_state);
>  }

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-04-17 19:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17 18:41 David Cohen
2015-04-17 19:42 ` Greg KH
2015-04-23 22:39   ` David Cohen
2015-04-17 19:43 ` Felipe Balbi [this message]
2015-04-17 19:45   ` Felipe Balbi
2015-04-23 22:37   ` David Cohen
2015-04-24 19:48     ` Felipe Balbi
2015-04-24 20:56       ` David Cohen
2015-04-25 15:47         ` Felipe Balbi
2015-04-27 14:55           ` David Cohen
2015-04-27 15:51             ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150417194327.GM2823@saruman.tx.rr.com \
    --to=balbi@ti.com \
    --cc=david.a.cohen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome