From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3D7DC3F6B0 for ; Mon, 8 Aug 2022 13:05:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243050AbiHHNFn (ORCPT ); Mon, 8 Aug 2022 09:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243073AbiHHNFm (ORCPT ); Mon, 8 Aug 2022 09:05:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA5DBAE; Mon, 8 Aug 2022 06:05:42 -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 ams.source.kernel.org (Postfix) with ESMTPS id BB096B80DDE; Mon, 8 Aug 2022 13:05:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF838C433C1; Mon, 8 Aug 2022 13:05:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659963939; bh=YopFz7vgFlUtdQVWfCGUYhY4nRi11uEOqzfp9ekNOZU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ddotj7ibW0VfGX2PLydzyRMIVLUENRDo5GSFrTqRtFurJHsF+YqCLSaIzWijv5dBQ ZYWlgM+95IjdUugnuiT7ojUfgExcacV1Yf2BzO5yI49/dKNX/VRRuKfXOaNnrpKO6p t5fpLEUUuSTv3wSo2EI7HFaTMxJ56VLyC2v4XAFM= Date: Mon, 8 Aug 2022 15:05:36 +0200 From: Greg Kroah-Hartman To: Johan Hovold Cc: 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: <20220804151001.23612-4-johan+linaro@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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. 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 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? 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? thanks, greg k-h