Re: [PATCH v5 5/7] usb: dwc3: qcom: Don't rely on drvdata during probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 18, 2025, Bjorn Andersson wrote:
> With the upcoming transition to a model where DWC3 core and glue operate
> on a single struct device the drvdata datatype will change to be owned
> by the core.
> 
> The drvdata is however used by the Qualcomm DWC3 glue to pass the qcom
> glue context around before the core is allocated.
> 
> Remove this problem, and clean up the code, by passing the dwc3_qcom
> struct around during probe, instead of acquiring it from the drvdata.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxxxxxxxx>
> ---
>  drivers/usb/dwc3/dwc3-qcom.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 79f3600f25c41a5ed770f164a03c7dc424b01440..9d04c2457433bd6bcd96c445f59d7f2a3c6fdf24 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -547,9 +547,10 @@ static int dwc3_qcom_request_irq(struct dwc3_qcom *qcom, int irq,
>  	return ret;
>  }
>  
> -static int dwc3_qcom_setup_port_irq(struct platform_device *pdev, int port_index, bool is_multiport)
> +static int dwc3_qcom_setup_port_irq(struct dwc3_qcom *qcom,
> +				    struct platform_device *pdev,
> +				    int port_index, bool is_multiport)
>  {
> -	struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
>  	const char *irq_name;
>  	int irq;
>  	int ret;
> @@ -634,9 +635,8 @@ static int dwc3_qcom_find_num_ports(struct platform_device *pdev)
>  	return DWC3_QCOM_MAX_PORTS;
>  }
>  
> -static int dwc3_qcom_setup_irq(struct platform_device *pdev)
> +static int dwc3_qcom_setup_irq(struct dwc3_qcom *qcom, struct platform_device *pdev)
>  {
> -	struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
>  	bool is_multiport;
>  	int ret;
>  	int i;
> @@ -645,7 +645,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
>  	is_multiport = (qcom->num_ports > 1);
>  
>  	for (i = 0; i < qcom->num_ports; i++) {
> -		ret = dwc3_qcom_setup_port_irq(pdev, i, is_multiport);
> +		ret = dwc3_qcom_setup_port_irq(qcom, pdev, i, is_multiport);
>  		if (ret)
>  			return ret;
>  	}
> @@ -700,9 +700,8 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count)
>  	return 0;
>  }
>  
> -static int dwc3_qcom_of_register_core(struct platform_device *pdev)
> +static int dwc3_qcom_of_register_core(struct dwc3_qcom *qcom, struct platform_device *pdev)
>  {
> -	struct dwc3_qcom	*qcom = platform_get_drvdata(pdev);
>  	struct device_node	*np = pdev->dev.of_node;
>  	struct device		*dev = &pdev->dev;
>  	int			ret;
> @@ -778,7 +777,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
>  		goto clk_disable;
>  	}
>  
> -	ret = dwc3_qcom_setup_irq(pdev);
> +	ret = dwc3_qcom_setup_irq(qcom, pdev);
>  	if (ret) {
>  		dev_err(dev, "failed to setup IRQs, err=%d\n", ret);
>  		goto clk_disable;
> @@ -793,7 +792,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
>  	if (ignore_pipe_clk)
>  		dwc3_qcom_select_utmi_clk(qcom);
>  
> -	ret = dwc3_qcom_of_register_core(pdev);
> +	ret = dwc3_qcom_of_register_core(qcom, pdev);
>  	if (ret) {
>  		dev_err(dev, "failed to register DWC3 Core, err=%d\n", ret);
>  		goto clk_disable;
> 
> -- 
> 2.48.1
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx>

Thanks,
Thinh




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux