diff mbox series

[02/12] usb: dwc3: qcom: Rename dwc3 platform_device reference

Message ID 20231016-dwc3-refactor-v1-2-ab4a84165470@quicinc.com
State New
Headers show
Series usb: dwc3: qcom: Flatten dwc3 structure | expand

Commit Message

Bjorn Andersson Oct. 17, 2023, 3:11 a.m. UTC
In preparation for the introduction of a direct reference to the struct
dwc3 in the dwc3_qcom struct, rename the generically named "dwc3" to
reduce the risk for confusion.

No functional change.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
---
 drivers/usb/dwc3/dwc3-qcom.c | 46 ++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

Comments

Konrad Dybcio Oct. 17, 2023, 4:08 p.m. UTC | #1
On 10/17/23 05:11, Bjorn Andersson wrote:
> In preparation for the introduction of a direct reference to the struct
> dwc3 in the dwc3_qcom struct, rename the generically named "dwc3" to
> reduce the risk for confusion.
> 
> No functional change.
> 
> Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
Johan Hovold Nov. 22, 2023, 9:58 a.m. UTC | #2
On Mon, Oct 16, 2023 at 08:11:10PM -0700, Bjorn Andersson wrote:
> In preparation for the introduction of a direct reference to the struct
> dwc3 in the dwc3_qcom struct, rename the generically named "dwc3" to
> reduce the risk for confusion.
> 
> No functional change.
> 
> Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
> ---
>  drivers/usb/dwc3/dwc3-qcom.c | 46 ++++++++++++++++++++++----------------------
>  1 file changed, 23 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 3de43df6bbe8..a31c3bc1f56e 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -67,7 +67,7 @@ struct dwc3_acpi_pdata {
>  struct dwc3_qcom {
>  	struct device		*dev;
>  	void __iomem		*qscratch_base;
> -	struct platform_device	*dwc3;
> +	struct platform_device	*dwc_dev;

Since "dev" is so overloaded, please name this one "dwc_pdev" instead.

>  	struct platform_device	*urs_usb;
>  	struct clk		**clks;
>  	int			num_clocks;
 
>  static enum usb_device_speed dwc3_qcom_read_usb2_speed(struct dwc3_qcom *qcom)
>  {
> -	struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3);
> +	struct dwc3 *dwc = platform_get_drvdata(qcom->dwc_dev);
>  	struct usb_device *udev;
>  	struct usb_hcd __maybe_unused *hcd;
>  
> @@ -486,7 +486,7 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup)
>  static irqreturn_t qcom_dwc3_resume_irq(int irq, void *data)
>  {
>  	struct dwc3_qcom *qcom = data;
> -	struct dwc3	*dwc = platform_get_drvdata(qcom->dwc3);
> +	struct dwc3	*dwc = platform_get_drvdata(qcom->dwc_dev);

Perhaps you can drop the tab while changing this line.

Johan
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 3de43df6bbe8..a31c3bc1f56e 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -67,7 +67,7 @@  struct dwc3_acpi_pdata {
 struct dwc3_qcom {
 	struct device		*dev;
 	void __iomem		*qscratch_base;
-	struct platform_device	*dwc3;
+	struct platform_device	*dwc_dev;
 	struct platform_device	*urs_usb;
 	struct clk		**clks;
 	int			num_clocks;
@@ -264,7 +264,7 @@  static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom)
 		goto put_path_ddr;
 	}
 
-	max_speed = usb_get_maximum_speed(&qcom->dwc3->dev);
+	max_speed = usb_get_maximum_speed(&qcom->dwc_dev->dev);
 	if (max_speed >= USB_SPEED_SUPER || max_speed == USB_SPEED_UNKNOWN) {
 		ret = icc_set_bw(qcom->icc_path_ddr,
 				USB_MEMORY_AVG_SS_BW, USB_MEMORY_PEAK_SS_BW);
@@ -312,7 +312,7 @@  static bool dwc3_qcom_is_host(struct dwc3_qcom *qcom)
 	/*
 	 * FIXME: Fix this layering violation.
 	 */
-	dwc = platform_get_drvdata(qcom->dwc3);
+	dwc = platform_get_drvdata(qcom->dwc_dev);
 
 	/* Core driver may not have probed yet. */
 	if (!dwc)
@@ -323,7 +323,7 @@  static bool dwc3_qcom_is_host(struct dwc3_qcom *qcom)
 
 static enum usb_device_speed dwc3_qcom_read_usb2_speed(struct dwc3_qcom *qcom)
 {
-	struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3);
+	struct dwc3 *dwc = platform_get_drvdata(qcom->dwc_dev);
 	struct usb_device *udev;
 	struct usb_hcd __maybe_unused *hcd;
 
@@ -486,7 +486,7 @@  static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup)
 static irqreturn_t qcom_dwc3_resume_irq(int irq, void *data)
 {
 	struct dwc3_qcom *qcom = data;
-	struct dwc3	*dwc = platform_get_drvdata(qcom->dwc3);
+	struct dwc3	*dwc = platform_get_drvdata(qcom->dwc_dev);
 
 	/* If pm_suspended then let pm_resume take care of resuming h/w */
 	if (qcom->pm_suspended)
@@ -672,19 +672,19 @@  static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
 	int			irq;
 	int			ret;
 
-	qcom->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO);
-	if (!qcom->dwc3)
+	qcom->dwc_dev = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO);
+	if (!qcom->dwc_dev)
 		return -ENOMEM;
 
-	qcom->dwc3->dev.parent = dev;
-	qcom->dwc3->dev.type = dev->type;
-	qcom->dwc3->dev.dma_mask = dev->dma_mask;
-	qcom->dwc3->dev.dma_parms = dev->dma_parms;
-	qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask;
+	qcom->dwc_dev->dev.parent = dev;
+	qcom->dwc_dev->dev.type = dev->type;
+	qcom->dwc_dev->dev.dma_mask = dev->dma_mask;
+	qcom->dwc_dev->dev.dma_parms = dev->dma_parms;
+	qcom->dwc_dev->dev.coherent_dma_mask = dev->coherent_dma_mask;
 
 	child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL);
 	if (!child_res) {
-		platform_device_put(qcom->dwc3);
+		platform_device_put(qcom->dwc_dev);
 		return -ENOMEM;
 	}
 
