From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Felipe Balbi <balbi@kernel.org>,
Wesley Cheng <quic_wcheng@quicinc.com>,
Saravana Kannan <saravanak@google.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Frank Li <Frank.li@nxp.com>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 5/7] usb: dwc3: qcom: Don't rely on drvdata during probe
Date: Fri, 21 Mar 2025 21:48:10 +0000 [thread overview]
Message-ID: <20250321214808.wckok22shw3mk76h@synopsys.com> (raw)
In-Reply-To: <20250318-dwc3-refactor-v5-5-90ea6e5b3ba4@oss.qualcomm.com>
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@oss.qualcomm.com>
> ---
> 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@synopsys.com>
Thanks,
Thinh
next prev parent reply other threads:[~2025-03-21 21:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 19:05 [PATCH v5 0/7] usb: dwc3: qcom: Flatten dwc3 structure Bjorn Andersson
2025-03-18 19:05 ` [PATCH v5 1/7] usb: dwc3: qcom: Snapshot driver for backwards compatibilty Bjorn Andersson
2025-03-21 21:44 ` Thinh Nguyen
2025-03-18 19:05 ` [PATCH v5 2/7] dt-bindings: usb: Introduce qcom,snps-dwc3 Bjorn Andersson
2025-03-20 14:21 ` neil.armstrong
2025-03-21 16:14 ` Rob Herring (Arm)
2025-03-18 19:05 ` [PATCH v5 3/7] usb: dwc3: core: Expose core driver as library Bjorn Andersson
2025-03-21 21:45 ` Thinh Nguyen
2025-03-18 19:05 ` [PATCH v5 4/7] usb: dwc3: core: Don't touch resets and clocks Bjorn Andersson
2025-03-19 15:52 ` neil.armstrong
2025-03-21 21:52 ` Thinh Nguyen
2025-03-21 21:47 ` Thinh Nguyen
2025-03-18 19:05 ` [PATCH v5 5/7] usb: dwc3: qcom: Don't rely on drvdata during probe Bjorn Andersson
2025-03-21 21:48 ` Thinh Nguyen [this message]
2025-03-18 19:05 ` [PATCH v5 6/7] usb: dwc3: qcom: Transition to flattened model Bjorn Andersson
2025-03-21 21:49 ` Thinh Nguyen
2025-03-18 19:05 ` [PATCH v5 7/7] arm64: dts: qcom: sc8280x: Flatten the USB nodes Bjorn Andersson
2025-03-18 22:26 ` [PATCH v5 0/7] usb: dwc3: qcom: Flatten dwc3 structure Rob Herring (Arm)
2025-03-19 14:17 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250321214808.wckok22shw3mk76h@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=Frank.li@nxp.com \
--cc=andersson@kernel.org \
--cc=balbi@kernel.org \
--cc=bjorn.andersson@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=quic_wcheng@quicinc.com \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®