Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755740AbcC2Cgl (ORCPT ); Mon, 28 Mar 2016 22:36:41 -0400 Received: from new2-smtp.messagingengine.com ([66.111.4.224]:47353 "EHLO new2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755587AbcC2Cgg (ORCPT ); Mon, 28 Mar 2016 22:36:36 -0400 X-Sasl-enc: eMufpxxzO/49Mgb7YEqfezALu20wNCSl0POSkS41g5U+ 1459218994 Date: Mon, 28 Mar 2016 19:36:32 -0700 Message-Id: In-Reply-To: References: From: John Youn To: linux-usb@vger.kernel.org To: Doug Anderson Cc: johnyoun@synopsys.com Cc: Felipe Balbi Cc: Stefan Wahren Cc: Michael Niewoehner Cc: Tao Huang Cc: Julius Werner Cc: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: Caesar Wang Cc: Heiko Stuebner Cc: Felipe Balbi Cc: Remi Pommarel Cc: Kever Yang Cc: Przemek Rudy Subject: [RFT PATCH 2/4] usb: dwc2: gadget: Only initialize device if in device mode Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 878 Lines: 28 In dwc2_hsotg_udc_start(), don't initialize the controller for device mode unless we are actually in device mode. Signed-off-by: John Youn --- drivers/usb/dwc2/gadget.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 818f158..181080b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3127,8 +3127,11 @@ static int dwc2_hsotg_udc_start(struct usb_gadget *gadget, otg_set_peripheral(hsotg->uphy->otg, &hsotg->gadget); spin_lock_irqsave(&hsotg->lock, flags); - dwc2_hsotg_init(hsotg); - dwc2_hsotg_core_init_disconnected(hsotg, false); + if (dwc2_hw_is_device(hsotg)) { + dwc2_hsotg_init(hsotg); + dwc2_hsotg_core_init_disconnected(hsotg, false); + } + hsotg->enabled = 0; spin_unlock_irqrestore(&hsotg->lock, flags); -- 2.7.4