[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZgKHNuziNtBhGO9V@hovoldconsulting.com>
Date: Tue, 26 Mar 2024 09:28:38 +0100
From: Johan Hovold <johan@...nel.org>
To: Krishna Kurapati PSSNV <quic_kriskura@...cinc.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Wesley Cheng <quic_wcheng@...cinc.com>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Conor Dooley <conor+dt@...nel.org>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Felipe Balbi <balbi@...nel.org>, devicetree@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, quic_ppratap@...cinc.com,
quic_jackp@...cinc.com
Subject: Re: [PATCH v16 7/9] usb: dwc3: qcom: Refactor IRQ handling in glue
driver
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
Powered by blists - more mailing lists