Skip to contentSkip to conversation

usb: chipidea: Use dev_err() instead of pr_err()

PATCH Superseded Fabio Estevam 2 participants 4 messages Jun 5, 2019

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: chipidea: Use dev_err() instead of pr_err()

dev_err() is more appropriate for printing error messages inside drivers, so switch to dev_err().

While at it also add the missing newlines and remove 'device' string as the ci_role(ci)->name string will tell if it is host or gadget.

---
Changes since v1:
- Add missing newlines (Johan)
- Remove 'device' string

 drivers/usb/chipidea/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/chipidea/core.c +3 -2
index 27749ace2d93..92132b35b7fd 100644
@@ -523,8 +523,9 @@ int hw_device_reset(struct ci_hdrc *ci)
 	hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
 
 	if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
-		pr_err("cannot enter in %s device mode", ci_role(ci)->name);
-		pr_err("lpm = %i", ci->hw_bank.lpm);
+		dev_err(ci->dev, "cannot enter in %s mode\n",
+			ci_role(ci)->name);
+		dev_err(ci->dev, "lpm = %i\n", ci->hw_bank.lpm);
 		return -ENODEV;
 	}
 
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 21 lines · Fabio Estevam

dev_err() is more appropriate for printing error messages inside drivers, so switch to dev_err().

While at it also add the missing newlines and remove 'device' string as the ci_role(ci)->name string will tell if it is host or gadget.

---
Changes since v1:
- Add missing newlines (Johan)
- Remove 'device' string

 drivers/usb/chipidea/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/chipidea/core.c +0 -0
index 27749ace2d93..92132b35b7fd 100644

drivers/usb/chipidea/core.c int hw_device_reset(struct ci_hdrc *ci) · line 526

Quoted 6 lines
drivers/usb/chipidea/core.c +1 -2
@@ -523,8 +523,9 @@ int hw_device_reset(struct ci_hdrc *ci)
 	hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
 
 	if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
-		pr_err("cannot enter in %s device mode", ci_role(ci)->name);
-		pr_err("lpm = %i", ci->hw_bank.lpm);
+		dev_err(ci->dev, "cannot enter in %s mode\n",

You changed the string text, why?

thanks,

greg k-h

#2 lore raw

Hi Greg,

Quoted 7 lines · Greg KH
Quoted 7 lines
drivers/usb/chipidea/core.c +0 -0
index 27749ace2d93..92132b35b7fd 100644
@@ -523,8 +523,9 @@ int hw_device_reset(struct ci_hdrc *ci)
      hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
 
Quoted 6 lines

drivers/usb/chipidea/core.c int hw_device_reset(struct ci_hdrc *ci) · line 526

Quoted 4 lines
drivers/usb/chipidea/core.c +1 -2
      if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
-             pr_err("cannot enter in %s device mode", ci_role(ci)->name);
-             pr_err("lpm = %i", ci->hw_bank.lpm);
+             dev_err(ci->dev, "cannot enter in %s mode\n",

You changed the string text, why?

I mentioned this string change in the commit log.

Originally we could have the following error message:

cannot enter in host device mode

This "host device" message looks strange, so that's why I removed the "device" string.

If you prefer, I can split it in three patches (add newline, remove 'device' string, change to dev_err).

Thanks

maintainer
#3 lore raw
Quoted 18 lines · Fabio Estevam

Hi Greg,

Quoted 7 lines · Greg KH
Quoted 7 lines
drivers/usb/chipidea/core.c +0 -0
index 27749ace2d93..92132b35b7fd 100644
@@ -523,8 +523,9 @@ int hw_device_reset(struct ci_hdrc *ci)
      hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
 
Quoted 6 lines

drivers/usb/chipidea/core.c int hw_device_reset(struct ci_hdrc *ci) · line 526

Quoted 4 lines
drivers/usb/chipidea/core.c +1 -2
      if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
-             pr_err("cannot enter in %s device mode", ci_role(ci)->name);
-             pr_err("lpm = %i", ci->hw_bank.lpm);
+             dev_err(ci->dev, "cannot enter in %s mode\n",

You changed the string text, why?

Quoted 8 lines

I mentioned this string change in the commit log.

Originally we could have the following error message:

cannot enter in host device mode

This "host device" message looks strange, so that's why I removed the "device" string.

Why is it strange? Please just leave it as-is unless you know this change is ok.

Quoted 2 lines

If you prefer, I can split it in three patches (add newline, remove 'device' string, change to dev_err).

No, just one is fine, to dev_err(), but do not change the string.

thanks,

greg k-h