@@ -708,29 +708,29 @@  static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
 	child_res[1].flags = IORESOURCE_IRQ;
 	child_res[1].start = child_res[1].end = irq;
 
-	ret = platform_device_add_resources(qcom->dwc3, child_res, 2);
+	ret = platform_device_add_resources(qcom->dwc_dev, child_res, 2);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to add resources\n");
 		goto out;
 	}
 
-	ret = device_add_software_node(&qcom->dwc3->dev, &dwc3_qcom_swnode);
+	ret = device_add_software_node(&qcom->dwc_dev->dev, &dwc3_qcom_swnode);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to add properties\n");
 		goto out;
 	}
 
-	ret = platform_device_add(qcom->dwc3);
+	ret = platform_device_add(qcom->dwc_dev);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to add device\n");
-		device_remove_software_node(&qcom->dwc3->dev);
+		device_remove_software_node(&qcom->dwc_dev->dev);
 		goto out;
 	}
 	kfree(child_res);
 	return 0;
 
 out:
-	platform_device_put(qcom->dwc3);
+	platform_device_put(qcom->dwc_dev);
 	kfree(child_res);
 	return ret;
 }
@@ -754,8 +754,8 @@  static int dwc3_qcom_of_register_core(struct platform_device *pdev)
 		goto node_put;
 	}
 
-	qcom->dwc3 = of_find_device_by_node(dwc3_np);
-	if (!qcom->dwc3) {
+	qcom->dwc_dev = of_find_device_by_node(dwc3_np);
+	if (!qcom->dwc_dev) {
 		ret = -ENODEV;
 		dev_err(dev, "failed to get dwc3 platform device\n");
 	}
@@ -906,7 +906,7 @@  static int dwc3_qcom_probe(struct platform_device *pdev)
 	if (ret)
 		goto depopulate;
 
-	qcom->mode = usb_get_dr_mode(&qcom->dwc3->dev);
+	qcom->mode = usb_get_dr_mode(&qcom->dwc_dev->dev);
 
 	/* enable vbus override for device mode */
 	if (qcom->mode != USB_DR_MODE_HOST)
@@ -919,7 +919,7 @@  static int dwc3_qcom_probe(struct platform_device *pdev)
 
 	wakeup_source = of_property_read_bool(dev->of_node, "wakeup-source");
 	device_init_wakeup(&pdev->dev, wakeup_source);
-	device_init_wakeup(&qcom->dwc3->dev, wakeup_source);
+	device_init_wakeup(&qcom->dwc_dev->dev, wakeup_source);
 
 	qcom->is_suspended = false;
 	pm_runtime_set_active(dev);
@@ -953,7 +953,7 @@  static void dwc3_qcom_remove(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	int i;
 
-	device_remove_software_node(&qcom->dwc3->dev);
+	device_remove_software_node(&qcom->dwc_dev->dev);
 	if (np)
 		of_platform_depopulate(&pdev->dev);
 	else