Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2812376lqp; Mon, 25 Mar 2024 09:52:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAgn2eM5DIMnFLGgle+5oOLVFu1GzeAElR9GajngYlT1C1jkAxi82H36ig2cfcKSxKdSqnEp+hNht7P2L+PluU2W5U7Ihpa7H/9YVLlA== X-Google-Smtp-Source: AGHT+IHGd+/wUivuKo1SxPt/IAEPDGp53HJm9BYTYl3Ld8kJVjE66926LOwuQoMjejOPB5KKofeN X-Received: by 2002:a17:903:2288:b0:1e0:b687:c5d1 with SMTP id b8-20020a170903228800b001e0b687c5d1mr5490953plh.64.1711385558534; Mon, 25 Mar 2024 09:52:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711385558; cv=pass; d=google.com; s=arc-20160816; b=D1z/6FS4b1ExKDGvQeN3PgzkafOhBg1VXX1iisHae7Y7NEA8iahtMqAZvNmSuY6Ovk 22zH/BH3xBSSAYhSt25CKXAtatvrqzjCLsCpxqFPssAf/DkPO0px5I56/+qU5k3b7LJl 3etsaYaMjkKbnwosUmUS9Krk91RoF5nv+XrJBXnVZFUnnOvnNSosjKOw3vX4nFHoLZap NGxE2O5RZ+xVeo2a4E8YnAN1Yni6dD73x/tES2G5k9CHQcPfpm8fhOn/K64Oku7K54OB tkSi37edmr9MP/HASkRNYmBvRLg1S3F9+H5O6SFnbOb+hVqoUEpdiMEsTa4F1aXtd42U PiLA== 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=8fXMet+05FbttyQmEsMhoKUB0wFLF/RFV4Gytj6X15U=; fh=PtsvmqCM8YUnL7H6HhLAss7sj5iFelJGGh0AaYWbgrU=; b=GzjyAiGwDq8g2i52RXG5mMQclRAbxfhDgNpIXFkzUJ4gg9WFq5zWiIfk+4zn2mns/f 6svTVNVOBiX30iPhEP0fCZo/mPYgfPEK47wpg5ZnMd07t4k9yG74tm0SqqrEItitugpz W2eCnJ2J1COmUaw+WtZMIbxoxOfFqcpQT5POgbsEhGljaJJ8kZH4AzlOgLgbxISjwR4h ZUInm+Q0YZXWUVkRPwSPocG0RlYdf7NFoPSfw4FJ2MggpmrxYjD/XeREg4CEab8cgVe7 yQo3xJjBnlm2ozYaQ6Rh8bG1WCBWhOr4RnagULFWJxQQ3CVGnsgwz+bTd0n0E9mp4eIz pFhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q0CfJBIT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117055-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117055-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 n14-20020a170903110e00b001e087e4558bsi5525151plh.542.2024.03.25.09.52.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 09:52:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117055-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=Q0CfJBIT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117055-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117055-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 5D5A7BA084D for ; Mon, 25 Mar 2024 15:28:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9416413E025; Mon, 25 Mar 2024 12:48:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q0CfJBIT" 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 AAC977440B; Mon, 25 Mar 2024 12:48:51 +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=1711370931; cv=none; b=hZKzIHODgqOyZF7L+3IEc2CLIG3DV3FB5YUzJx7QBJ8bloslk+HawjdFC3HT1X2b4Sju0YM/s2R+b75B4DgW9fC3Ogpekyet7o0val94xL6+mazgvcG1SZZg/pD4JJYALBhFQV043L3vx9UbAz5KB9fzf0bS6zNoDargCJ9nelo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711370931; c=relaxed/simple; bh=iRD16UiH7hTocRQ9SdX7iMdmAToWubYP+iIOkYgDzLQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bmNq0m8sQLmfYSqkHBcorMFzlcZI6KfOI4qOi+NK4lxVSbMhi1v/qsKIG46EsH3Ce0HMWbJMnMaEXtTtGuZHuXRKMI7wLeBLI5pqD73q4BjxErbSjSdVEj6r+5YurD/XX1dv+1zGEc307KLDNBjF6G/jGRybObnJZ5jOa70Ji08= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q0CfJBIT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B90DC433F1; Mon, 25 Mar 2024 12:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711370931; bh=iRD16UiH7hTocRQ9SdX7iMdmAToWubYP+iIOkYgDzLQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q0CfJBITHHlgzbXGUIqXuGHxZsFtaZAjXZsCOb44hqcSFKVOUea+fCBltGLe8T2Lc W/YlY6rIziro2yZhYt7f1cK4jXZuqERJRiSLryMwiPB5rbmA8rib43EgtBBXCNNu4C rjlgkDp5c9SAFeHRgq071PLm6ofKJmJIA01A+1cmXZJ9DaQomCmoWDoYDJNSI/tuHc ZZs2ToX8NBuo/bpyMtlf7LHisyL/jGr7jjbPVzw3Mk+zsn6JhndcYLxTsXaRhCufIT ycKGVVw4dfWedG+1c/+nqqM9DSwsalrSrfdu88uNP8CfBg4ZumIdg/cevcK2dZwvqa +KXI40WQWktdQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rojl4-000000001Up-0XcL; Mon, 25 Mar 2024 13:48:58 +0100 Date: Mon, 25 Mar 2024 13:48:58 +0100 From: Johan Hovold To: Krishna Kurapati 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> 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: <20240307062052.2319851-8-quic_kriskura@quicinc.com> On Thu, Mar 07, 2024 at 11:50:50AM +0530, Krishna Kurapati wrote: > On multiport supported controllers, each port has its own DP/DM > and SS (if super speed capable) interrupts. As per the bindings, > their interrupt names differ from standard ones having "_x" added > as suffix (x indicates port number). Identify from the interrupt > names whether the controller is a multiport controller or not. > Refactor dwc3_qcom_setup_irq() call to parse multiport interrupts > along with non-multiport ones accordingly.. > > Signed-off-by: Krishna Kurapati > --- > drivers/usb/dwc3/dwc3-qcom.c | 146 +++++++++++++++++++++++++++-------- > 1 file changed, 112 insertions(+), 34 deletions(-) This is much better. Just a couple of nits below. > +static int dwc3_qcom_find_num_ports(struct platform_device *pdev) > +{ > + const char *irq_name; > + int port_index; > + int irq; > + > + 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; > + > + for (port_index = 0; port_index < DWC3_MAX_PORTS; port_index++) { > + irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "dp_hs_phy_%d", port_index + 1); Please use a stack allocated buffer for these strings as we don't need them any more after this function returns. > + if (!irq_name) > + return -ENOMEM; > + > + irq = platform_get_irq_byname_optional(pdev, irq_name); > + if (irq <= 0) > + return port_index; > + } > + > + return port_index; I think explicitly returning DWC3_MAX_PORTS here would be more readable. > +} > + > +static int dwc3_qcom_setup_irq(struct platform_device *pdev) > +{ > + struct dwc3_qcom *qcom = platform_get_drvdata(pdev); > + bool is_multiport; > + int ret; > + int i; > + > + qcom->num_ports = dwc3_qcom_find_num_ports(pdev); > + if (qcom->num_ports < 0) > + return -ENOMEM; Just return 'ret' directly. > + > + is_multiport = (qcom->num_ports > 1) ? true : false; And no need for the ternary operator: is_multiport = (qcom->num_ports > 1); > + > + for (i = 0; i < qcom->num_ports; i++) { > + ret = dwc3_qcom_setup_port_irq(pdev, i, is_multiport); > if (ret) > return ret; > - qcom->ss_phy_irq = irq; > } > > return 0; With that fixed: Reviewed-by: Johan Hovold