Skip to contentSkip to conversation

drivers/staging/vt6656/main_usb.c: checkpatch warning

PATCH In review Chewie Lin 2 participants 4 messages Apr 17, 2017 – Apr 18, 2017 Staging

lore
Share & tools
lore

Chewie Lin

author
#0 lore raw

cover drivers/staging/vt6656/main_usb.c: checkpatch warning

Hi All,

I'm submitting this patch as part of Eudyptula challenge to fix a coding style problem. Thanks for taking time on this trivial patch.

linsh

Chewie Lin (1):
drivers/staging/vt6656/main_usb.c: checkpatch warning

 drivers/staging/vt6656/main_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.12.2
author
#1 lore raw

PATCH 1/1 drivers/staging/vt6656/main_usb.c: checkpatch warning

Swap string in the dev_warn() call with __func__ argument, instead of explicitly calling the function name in the string:

WARNING: Prefer using "%s", __func__ to embedded function names #417: FILE: main_usb.c:417:
+ "usb_device_reset fail status=%d\n", status);

total: 0 errors, 1 warnings, 1058 lines checked

And after fix:

main_usb.c has no obvious style problems and is ready for submission.

---
 drivers/staging/vt6656/main_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/main_usb.c +1 -1
index 9e074e9daf4e..71c4511b4cff 100644
@@ -414,7 +414,7 @@ static void usb_device_reset(struct vnt_private *priv)
 	status = usb_reset_device(priv->usb);
 	if (status)
 		dev_warn(&priv->usb->dev,
-			 "usb_device_reset fail status=%d\n", status);
+			 "%s fail status=%d\n", __func__, status);
 }
 
 static void vnt_free_int_bufs(struct vnt_private *priv)
Signature · 1 line
2.12.2
#2 lore raw
Quoted 23 lines · Chewie Lin

Swap string in the dev_warn() call with __func__ argument, instead of explicitly calling the function name in the string:

WARNING: Prefer using "%s", __func__ to embedded function names #417: FILE: main_usb.c:417:
+ "usb_device_reset fail status=%d\n", status);

total: 0 errors, 1 warnings, 1058 lines checked

And after fix:

main_usb.c has no obvious style problems and is ready for submission.

---
 drivers/staging/vt6656/main_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/main_usb.c +0 -0
index 9e074e9daf4e..71c4511b4cff 100644

drivers/staging/vt6656/main_usb.c static void usb_device_reset(struct vnt_private *priv) · line 417

Quoted 5 lines
drivers/staging/vt6656/main_usb.c +1 -1
@@ -414,7 +414,7 @@ static void usb_device_reset(struct vnt_private *priv)
 	status = usb_reset_device(priv->usb);
 	if (status)
 		dev_warn(&priv->usb->dev,
-			 "usb_device_reset fail status=%d\n", status);
+			 "%s fail status=%d\n", __func__, status);

But the call that failed was called usb_device_reset(), right? Why is this function even needed at all, have the caller call the correct function instead please, and then this whole function can be deleted.

thanks,

greg k-h

author
#3 lore raw
Quoted 19 lines · Greg KH
Quoted 18 lines · Chewie Lin

Swap string in the dev_warn() call with __func__ argument, instead of explicitly calling the function name in the string:

WARNING: Prefer using "%s", __func__ to embedded function names #417: FILE: main_usb.c:417:
+ "usb_device_reset fail status=%d\n", status);

total: 0 errors, 1 warnings, 1058 lines checked

And after fix:

main_usb.c has no obvious style problems and is ready for submission.

---
 drivers/staging/vt6656/main_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

drivers/staging/vt6656/main_usb.c static void usb_device_reset(struct vnt_private *priv) · line 417

Quoted 10 lines
drivers/staging/vt6656/main_usb.c +1 -1
index 9e074e9daf4e..71c4511b4cff 100644
@@ -414,7 +414,7 @@ static void usb_device_reset(struct vnt_private *priv)
 	status = usb_reset_device(priv->usb);
 	if (status)
 		dev_warn(&priv->usb->dev,
-			 "usb_device_reset fail status=%d\n", status);
+			 "%s fail status=%d\n", __func__, status);

But the call that failed was called usb_device_reset(), right? Why is this function even needed at all, have the caller call the correct function instead please, and then this whole function can be deleted.

thanks greg.
Yes, I think that's a good approach as well. I initially wanted to fix a coding style problem without touching the function calls, but I can definitely do that as well.

linsh