Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3175782lqp; Tue, 26 Mar 2024 01:29:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXwCs2bMMLLVy1i5cUhZ9Ypr3vdfeMNHavmiw5K2BrRBsBKvRRoW6rtw2OzMBqYsIAmOj65Xi015Cp9X0DXcCKamZ4ra/g2wHnjiM1MZA== X-Google-Smtp-Source: AGHT+IHLgR+0wO5d/OGurPLSsxV4KZRetbsw11zHCxmlJu+u9yaOdWeLcPxYYPsietUdMpYOvImA X-Received: by 2002:a9d:7541:0:b0:6e4:9456:6b04 with SMTP id b1-20020a9d7541000000b006e494566b04mr488089otl.5.1711441785880; Tue, 26 Mar 2024 01:29:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711441785; cv=pass; d=google.com; s=arc-20160816; b=vSaoWJHCQxQjHS6VI5gWv5LehJyC1jLSEMKOfcpaws0zrq+wg4dEoUoq4Y5SyCcyGY XeOhU19wit2qZ303Amq65FQu7WkShMxPloHyZmf1w6BL4BWWBB6ry0/h1H0LO8F4Wl8c 72wbN/nMMFmHICSH4Z6kFhd8TTWbRikhPNTffK488ObA3HybItQvEQiwLlJi3YHnn6BC sS+BQa6L34KfR4RQcJco4YE41GuIIl6o3xSIWQQVhAG8OfnheuOfhxrES8eT07Uki2BO lTHC5sE9T48FDmOnQ6FD8rQbDf/7P/tNGzF+AI/pVu6XgJdwujaDpVf3dVFu7VdtgekU rBaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HgOvvwt9Zt9mcnFdXz5U9NHiKv4T2aLuSWxxhZNDJkw=; fh=/YBeIKg4KLQmjoiEC0aOF3eSXVRe47DdDj+pbM6KgLg=; b=AU/vYhqkVFRxYdlV4yD3LLLPi0Ij5ARjplCVHMZP+k+tu09YeU/9/m4xavLbpDSPk6 8Vdfc0ttXYUEcTIHmiDnp+MT7w2AyM1fyglNnXuQ33H5cvvM67tCtjYsmD2ZSWWbrFDf Mzm7O1mUvFgIzaqcEZrQrJJ9h7BBYs5j6g2j7Up0YLf2vEqm4b9FQHX9CHxyHeqMHhWb kRIb7Lu3a9OJKE7lqQ2N1Oz833BcU4V+wU2xb+Qqk03i37Kmz6S+HgpxfnRb2hbqSW4Y zv4rja4OoKo1POq8ox3jWnQ3XeA99WuoD6OnYtwB57Lt4d8maMYoeCAS7Gj7vrwMtEw9 fVmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QPX+K2s6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-118539-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h126-20020a636c84000000b005e858e6fd4bsi9281581pgc.784.2024.03.26.01.29.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 01:29:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118539-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QPX+K2s6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-118539-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 60D0CB21FE1 for ; Tue, 26 Mar 2024 08:29:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E6021369B8; Tue, 26 Mar 2024 08:28:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QPX+K2s6" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FDA8134422; Tue, 26 Mar 2024 08:28:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711441712; cv=none; b=apgpVcIwBOAzF844+6yhSBortkIurwKa7OmMXkpRUJEFUI+b8NjQ764gQcel7kJ4OlYG2rP0To5+CXYSZ6o5zx4AHee8UMUpjE7mu/4FKEqpxoquSCDKSu5XiRACCSiyfOaGvfnICnT47GIS1Xs4R+Fe4iXTs1TQ7kwb3m/yTHk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711441712; c=relaxed/simple; bh=rAq3xkAVaETYPSPHUg5emdE8mb8m91SeBHFnjLnSNn8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SloYujdLCU+fF3FxFixPxdUOMrLqhMGBudM1MO/ZpMoCjGl2GJGdaPabkB66HHKqX+jdtXJZTWxNaGEPQiBIsBMA/v1QyZxmfNNsDHRgPNxq1mEfOkVm0sobCT0qSbIo7wq/iQsI5Fw5CLZMxwc9SK7yHzUf0YgRf3HJnzTAZhw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QPX+K2s6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AC61C43390; Tue, 26 Mar 2024 08:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711441712; bh=rAq3xkAVaETYPSPHUg5emdE8mb8m91SeBHFnjLnSNn8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QPX+K2s6Vr6NTDLfB3RrMOcdU+ZZLsM3yi6/UuG1rCLWGYX+tW6sSPLzry0FeTlqg P/ZWca+hJGB2i/WX4iK9602OM20iNmLSN2gdhbKNT9wIn2yp/uUJy++OrzzRuhRDqs ggx07RkbJigaK8eTh8Asbbpd29MpB7P34PzZMBU0NzxjJXhXbgvg7/7FZHo/3UTnhK JcKUrZ8WIA5I0UbhzsY9cEY3gg5rT0w1Stga4RJUAySOJ8nhfubewH1k6a6H283WWC pyoqRKPvhhYj2tsqznMU3vZqc9g4oP2xVCKmufFZ4UdB+fM6ttcXopv0p6gbxMNZMw O1nkLix+uYzWA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rp2Ag-0000000060q-3Qe3; Tue, 26 Mar 2024 09:28:39 +0100 Date: Tue, 26 Mar 2024 09:28:38 +0100 From: Johan Hovold To: Krishna Kurapati PSSNV Cc: Krzysztof Kozlowski , Rob Herring , Bjorn Andersson , Wesley Cheng , Konrad Dybcio , Greg Kroah-Hartman , Conor Dooley , Thinh Nguyen , Felipe Balbi , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, quic_ppratap@quicinc.com, quic_jackp@quicinc.com Subject: Re: [PATCH v16 7/9] usb: dwc3: qcom: Refactor IRQ handling in glue driver Message-ID: References: <20240307062052.2319851-1-quic_kriskura@quicinc.com> <20240307062052.2319851-8-quic_kriskura@quicinc.com> <50926b91-3c61-4dbf-85c9-7558ab96e628@quicinc.com> <807015d4-c5ed-4e04-9948-fd1ff894a04e@quicinc.com> <7b4a6d7f-76ad-471f-a178-dc598fbc0e22@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7b4a6d7f-76ad-471f-a178-dc598fbc0e22@quicinc.com> On Tue, Mar 26, 2024 at 01:41:52PM +0530, Krishna Kurapati PSSNV wrote: > On 3/26/2024 1:15 AM, Johan Hovold wrote: > > > Just change the logic in dwc3_qcom_find_num_ports() so that it returns 1 > > if "dp_hs_phy_1" is missing, and otherwise you determine the number of > > ports by iterating from 2 to DWC3_MAX_PORTS - 1. > I made this change and it works. Removed any return value check for the > find_num_ports call as it can return only 1/2/3/4 now. > > --- > irq = platform_get_irq_byname_optional(pdev, "qusb2_phy"); > if (irq > 0) > return 1; > > irq = platform_get_irq_byname_optional(pdev, "dp_hs_phy_irq"); > if (irq > 0) > return 1; As I mentioned above, these two lookups are no longer needed and should be removed. > irq = platform_get_irq_byname_optional(pdev, "dp_hs_phy_1"); > if (irq <= 0) > return 1; Just assume it's a single port controller unless "dp_hs_phy_1" is present. > for (port_index = 1; port_index < DWC3_MAX_PORTS - 1; > port_index++) { I think this would be more readable if you use port (num) as iterator (2..DWC3_MAX_PORTS) as you're returning a number of ports. > sprintf(irq_name, "dp_hs_phy_%d", port_index + 1); Then this would use just "port"; > > irq = platform_get_irq_byname_optional(pdev, irq_name); > if (irq <= 0) > return port_index; And return "port - 1" here. > } > > return DWC3_MAX_PORTS; Johan