Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4791911rwb; Mon, 8 Aug 2022 07:08:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR7K6JLVrm2T9Kc7qGB3++f0SLg4TP6fd0+lyXAiotOr+azPnTQyWuo2yXDGYpvDnP76/AQ2 X-Received: by 2002:a17:907:2c68:b0:730:9272:8c7f with SMTP id ib8-20020a1709072c6800b0073092728c7fmr14360613ejc.528.1659967734523; Mon, 08 Aug 2022 07:08:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659967734; cv=none; d=google.com; s=arc-20160816; b=G3ewxSJ/MrBzgwCCu5hJ62OB/6CvOgtN8UJHUgc1AxDSeGFwwZeB/KFb//O3cQ2zIA D9Wg64IVciwuAk2IR6gqFx3i0SmZSCgNy7bCBOj1CNk3PNVbjeJqmjb3HOMXS0eMYlu2 zfCp5qK7SPL4ZqG41+z9cUW3q5ifbicPgHbbTBmAjFJkBGmUou1l7TSYokcXWDJ9hptA p3bBYrONIWFlWUE9lO0p1iRu7wXMBH/mGO62zO2dH1/lnMS1+ln3vXEg3YN9syiIhAPy EF7UP8XUe8YdIFzSHi/Z1s2NhVt06cnk28VeF3Vpq1k5n9o/x18cD69E1BpWJ1L4PEgN AoPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fjOfTkFgE/9s13+D9kMINUm3YY6nbtZgYuI4XTq/a/g=; b=dypD00xgJhAJaba75tCZJldUrq1BhbSMBojuBoW6u7ebXqPeHRS6NzdhIzZg0C4S9V yIbic8czFV//TpZryJicx0MWg06x7Qjd33cxlKoRgTD81C6joMaSmxG1r8wa4FgOTFIQ q101DCYlnecnnk8kp+Vy80HI2chjKei/j59uw/TMOLwB9s+X4dnUmx+2amEFLi7dub+R Sat2I2kWG8ElXaKXyDhklwX7OOYvipvzcxzXXi5w4gqGSmhTCUXdKqx9wpBnoEASz2Wr JRXLe+fDemVQ6QKMJbWFO6Hnm8mEBrB+s6729EYk92DqSZ7AbkNIvI6rGs+hDpI30RKK TGuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PNifi5K7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr3-20020a1709073f8300b0073139f82da3si5915878ejc.184.2022.08.08.07.08.23; Mon, 08 Aug 2022 07:08:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PNifi5K7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243327AbiHHNeS (ORCPT + 99 others); Mon, 8 Aug 2022 09:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242958AbiHHNeQ (ORCPT ); Mon, 8 Aug 2022 09:34:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB93E62EE; Mon, 8 Aug 2022 06:34:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5732A61238; Mon, 8 Aug 2022 13:34:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF151C433D7; Mon, 8 Aug 2022 13:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659965654; bh=LBRn0PznnW2ya4z0sPhw5JpQP8WyMUBJTDHeeK7woag=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PNifi5K7Jm7FwC1RVc1vW5qDVCs/ySS9i+m27qTGqtkfGcc4xz6VIhzlEmRxwe8Q3 nAg/U8GrgNY/rVdyJ2vsNi3bAeQMsMgP0GvmjvZLo/KRbG/B2c6prdd1fINYg9Q5/b hljRnV2sqAH2kzmrBMezphZqMNo48qm5m+bxOb928n4i2+dSpwP0wyB/8/DSvMU0DJ xa0/qRasW0LXk+hLUkfB7FH5h0xMIW9zV+/Vp65qzeTziTKSC4e63dc0JVZY392KAI 4ETCV+JK93RyZWT0usaBxXV+lnZGzZKSrr8jxKzKisF6MG69DNA0ff/uu6q62eWWBK ommQpb0xEGG+Q== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1oL2tW-0000vp-Iv; Mon, 08 Aug 2022 15:34:11 +0200 Date: Mon, 8 Aug 2022 15:34:10 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Johan Hovold , Felipe Balbi , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Manivannan Sadhasivam , Konrad Dybcio , Krishna Kurapati , Stephen Boyd , Doug Anderson , Matthias Kaehlcke , Pavankumar Kondeti , quic_ppratap@quicinc.com, quic_vpulyala@quicinc.com, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Randy Dunlap Subject: Re: [PATCH v2 3/9] usb: dwc3: qcom: fix gadget-only builds Message-ID: References: <20220804151001.23612-1-johan+linaro@kernel.org> <20220804151001.23612-4-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 08, 2022 at 03:05:36PM +0200, Greg Kroah-Hartman wrote: > On Thu, Aug 04, 2022 at 05:09:55PM +0200, Johan Hovold wrote: > > A recent change added a dependency to the USB host stack and broke > > gadget-only builds of the driver. > > > > Fixes: 6895ea55c385 ("usb: dwc3: qcom: Configure wakeup interrupts during suspend") > > Reported-by: Randy Dunlap > > Signed-off-by: Johan Hovold > > --- > > > > Changes in v2 > > - new patch > > > > drivers/usb/dwc3/dwc3-qcom.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > > index be2e3dd36440..e9364141661b 100644 > > --- a/drivers/usb/dwc3/dwc3-qcom.c > > +++ b/drivers/usb/dwc3/dwc3-qcom.c > > @@ -310,8 +310,11 @@ static enum usb_device_speed dwc3_qcom_read_usb2_speed(struct dwc3_qcom *qcom) > > * currently supports only 1 port per controller. So > > * this is sufficient. > > */ > > +#ifdef CONFIG_USB > > udev = usb_hub_find_child(hcd->self.root_hub, 1); > > If a gadget driver needs this for some reason, then the #ifdef should be > put in a .h file, not in a .c file. Yeah, if we're keeping this long-term then yes, and possibly also otherwise. > But step back a minute and ask why a host-config-only function is being > called when a device is in gadget-only mode? This feels like a > design/logic issue in this file, NOT something to paper over with a > #ifdef in a .c file We're not as I'm fixing that bug in later in the series. I should probably have put this one after that fix, but figured fixing the build was more important than a harder-to-hit NULL-deref due to non-host mode not being considered when the offending series was merged. > This implies that if this device is NOT in a host configuration, then > the suspend path of it is not configured properly at all, as why would > it be checking or caring about this at all if this is in gadget-only > mode? Right, so see path 6/9 which addresses this by only calling this hack when in host mode: https://lore.kernel.org/all/20220804151001.23612-7-johan+linaro@kernel.org/ > Something else is wrong here, let's fix the root problem please. Maybe > this driver should just never be built in gadget-only mode, as it is > never intended to support that option? The problem is commit 6895ea55c385 ("usb: dwc3: qcom: Configure wakeup interrupts during suspend"), which I considered simply reverting but as that breaks suspend completely on some boards I decided to try and fix it up while we work on a proper long-term solution (i.e. for how the dwc/xhci layers should be communicating to implement this). Remember that it took two years and 21 revisions to get to the state we're at now after you merged the wakeup series in June. Johan