Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10584109rwp; Fri, 21 Jul 2023 01:19:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlGUKlfKpvssFxGsKBAUjXAS9Yl7qqbrogUcSc7IGmLf3AA8qsnx+hVLq5sVsxA3+N2fi188 X-Received: by 2002:a05:6a20:ba84:b0:12c:c614:f55 with SMTP id fb4-20020a056a20ba8400b0012cc6140f55mr1251309pzb.43.1689927551547; Fri, 21 Jul 2023 01:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689927551; cv=none; d=google.com; s=arc-20160816; b=bHHm+30Tf3xNcFoPVvTxgzxnRL2hUX4DZD/CEgHnKh8ErjtXtcGtWzR446Yca/P6GD v5DG4HhlEA72RqLEGAfo8/4WqAD5kpYtrmsKOM2fHlxyRaLZVkSdhEDV06PguEsmWzXq hajfNZmVew+arHTQ/7RQ2gMlNJAHcvEJ6VY/X0FG+7t0kbQCL3jbKhtZ1TjsYuiDIsaA DeCQtQODxw/fGr5CVRAXco0zUAvQm7bpr95SfjR4iefGLWDwQXIEoip7iyr+qvLndUXw aVBDkYdkWEqzDFjLKTdDkyTpBAqS+GUln1ar/r5Jj0cmTfX3uIRyUkDpH5+j27zDD9GO /DCA== 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=BNgWD7XnPgJbL5yfB0GzDL9sK9grQuX+xQrntn4ZiJw=; fh=NuwzVEuV6GvY1PF4xfRex0iJqPMEvenFRxjocQchqrs=; b=EisC8kSpobWMKfXOS2Vu/EMEnPWZ0lyf8fiLEOuEk+Qhi/qEqL/ItKU0gH8kejj/AY URjpht7aWIS83G+tuzuru3Xy+0zQm5u1gU3rwDDMCXTRDermN6MqVTvk87QlIqKGqvIc fyK3eXTADeunZzVwzlVh/1UBSN/EoUQju5b3PfqvqowYFygxAAE2nDMtxyEyP5IZWVEV O0BF5exzIeDl5dLNIGP4qT9lOLlQSHNiuHHX+SMM3y25R9vGkWpYuFXNfTAwzOPUwnHg sm8Ja9I3ApTUh4ygkrWC6vrk+iNKm0+UDezLnTXsQYuGGdHuIz1SZoziXrarbPPgqDWS N+Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="kGu8eB//"; 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 j184-20020a6380c1000000b00553ced07d17si2447541pgd.123.2023.07.21.01.18.54; Fri, 21 Jul 2023 01:19:11 -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="kGu8eB//"; 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 S231426AbjGUIO4 (ORCPT + 99 others); Fri, 21 Jul 2023 04:14:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbjGUIOy (ORCPT ); Fri, 21 Jul 2023 04:14:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AFFA2727; Fri, 21 Jul 2023 01:14:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AB71261705; Fri, 21 Jul 2023 08:14:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3075C433C8; Fri, 21 Jul 2023 08:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689927284; bh=sFlXHCb5ZvFuWm824StAJi7e5LrCinNBnp51yxoySZ8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kGu8eB//nerrPvPDj1hCcc/PlC1GnAMZ+XCd5Pt9DcL5FtLuhrKtJSAxpqJKlapFL XlmzIX/SPU7ndFE1/f2YLm3lC9WhO+BXfUej+oQEo8h9s5IIMJ4DUNSCjdiQhos59Y SkOUNHcsP2HLqangqDzBuUgSvZQbMA3Vql8hRWo6wkZjGraxbkvcyA9AYZu+anE9+p qltWp6GBEWZF3wXVJQf5bPWM3OZ471Js05ABe4vKTiqXPqJkR6yfexQrsOQi/lNUDC zLervuL4tXGVwCd6MNDJYB8Vriyg8wS3dfaUAb0g6Yi0GniYPjUIFoJGN5v1WKh3iV 0EOqvnwbKwIuw== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qMlHp-0003Ms-1Q; Fri, 21 Jul 2023 10:14:53 +0200 Date: Fri, 21 Jul 2023 10:14:53 +0200 From: Johan Hovold To: Krishna Kurapati PSSNV Cc: Thinh Nguyen , Greg Kroah-Hartman , Philipp Zabel , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Felipe Balbi , Wesley Cheng , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, quic_pkondeti@quicinc.com, quic_ppratap@quicinc.com, quic_jackp@quicinc.com, quic_harshq@quicinc.com, ahalaney@redhat.com, quic_shazhuss@quicinc.com Subject: Re: [PATCH v9 06/10] usb: dwc3: qcom: Add support to read IRQ's related to multiport Message-ID: References: <20230621043628.21485-1-quic_kriskura@quicinc.com> <20230621043628.21485-7-quic_kriskura@quicinc.com> <7e32cf95-1565-5736-cc3e-c70e8d8f3ca7@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7e32cf95-1565-5736-cc3e-c70e8d8f3ca7@quicinc.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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, Jul 03, 2023 at 12:29:41AM +0530, Krishna Kurapati PSSNV wrote: > On 6/27/2023 8:01 PM, Johan Hovold wrote: > > On Wed, Jun 21, 2023 at 10:06:24AM +0530, Krishna Kurapati wrote: > >> +static int dwc3_qcom_setup_mp_irq(struct platform_device *pdev) > >> +{ > >> + struct dwc3_qcom *qcom = platform_get_drvdata(pdev); > >> + char irq_name[15]; > >> + int irq; > >> + int ret; > >> + int i; > >> + > >> + for (i = 0; i < 4; i++) { > > > > DWC3_MAX_PORTS here too and similar below. > > > >> + if (qcom->dp_hs_phy_irq[i]) > >> + continue; > > > > This is not very nice. You should try to integrate the current lookup > > code as I told you to do with the PHY lookups. That is, use a single > > loop for all HS/SS IRQs, and pick the legacy name if the number of ports > > is 1. > > > > Of course, you added the xhci capability parsing to the core driver so > > that information is not yet available, but you need it in the glue > > driver also... > > > > As I mentioned earlier, you can infer the number of ports from the > > interrupt names. Alternatively, you can infer it from the compatible > > string. In any case, you should not need to ways to determine the same > > information in the glue driver, then in the core part, and then yet > > again in the xhci driver... > The reason why I didn't integrate this with the original function was > the ACPI stuff. The MP devices have no ACPI variant. And I think for > clarity sake its best to keep these two functions separated. No. The ACPI stuff may make this a little harder to implement, but that's not a sufficient reason to not try to refactor things properly. > >> + > >> + sprintf(irq_name, "dp%d_hs_phy_irq", i+1); > > > > Spaces around binary operators. Does not checkpatch warn about that? > > > >> + irq = dwc3_qcom_get_irq(pdev, irq_name, -1); > >> + if (irq > 0) { > >> + irq_set_status_flags(irq, IRQ_NOAUTOEN); > >> + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, > >> + qcom_dwc3_resume_irq, > >> + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > >> + irq_name, qcom); > >> + if (ret) { > >> + dev_err(qcom->dev, "%s failed: %d\n", irq_name, ret); > >> + return ret; > >> + } > >> + } > >> + > >> + qcom->dp_hs_phy_irq[i] = irq; > >> + } > >> + > >> + for (i = 0; i < 4; i++) { > >> + if (qcom->dm_hs_phy_irq[i]) > >> + continue; > >> + > >> + sprintf(irq_name, "dm%d_hs_phy_irq", i+1); > >> + irq = dwc3_qcom_get_irq(pdev, irq_name, -1); > >> + if (irq > 0) { > >> + irq_set_status_flags(irq, IRQ_NOAUTOEN); > >> + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, > >> + qcom_dwc3_resume_irq, > >> + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > >> + irq_name, qcom); > >> + if (ret) { > >> + dev_err(qcom->dev, "%s failed: %d\n", irq_name, ret); > >> + return ret; > >> + } > >> + } > >> + > >> + qcom->dm_hs_phy_irq[i] = irq; > >> + } > >> + > >> + for (i = 0; i < 2; i++) { > >> + if (qcom->ss_phy_irq[i]) > >> + continue; > >> + > >> + sprintf(irq_name, "ss%d_phy_irq", i+1); > >> + irq = dwc3_qcom_get_irq(pdev, irq_name, -1); > >> + if (irq > 0) { > >> + irq_set_status_flags(irq, IRQ_NOAUTOEN); > >> + ret = devm_request_threaded_irq(qcom->dev, irq, NULL, > >> + qcom_dwc3_resume_irq, > >> + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > >> + irq_name, qcom); > >> + if (ret) { > >> + dev_err(qcom->dev, "%s failed: %d\n", irq_name, ret); > >> + return ret; > >> + } > >> + } > >> + > >> + qcom->ss_phy_irq[i] = irq; > >> + } > > > > So the above should all be merged in either a single helper looking up > > all the interrupts for a port and resused for the non-MP case. > > > I agree, Will merge all under some common helper function. Good. Johan