Re: [PATCH v9 06/10] usb: dwc3: qcom: Add support to read IRQ's related to multiport

From: Krishna Kurapati PSSNV
Date: Fri Jul 14 2023 - 06:41:26 EST




On 7/14/2023 2:35 PM, Johan Hovold wrote:
On Wed, Jul 12, 2023 at 11:56:33PM +0530, Krishna Kurapati PSSNV wrote:
On 7/12/2023 5:42 PM, Johan Hovold wrote:
On Wed, Jun 21, 2023 at 10:06:24AM +0530, Krishna Kurapati wrote:
Add support to read Multiport IRQ's related to quad port controller
of SA8295 Device.

Signed-off-by: Krishna Kurapati <quic_kriskura@xxxxxxxxxxx>
---
drivers/usb/dwc3/dwc3-qcom.c | 108 +++++++++++++++++++++++++++++------
1 file changed, 91 insertions(+), 17 deletions(-)

+static int dwc3_qcom_setup_mp_irq(struct platform_device *pdev)
+{
+ struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
+ char irq_name[15];

The interrupt device-name string can not be allocated on the stack or
reused as it is stored directly in each irqaction structure.

This can otherwise lead to random crashes when accessing
/proc/interrupts:

https://lore.kernel.org/lkml/ZK6IV_jJPICX5r53@xxxxxxxxxxxxxxxxxxxx/

Sure, will create a static array of names if possible in global
section of file and use it to read interrupts.

Or just use devm_kasprintf(), which should allow for a cleaner
implementation.

I've fixed it up like this for my X13s wip branches:

https://github.com/jhovold/linux/commit/0898b54456bc2f4bd4d420480db98e6758771ace
Are you fine with seperating out setup_irq and setup_mp_irq functions
? Can you please review comments and suggestion on [1].

I haven't had time to look at your latest replies yet, but as I already
said when reviewing v9, it seems you should be using a common helper for
non-mp and mp.

Hi Johan,

The gist of my mail was to see if I can defer qcom probe when dwc3 probe fails/or doesn't happen on of_plat_pop (which is logical) so that we can move setup_irq to after dwc3_register_core so that we know whether we are MP capable or not. This would help us move all IRQ reading into one function.

Regards,
Krishna,