From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751565AbdAPKjc (ORCPT ); Mon, 16 Jan 2017 05:39:32 -0500 Received: from mga11.intel.com ([192.55.52.93]:40121 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750939AbdAPKja (ORCPT ); Mon, 16 Jan 2017 05:39:30 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,238,1477983600"; d="asc'?scan'208";a="1094673504" From: Felipe Balbi To: John Youn , Nicholas Mc Guire , John Youn Cc: Greg Kroah-Hartman , "linux-usb\@vger.kernel.org" , "linux-kernel\@vger.kernel.org" Subject: Re: [PATCH] usb: dwc2: host: use msleep() for long delays In-Reply-To: <8a11759b-116a-3210-0256-1b239813bc93@synopsys.com> References: <1484236443-32731-1-git-send-email-hofrat@osadl.org> <8a11759b-116a-3210-0256-1b239813bc93@synopsys.com> Date: Mon, 16 Jan 2017 12:37:30 +0200 Message-ID: <87mvermgt1.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, John Youn writes: > On 1/12/2017 7:52 AM, Nicholas Mc Guire wrote: >> ulseep_range() uses hrtimers and provides no advantage over msleep() >> for larger delays. Fix up the 20+ ms delays here passing the adjusted "m= in" >> value to msleep(). This helps reduce the load on the hrtimer subsystem. >>=20 >> Signed-off-by: Nicholas Mc Guire >> --- >>=20 >> Patch was compile tested with: x86_64_defconfig + CONFIG_USB_DWC2 >> (1 sparse and 6 coccinelle warning - preparing separate patches for that) >>=20 >> Patch is against 4.10-rc3 (localversion-next is next-20170112) >>=20 >> drivers/usb/dwc2/hcd.c | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >>=20 >> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c >> index 911c3b3..37ee72d 100644 >> --- a/drivers/usb/dwc2/hcd.c >> +++ b/drivers/usb/dwc2/hcd.c >> @@ -2150,7 +2150,7 @@ static int dwc2_hcd_endpoint_disable(struct dwc2_h= sotg *hsotg, >> } >>=20=20 >> spin_unlock_irqrestore(&hsotg->lock, flags); >> - usleep_range(20000, 40000); >> + msleep(20); >> spin_lock_irqsave(&hsotg->lock, flags); >> qh =3D ep->hcpriv; >> if (!qh) { >> @@ -3240,7 +3240,7 @@ static void dwc2_conn_id_status_change(struct work= _struct *work) >> "Waiting for Peripheral Mode, Mode=3D%s\n", >> dwc2_is_host_mode(hsotg) ? "Host" : >> "Peripheral"); >> - usleep_range(20000, 40000); >> + msleep(20); >> if (++count > 250) >> break; >> } >> @@ -3261,7 +3261,7 @@ static void dwc2_conn_id_status_change(struct work= _struct *work) >> dev_info(hsotg->dev, "Waiting for Host Mode, Mode=3D%s\n", >> dwc2_is_host_mode(hsotg) ? >> "Host" : "Peripheral"); >> - usleep_range(20000, 40000); >> + msleep(20); >> if (++count > 250) >> break; >> } >> @@ -3354,7 +3354,7 @@ static void dwc2_port_suspend(struct dwc2_hsotg *h= sotg, u16 windex) >>=20=20 >> spin_unlock_irqrestore(&hsotg->lock, flags); >>=20=20 >> - usleep_range(200000, 250000); >> + msleep(200); >> } else { >> spin_unlock_irqrestore(&hsotg->lock, flags); >> } >> @@ -3378,7 +3378,7 @@ static void dwc2_port_resume(struct dwc2_hsotg *hs= otg) >> pcgctl &=3D ~PCGCTL_STOPPCLK; >> dwc2_writel(pcgctl, hsotg->regs + PCGCTL); >> spin_unlock_irqrestore(&hsotg->lock, flags); >> - usleep_range(20000, 40000); >> + msleep(20); >> spin_lock_irqsave(&hsotg->lock, flags); >> } >>=20=20 >> @@ -3691,7 +3691,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg = *hsotg, u16 typereq, >> } >>=20=20 >> /* Clear reset bit in 10ms (FS/LS) or 50ms (HS) */ >> - usleep_range(50000, 70000); >> + msleep(50); >> hprt0 &=3D ~HPRT0_RST; >> dwc2_writel(hprt0, hsotg->regs + HPRT0); >> hsotg->lx_state =3D DWC2_L0; /* Now back to On state */ >>=20 > > +Felipe > > Acked-by: John Youn > > I've also fixed this up locally to apply against recent dwc2 patches > for next. > > Hi Felipe, > > If/when you queue the pending dwc2 patches on testing/next I can > resend this to you. it actually applied just fine ;-) =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlh8omoACgkQzL64meEa mQYdexAAzSAPiTbEFmpFtBd3pwGwbR2WED238vaerUAi75ZMPuRIvWn79fEv62Cb LeI2Pk6JXgoJw2GfZtkVyDpoTlqZRdydY3cOZUpaAamk6zjawc12/qnSijfdkIo+ g9rN66jeMbb/7R0lhvgtOM2SOHl9/MtJGR9RNzCfLuzoVg/7Fxij+NO/Ny3+52yc ki68Rlpxn2ySehkKsuqM9uKJeQLzKmv27xhc8TqW0Y3FD225nUJ498k5inIWEGN2 fPU7GgsNDJ2tCraUmxS0w1DlQcgh229XV+9s8ExI5YGI9AKkDqhoYgFZFSBrs64X Y4xZf+b6GfNAIZRBwLzEkKThH+bsvZTBvzz+hoVQtcLNPgHRMfzeocD3KdjrqOGw ckJyAou9VWEvKAXOQMmZBtH7135AzPhD3igwaq80dWo58rxYhXYTDumaw9Ifz/VT zyJow9anZ3norqKenJ3rxbFM+L9M58Nw6aWNlw8iB37SHkxb/TgeclB3DWBbIaXa 1uBDSgUdLs7HXO5mYpYZFd0FqZt4Egw0yOddP+TZRpjxCPcG1+B34KV/CPiD/ee8 YKSWcbCArbtsLdvqGkfr05b7n+e0qhXgxdFEoO14SHKDSMxzT8CA3hBhuZoic/Ru dB8NHPA3sM6IGGD4r8DkQsYodi5Ux8ER/vTEqn5djaG5Nx2REWM= =+64X -----END PGP SIGNATURE----- --=-=-=--