From: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
To: 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>
Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Subject: [PATCH v4 4/7] usb: dwc3: qcom: Don't rely on drvdata during probe
Date: Wed, 26 Feb 2025 16:17:51 -0800 [thread overview]
Message-ID: <20250226-dwc3-refactor-v4-4-4415e7111e49@oss.qualcomm.com> (raw)
In-Reply-To: <20250226-dwc3-refactor-v4-0-4415e7111e49@oss.qualcomm.com>
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 58683bb672e9..50b1da845113 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.45.2
next prev parent reply other threads:[~2025-02-27 0:11 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 0:17 [PATCH v4 0/7] usb: dwc3: qcom: Flatten dwc3 structure Bjorn Andersson
2025-02-27 0:17 ` [PATCH v4 1/7] dt-bindings: usb: Introduce qcom,snps-dwc3 Bjorn Andersson
2025-02-28 22:36 ` Rob Herring
2025-03-03 22:11 ` Bjorn Andersson
2025-02-27 0:17 ` [PATCH v4 2/7] usb: dwc3: core: Expose core driver as library Bjorn Andersson
2025-02-27 19:17 ` Frank Li
2025-02-27 0:17 ` [PATCH v4 3/7] usb: dwc3: core: Don't touch resets and clocks Bjorn Andersson
2025-02-27 4:24 ` Dmitry Baryshkov
2025-02-27 15:55 ` Bjorn Andersson
2025-02-27 16:07 ` Dmitry Baryshkov
2025-02-27 19:22 ` Frank Li
2025-02-27 0:17 ` Bjorn Andersson [this message]
2025-02-27 0:17 ` [PATCH v4 5/7] usb: dwc3: qcom: Snapshot driver for backwards compatibilty Bjorn Andersson
2025-03-04 0:05 ` Thinh Nguyen
2025-03-04 0:39 ` Thinh Nguyen
2025-03-04 3:13 ` Bjorn Andersson
2025-03-05 0:31 ` Thinh Nguyen
2025-03-06 22:49 ` Bjorn Andersson
2025-03-07 16:17 ` Frank Li
2025-03-07 23:00 ` Thinh Nguyen
2025-03-07 23:16 ` Thinh Nguyen
2025-03-11 3:06 ` Bjorn Andersson
2025-03-11 23:59 ` Thinh Nguyen
2025-02-27 0:17 ` [PATCH v4 6/7] usb: dwc3: qcom: Transition to flattened model Bjorn Andersson
2025-03-07 6:41 ` Dmitry Baryshkov
2025-03-11 2:46 ` Bjorn Andersson
2025-03-11 19:02 ` Dmitry Baryshkov
2025-03-18 19:12 ` Bjorn Andersson
2025-02-27 0:17 ` [PATCH v4 7/7] arm64: dts: qcom: sc8280x: Flatten the USB nodes Bjorn Andersson
2025-03-08 17:58 ` Konrad Dybcio
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=20250226-dwc3-refactor-v4-4-4415e7111e49@oss.qualcomm.com \
--to=bjorn.andersson@oss.qualcomm.com \
--cc=Frank.li@nxp.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=andersson@kernel.org \
--cc=balbi@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).