Re: [PATCH v16 7/9] usb: dwc3: qcom: Refactor IRQ handling in glue driver

From: Krishna Kurapati PSSNV
Date: Tue Mar 26 2024 - 06:07:23 EST




On 3/26/2024 1:58 PM, Johan Hovold wrote:
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;

Ok,Thanks.

With the above fixed, can I put your RB tag given on [1] or will you be providing another one. Asking because when you gave that RB, this malformed DT thing wasn't there. So wanted to check with you before pushing the code.

[1]: https://lore.kernel.org/all/ZgFyukBXIIwZo7v-@xxxxxxxxxxxxxxxxxxxx/

Regards,
Krishna,