Skip to contentSkip to conversation

staging: comedi: Use '"%s:", __func__' instead of function name

PATCH Superseded Eisha Chen-yen-su 2 participants 3 messages Feb 18, 2018 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: comedi: Use '"%s:", __func__' instead of function name

The script "checkpatch.pl" pointed information out like the following:
WARNING: Prefer using '"%s...", __func__' to using 's626_ai_cmd', this function's name, in a string.

---
 drivers/staging/comedi/drivers/s626.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/s626.c +1 -1
index 0b3cfe934e14..ec54dc3e9ad6 100644
@@ -1700,7 +1700,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 
 	if (devpriv->ai_cmd_running) {
 		dev_err(dev->class_dev,
-			"s626_ai_cmd: Another ai_cmd is running\n");
+			"%s: Another ai_cmd is running\n", __func__);
 		return -EBUSY;
 	}
 	/* disable interrupt */

--
2.14.3

#1 lore raw
Quoted 3 lines · Eisha Chen-yen-su

The script "checkpatch.pl" pointed information out like the following:
WARNING: Prefer using '"%s...", __func__' to using 's626_ai_cmd', this function's name, in a string.

Thank you for the patch. The change looks fine, but the commit message could be improved. It is not clear what is meant by "information like the following". It suggests that checkpatch provided some other similar information, but for some reason you only addressed this case. The focus is furthermore too much on checkpatch, and not enough one what you did. The actual checkpatch message is indeed not very important. Instead, say what you did and why. And it should be stated in the imperative, as though you are telling git what to do. So it could be "Replace an occurrence of the function name in a string by a reference to __func__, to improve robustness. Problem found with checkpatch.".

julia

Quoted 29 lines
---
 drivers/staging/comedi/drivers/s626.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/s626.c +1 -2
index 0b3cfe934e14..ec54dc3e9ad6 100644
@@ -1700,7 +1700,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 
 	if (devpriv->ai_cmd_running) {
 		dev_err(dev->class_dev,
-			"s626_ai_cmd: Another ai_cmd is running\n");
+			"%s: Another ai_cmd is running\n", __func__);
 		return -EBUSY;
 	}
 	/* disable interrupt */
--

2.14.3

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20180218111041.7762-1-chenyensu0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 17 lines · On Sun, 18 Feb 2018 13:55:11 +0100 (CET) Julia Lawall <[email protected]>…
Quoted 3 lines · Eisha Chen-yen-su

The script "checkpatch.pl" pointed information out like the following:
WARNING: Prefer using '"%s...", __func__' to using 's626_ai_cmd', this function's name, in a string.

Thank you for the patch. The change looks fine, but the commit message could be improved. It is not clear what is meant by "information like the following". It suggests that checkpatch provided some other similar information, but for some reason you only addressed this case. The focus is furthermore too much on checkpatch, and not enough one what you did. The actual checkpatch message is indeed not very important. Instead, say what you did and why. And it should be stated in the imperative, as though you are telling git what to do. So it could be "Replace an occurrence of the function name in a string by a reference to __func__, to improve robustness. Problem found with checkpatch.".

Quoted 2 lines

julia

Thank you for the feedback. I will rephrase the commit message by sending a v2 of my patch.

Eisha

Quoted 29 lines
Quoted 29 lines
---
 drivers/staging/comedi/drivers/s626.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/s626.c +1 -2
index 0b3cfe934e14..ec54dc3e9ad6 100644
@@ -1700,7 +1700,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 
 	if (devpriv->ai_cmd_running) {
 		dev_err(dev->class_dev,
-			"s626_ai_cmd: Another ai_cmd is running\n");
+			"%s: Another ai_cmd is running\n", __func__);
 		return -EBUSY;
 	}
 	/* disable interrupt */
--

2.14.3

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20180218111041.7762-1-chenyensu0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.