lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZgKm89rq4D8SqYQL@hovoldconsulting.com>
Date: Tue, 26 Mar 2024 11:44:03 +0100
From: Johan Hovold <johan@...nel.org>
To: Krishna Kurapati <quic_kriskura@...cinc.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
	Rob Herring <robh@...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, Johan Hovold <johan+linaro@...nel.org>
Subject: Re: [PATCH v17 7/9] usb: dwc3: qcom: Refactor IRQ handling in glue
 driver

On Tue, Mar 26, 2024 at 03:58:07PM +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 <quic_kriskura@...cinc.com>
> Reviewed-by: Johan Hovold <johan+linaro@...nel.org>
> ---
>  drivers/usb/dwc3/dwc3-qcom.c | 137 ++++++++++++++++++++++++++---------
>  1 file changed, 103 insertions(+), 34 deletions(-) 

> -static int dwc3_qcom_setup_irq(struct platform_device *pdev)
> +static int dwc3_qcom_setup_port_irq(struct platform_device *pdev, int port_num, bool is_multiport)

Here you use "port_num", when it's really a (zero-based) port index.

Please change to "port_index".

>  {
>  	struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
> +	const char *irq_name;
>  	int irq;
>  	int ret;
>  
> -	irq = platform_get_irq_byname_optional(pdev, "qusb2_phy");
> +	if (is_multiport)
> +		irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "dp_hs_phy_%d", port_num + 1);
> +	else
> +		irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "dp_hs_phy_irq");
> +	if (!irq_name)
> +		return -ENOMEM;

> +static int dwc3_qcom_find_num_ports(struct platform_device *pdev)
> +{
> +	char irq_name[14];
> +	int port_index;
> +	int irq;
> +
> +	irq = platform_get_irq_byname_optional(pdev, "dp_hs_phy_1");
> +	if (irq <= 0)
> +		return 1;
> +
> +	for (port_index = 2; port_index <= DWC3_MAX_PORTS; port_index++) {

And here you use port_index, when it's really a one-based port number.

I explicitly used "port" when we discussed the update here for this
reason ("port_num" works too).

Please fix this last thing in a v18 and we're good to go.

> +		sprintf(irq_name, "dp_hs_phy_%d", port_index);
> +
> +		irq = platform_get_irq_byname_optional(pdev, irq_name);
> +		if (irq <= 0)
> +			return port_index - 1;
> +	}
> +
> +	return DWC3_MAX_PORTS;
> +}

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