From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932768Ab3K0BMG (ORCPT ); Tue, 26 Nov 2013 20:12:06 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39635 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758829Ab3K0A7s (ORCPT ); Tue, 26 Nov 2013 19:59:48 -0500 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Andrzej Siewior , Felipe Balbi Subject: [PATCH 3.12 108/116] usb: musb: dsps: move try_idle to start hook Date: Tue, 26 Nov 2013 16:58:01 -0800 Message-Id: <20131127005744.372284336@linuxfoundation.org> X-Mailer: git-send-email 1.8.5.rc3 In-Reply-To: <20131127005736.915454872@linuxfoundation.org> References: <20131127005736.915454872@linuxfoundation.org> User-Agent: quilt/0.60-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sebastian Andrzej Siewior commit 8b9fcce2d88586b9a120ff3e039d8f42413f0bb0 upstream. The timer is initialized right after musb is probed. There is actually no need to have this timer running because _nothing_ will happen until we have the gadget loaded. Also we need this timer only if we run in OTG mode _and_ we need it also after the gadget has been replaced with another one. I've been looking at am35x.c, da8xx.c, omap2430.c, tusb6010.c. da8xx seem to have the same problem as dsps and doing mostly the same thing. tusb6010 seem to do something different and do some actual "idle / power saving" work so I am not too comfortable to remove musb_platform_try_idle() from musb_gadget_setup(). Therefore this patch does not start the timer if there is no gadget active (which is at musb_gadget_setup() at time). In order to have the timer active after the gadget is loaded it will be triggered from dsps_musb_enable(). Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/musb_dsps.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -121,6 +121,7 @@ struct dsps_glue { unsigned long last_timer; /* last timer data for each instance */ }; +static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout); /** * dsps_musb_enable - enable interrupts */ @@ -143,6 +144,7 @@ static void dsps_musb_enable(struct musb /* Force the DRVVBUS IRQ so we can start polling for ID change. */ dsps_writel(reg_base, wrp->coreintr_set, (1 << wrp->drvvbus) << wrp->usb_shift); + dsps_musb_try_idle(musb, 0); } /** @@ -234,6 +236,9 @@ static void dsps_musb_try_idle(struct mu if (musb->port_mode == MUSB_PORT_MODE_HOST) return; + if (!musb->g.dev.driver) + return; + if (time_after(glue->last_timer, timeout) && timer_pending(&glue->timer)) { dev_dbg(musb->controller,