Skip to contentSkip to conversation

staging: comedi: use __func__ instead of hardcoded function name

PATCH Superseded Dhiru Kholia 2 participants 3 messages Apr 29, 2017 – Apr 30, 2017 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: comedi: use __func__ instead of hardcoded function name

This coding style issue was found by checkpatch.pl script. Using __func__ instead of hardcoded function name should help in future refactoring of this code.

---
 drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/quatech_daqp_cs.c +1 -1
index 802f51e..ea194aa 100644
@@ -248,7 +248,7 @@ static irqreturn_t daqp_interrupt(int irq, void *dev_id)
 
 	if (loop_limit <= 0) {
 		dev_warn(dev->class_dev,
-			 "loop_limit reached in daqp_interrupt()\n");
+			 "loop_limit reached in %s()\n", __func__);
 		s->async->events |= COMEDI_CB_ERROR;
 	}
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 14 lines · Dhiru Kholia

This coding style issue was found by checkpatch.pl script. Using __func__ instead of hardcoded function name should help in future refactoring of this code.

---
 drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/quatech_daqp_cs.c +0 -0
index 802f51e..ea194aa 100644

drivers/staging/comedi/drivers/quatech_daqp_cs.c static irqreturn_t daqp_interrupt(int irq, void *dev_id) · line 251

Quoted 5 lines
drivers/staging/comedi/drivers/quatech_daqp_cs.c +1 -1
@@ -248,7 +248,7 @@ static irqreturn_t daqp_interrupt(int irq, void *dev_id)
 
 	if (loop_limit <= 0) {
 		dev_warn(dev->class_dev,
-			 "loop_limit reached in daqp_interrupt()\n");
+			 "loop_limit reached in %s()\n", __func__);

More common would be:

		dev_warn(dev->class_dev, "%s: loop limit reached\n", __func__);

It also seems that the loop_limit test, a loop count, is sensitive on the cpu frequency and perhaps should be some timer based limit instead.

#2 lore raw
Quoted 5 lines · Joe Perches
Quoted 4 lines · Dhiru Kholia

This coding style issue was found by checkpatch.pl script. Using __func__ instead of hardcoded function name should help in future refactoring of this code.

Quoted 7 lines

drivers/staging/comedi/drivers/quatech_daqp_cs.c static irqreturn_t daqp_interrupt(int irq, void *dev_id) · line 251

Quoted 4 lines
drivers/staging/comedi/drivers/quatech_daqp_cs.c +1 -1
 	if (loop_limit <= 0) {
 		dev_warn(dev->class_dev,
-			 "loop_limit reached in daqp_interrupt()\n");
+			 "loop_limit reached in %s()\n", __func__);

More common would be:

		dev_warn(dev->class_dev, "%s: loop limit reached\n", __func__);

Thanks for the feedback, Joe. I have sent out a v2 of this patch with this suggestion applied.

Quoted 3 lines

It also seems that the loop_limit test, a loop count, is sensitive on the cpu frequency and perhaps should be some timer based limit instead.

I am not familiar with this code at all. I am doing this patch as part of "The Eudyptula Challenge" (http://eudyptula-challenge.org/).

Thanks,
Dhiru