Skip to contentSkip to conversation

usb: dwc3: imx8mp: make dwc3_imx_glue_ops static and rename to imx8mp

PATCH In review Ben Dooks 4 participants 6 messages Jun 23 – Jun 30

Subsystems (3)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH v2 1/1 usb: dwc3: imx8mp: make dwc3_imx_glue_ops static and rename to imx8mp

The dwc3_imx_glue_ops is not used outside this file, and technically this is the dwc3-imx8mp driver so whilst making this static to avoid the following warning, rename it dwc3_imx8mp_glue_ops to distinguish it from the other driver which also has dwc3_imx_glue_ops.

Fixes:
drivers/usb/dwc3/dwc3-imx8mp.c:176:22: warning: symbol 'dwc3_imx_glue_ops' was not declared. Should it be static?

---
 drivers/usb/dwc3/dwc3-imx8mp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/dwc3/dwc3-imx8mp.c +4 -4
index 1cf96540b66e..de8c17bc940d 100644
@@ -158,7 +158,7 @@ static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx)
 	return IRQ_HANDLED;
 }
 
-static void dwc3_imx_pre_set_role(struct dwc3 *dwc, enum usb_role role)
+static void dwc3_imx8mp_pre_set_role(struct dwc3 *dwc, enum usb_role role)
 {
 	if (role == USB_ROLE_HOST)
 		/*
@@ -173,8 +173,8 @@ static void dwc3_imx_pre_set_role(struct dwc3 *dwc, enum usb_role role)
 		pm_runtime_use_autosuspend(dwc->dev);
 }
 
-struct dwc3_glue_ops dwc3_imx_glue_ops = {
-	.pre_set_role   = dwc3_imx_pre_set_role,
+static struct dwc3_glue_ops dwc3_imx8mp_glue_ops = {
+	.pre_set_role   = dwc3_imx8mp_pre_set_role,
 };
 
 static int dwc3_imx8mp_probe(struct platform_device *pdev)
@@ -266,7 +266,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
 		goto put_dwc3;
 	}
 
-	dwc3->glue_ops = &dwc3_imx_glue_ops;
+	dwc3->glue_ops = &dwc3_imx8mp_glue_ops;
 
 	if (dwc3->dr_mode == USB_DR_MODE_HOST)
 		pm_runtime_dont_use_autosuspend(dwc3->dev);
Signature · 1 line
2.37.2.352.g3c44437643
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The dwc3->glue_ops pointer is assigned after of_platform_populate() returns, creating a race condition where role switches can occur before the pre_set_role callback is registered. --

commit b965a813ee62bb063a7c9f8c07f1ddfe408ebc85
Author: Ben Dooks <[email protected]>

usb: dwc3: imx8mp: make dwc3_imx_glue_ops static and rename to imx8mp

This commit renames dwc3_imx_glue_ops to dwc3_imx8mp_glue_ops and makes it static to fix a sparse warning about an undeclared symbol.

Quoted 4 lines
drivers/usb/dwc3/dwc3-imx8mp.c +0 -0
index 1cf96540b66e4..de8c17bc940d2 100644

[ ... ]

drivers/usb/dwc3/dwc3-imx8mp.c static int dwc3_imx8mp_probe(struct platform_device *pdev) · line 269

Quoted 6 lines
drivers/usb/dwc3/dwc3-imx8mp.c +1 -1
@@ -266,7 +266,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
 		goto put_dwc3;
 	}
 
-	dwc3->glue_ops = &dwc3_imx_glue_ops;
+	dwc3->glue_ops = &dwc3_imx8mp_glue_ops;

[Severity: High]
This isn't a bug introduced by this patch, but is it possible for a role switch to occur before glue_ops is registered?

In dwc3_imx8mp_probe(), of_platform_populate() runs earlier and probes the dwc3 core, which registers its USB role switch. If a concurrent Type-C or extcon event triggers a role switch before dwc3->glue_ops is assigned here, dwc3_imx8mp_pre_set_role() won't be called.

Does this leave pm_runtime autosuspend enabled for the host role, potentially causing the XHCI controller to clear RUN_STOP and disable wakeups so it becomes unresponsive to device insertions?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Ben Dooks
Quoted 49 lines · Ben Dooks

The dwc3_imx_glue_ops is not used outside this file, and technically this is the dwc3-imx8mp driver so whilst making this static to avoid the following warning, rename it dwc3_imx8mp_glue_ops to distinguish it from the other driver which also has dwc3_imx_glue_ops.

Fixes:
drivers/usb/dwc3/dwc3-imx8mp.c:176:22: warning: symbol 'dwc3_imx_glue_ops' was not declared. Should it be static?

---
 drivers/usb/dwc3/dwc3-imx8mp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/dwc3/dwc3-imx8mp.c +4 -4
index 1cf96540b66e..de8c17bc940d 100644
@@ -158,7 +158,7 @@ static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx)
 	return IRQ_HANDLED;
 }
 
-static void dwc3_imx_pre_set_role(struct dwc3 *dwc, enum usb_role role)
+static void dwc3_imx8mp_pre_set_role(struct dwc3 *dwc, enum usb_role role)
 {
 	if (role == USB_ROLE_HOST)
 		/*
@@ -173,8 +173,8 @@ static void dwc3_imx_pre_set_role(struct dwc3 *dwc, enum usb_role role)
 		pm_runtime_use_autosuspend(dwc->dev);
 }
 
-struct dwc3_glue_ops dwc3_imx_glue_ops = {
-	.pre_set_role   = dwc3_imx_pre_set_role,
+static struct dwc3_glue_ops dwc3_imx8mp_glue_ops = {
+	.pre_set_role   = dwc3_imx8mp_pre_set_role,
 };
 
 static int dwc3_imx8mp_probe(struct platform_device *pdev)
@@ -266,7 +266,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
 		goto put_dwc3;
 	}
 
-	dwc3->glue_ops = &dwc3_imx_glue_ops;
+	dwc3->glue_ops = &dwc3_imx8mp_glue_ops;
 
 	if (dwc3->dr_mode == USB_DR_MODE_HOST)
 		pm_runtime_dont_use_autosuspend(dwc3->dev);
Signature · 1 line
2.37.2.352.g3c44437643

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/process/submitting-patches.rst for what needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot

maintainer
#3 lore raw
In reply to Ben Dooks
Quoted 49 lines · Ben Dooks

The dwc3_imx_glue_ops is not used outside this file, and technically this is the dwc3-imx8mp driver so whilst making this static to avoid the following warning, rename it dwc3_imx8mp_glue_ops to distinguish it from the other driver which also has dwc3_imx_glue_ops.

Fixes:
drivers/usb/dwc3/dwc3-imx8mp.c:176:22: warning: symbol 'dwc3_imx_glue_ops' was not declared. Should it be static?

---
 drivers/usb/dwc3/dwc3-imx8mp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/dwc3/dwc3-imx8mp.c +4 -4
index 1cf96540b66e..de8c17bc940d 100644
@@ -158,7 +158,7 @@ static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx)
 	return IRQ_HANDLED;
 }
 
-static void dwc3_imx_pre_set_role(struct dwc3 *dwc, enum usb_role role)
+static void dwc3_imx8mp_pre_set_role(struct dwc3 *dwc, enum usb_role role)
 {
 	if (role == USB_ROLE_HOST)
 		/*
@@ -173,8 +173,8 @@ static void dwc3_imx_pre_set_role(struct dwc3 *dwc, enum usb_role role)
 		pm_runtime_use_autosuspend(dwc->dev);
 }
 
-struct dwc3_glue_ops dwc3_imx_glue_ops = {
-	.pre_set_role   = dwc3_imx_pre_set_role,
+static struct dwc3_glue_ops dwc3_imx8mp_glue_ops = {
+	.pre_set_role   = dwc3_imx8mp_pre_set_role,
 };
 
 static int dwc3_imx8mp_probe(struct platform_device *pdev)
@@ -266,7 +266,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
 		goto put_dwc3;
 	}
 
-	dwc3->glue_ops = &dwc3_imx_glue_ops;
+	dwc3->glue_ops = &dwc3_imx8mp_glue_ops;
 
 	if (dwc3->dr_mode == USB_DR_MODE_HOST)
 		pm_runtime_dont_use_autosuspend(dwc3->dev);
Signature · 1 line
2.37.2.352.g3c44437643

Please add Fixes and Cc stable tags and backport this change also.

Thanks,
Thinh

author
#4 lore raw
Quoted 45 lines · Thinh Nguyen
Quoted 44 lines · Ben Dooks

The dwc3_imx_glue_ops is not used outside this file, and technically this is the dwc3-imx8mp driver so whilst making this static to avoid the following warning, rename it dwc3_imx8mp_glue_ops to distinguish it from the other driver which also has dwc3_imx_glue_ops.

Fixes:
drivers/usb/dwc3/dwc3-imx8mp.c:176:22: warning: symbol 'dwc3_imx_glue_ops' was not declared. Should it be static?

---
  drivers/usb/dwc3/dwc3-imx8mp.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/dwc3/dwc3-imx8mp.c +4 -4
index 1cf96540b66e..de8c17bc940d 100644
@@ -158,7 +158,7 @@ static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx)
  	return IRQ_HANDLED;
  }
 
-static void dwc3_imx_pre_set_role(struct dwc3 *dwc, enum usb_role role)
+static void dwc3_imx8mp_pre_set_role(struct dwc3 *dwc, enum usb_role role)
  {
  	if (role == USB_ROLE_HOST)
  		/*
@@ -173,8 +173,8 @@ static void dwc3_imx_pre_set_role(struct dwc3 *dwc, enum usb_role role)
  		pm_runtime_use_autosuspend(dwc->dev);
  }
 
-struct dwc3_glue_ops dwc3_imx_glue_ops = {
-	.pre_set_role   = dwc3_imx_pre_set_role,
+static struct dwc3_glue_ops dwc3_imx8mp_glue_ops = {
+	.pre_set_role   = dwc3_imx8mp_pre_set_role,
  };
 
  static int dwc3_imx8mp_probe(struct platform_device *pdev)
@@ -266,7 +266,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
  		goto put_dwc3;
  	}
 
-	dwc3->glue_ops = &dwc3_imx_glue_ops;
+	dwc3->glue_ops = &dwc3_imx8mp_glue_ops;
 
Quoted 7 lines
Quoted 5 lines
drivers/usb/dwc3/dwc3-imx8mp.c +0 -0
  	if (dwc3->dr_mode == USB_DR_MODE_HOST)
  		pm_runtime_dont_use_autosuspend(dwc3->dev);
Signature · 1 line
2.37.2.352.g3c44437643

Please add Fixes and Cc stable tags and backport this change also.

Hi, I thought fixes was only for bugs not warnings and stable is only for serious bugs?

Quoted 2 lines

Thanks,
Thinh

Signature · 4 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
maintainer
#5 lore raw
Quoted 49 lines · Ben Dooks
Quoted 39 lines · Thinh Nguyen
Quoted 38 lines · Ben Dooks

The dwc3_imx_glue_ops is not used outside this file, and technically this is the dwc3-imx8mp driver so whilst making this static to avoid the following warning, rename it dwc3_imx8mp_glue_ops to distinguish it from the other driver which also has dwc3_imx_glue_ops.

Fixes:
drivers/usb/dwc3/dwc3-imx8mp.c:176:22: warning: symbol 'dwc3_imx_glue_ops' was not declared. Should it be static?

---
  drivers/usb/dwc3/dwc3-imx8mp.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/dwc3/dwc3-imx8mp.c +3 -4
index 1cf96540b66e..de8c17bc940d 100644
@@ -158,7 +158,7 @@ static irqreturn_t dwc3_imx8mp_interrupt(int irq, void *_dwc3_imx)
  	return IRQ_HANDLED;
  }
-static void dwc3_imx_pre_set_role(struct dwc3 *dwc, enum usb_role role)
+static void dwc3_imx8mp_pre_set_role(struct dwc3 *dwc, enum usb_role role)
  {
  	if (role == USB_ROLE_HOST)
  		/*
@@ -173,8 +173,8 @@ static void dwc3_imx_pre_set_role(struct dwc3 *dwc, enum usb_role role)
  		pm_runtime_use_autosuspend(dwc->dev);
  }
-struct dwc3_glue_ops dwc3_imx_glue_ops = {
-	.pre_set_role   = dwc3_imx_pre_set_role,
+static struct dwc3_glue_ops dwc3_imx8mp_glue_ops = {
+	.pre_set_role   = dwc3_imx8mp_pre_set_role,
  };
  static int dwc3_imx8mp_probe(struct platform_device *pdev)
@@ -266,7 +266,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
  		goto put_dwc3;
  	}
-	dwc3->glue_ops = &dwc3_imx_glue_ops;
Quoted 8 lines
Quoted 6 lines
drivers/usb/dwc3/dwc3-imx8mp.c +1 -0
+	dwc3->glue_ops = &dwc3_imx8mp_glue_ops;
  	if (dwc3->dr_mode == USB_DR_MODE_HOST)
  		pm_runtime_dont_use_autosuspend(dwc3->dev);
Signature · 1 line
2.37.2.352.g3c44437643

Please add Fixes and Cc stable tags and backport this change also.

Quoted 4 lines

Hi, I thought fixes was only for bugs not warnings and stable is only for serious bugs?

Does it trigger -Werror build failure? If so, it should go in stable.

Thanks,
Thinh