Skip to contentSkip to conversation

fix misspelling of current function in string

PATCH Applied Julia Lawall 16 participants 56 messages Dec 7, 2014 – Feb 6, 2015

Subsystems (17)
lore
Share & tools
lore
#0 lore raw

cover fix misspelling of current function in string

These patches replace what appears to be a reference to the name of the current function but is misspelled in some way by either the name of the function itself, or by %s and then __func__ in an argument list.

// <smpl>
// sudo apt-get install python-pip
// sudo pip install python-Levenshtein
// spatch requires the argument --in-place

virtual after_start

@initialize:ocaml@
@@

let extensible_functions = ref ([] : string list)
let restarted = ref false

let restart _ =
restarted := true;
let it = new iteration() in
it#add_virtual_rule After_start;
Printf.eprintf "restarting\n";
it#register()

@initialize:python@
@@
import re
from Levenshtein import distance
mindist = 1 // 1 to find only misspellings
maxdist = 2
ignore_leading = True

// ---------------------------------------------------------------------

@r0@
constant char [] c;
identifier f;
@@

f(...,c,...)

@script:ocaml@
c << r0.c;
f << r0.f;
@@

(if not !restarted then restart());
match Str.split_delim (Str.regexp "%") c with
_::_::_ ->
if not (List.mem f !extensible_functions)
then extensible_functions := f :: !extensible_functions
| _ -> ()

// ---------------------------------------------------------------------

@r depends on after_start@
constant char [] c;
position p;
identifier f;
@@

f(...,c@p,...)

@script:python flt@
c << r.c;
p << r.p;
matched;
@@

func = p[0].current_element
wpattern = "[a-zA-Z_][a-zA-Z0-9_]*"
if ignore_leading:
func = func.strip("_")
wpattern = "[a-zA-Z][a-zA-Z0-9_]*"
lf = len(func)
cocci.include_match(False)
// ignore extremely short function names
if lf > 3:
words = [w for w in re.findall(wpattern, c) if abs(len(w) - lf) <= maxdist] for w in words:
d = distance(w, func)
if mindist <= d and d <= maxdist:
coccinelle.matched = w
cocci.include_match(True)
//print "%s:%d:%s():%d: %s" % (p[0].file, int(p[0].line), func, d, c) break

@script:ocaml r2@
c << r.c;
f << r.f;
matched << flt.matched;
fixed;
@@

let pieces = Str.split_delim (Str.regexp_string matched) c in match pieces with
[before;after] ->
let preceeding =
List.length(Str.split (Str.regexp_string "%") before) > 1 in
if preceeding
then Coccilib.include_match false
else
if List.mem f !extensible_functions
then fixed := before ^ "%s" ^ after
else Coccilib.include_match false
| _ -> Coccilib.include_match false

@changed1@
constant char [] r.c;
identifier r2.fixed;
position r.p;
identifier r.f;
@@

f(...,
-c@p
+fixed,__func__
,...)

// -------------------------------------------------------------------

@s depends on after_start@
constant char [] c;
position p;
identifier f;
@@

f(...,c@p,...)

@script:python flt2@
c << s.c;
p << s.p;
matched;
@@

func = p[0].current_element
wpattern = "[a-zA-Z_][a-zA-Z0-9_]*"
if ignore_leading:
func = func.strip("_")
wpattern = "[a-zA-Z][a-zA-Z0-9_]*"
lf = len(func)
cocci.include_match(False)
// ignore extremely short function names
if lf > 3:
words = [w for w in re.findall(wpattern, c) if abs(len(w) - lf) <= maxdist] for w in words:
d = distance(w, func)
if mindist <= d and d <= maxdist:
coccinelle.matched = w
cocci.include_match(True)
//print "%s:%d:%s():%d: %s" % (p[0].file, int(p[0].line), func, d, c) break

@script:ocaml s2@
c << s.c;
f << s.f;
p << s.p;
matched << flt2.matched;
fixed;
@@

let ce = (List.hd p).current_element in
let pieces = Str.split_delim (Str.regexp_string matched) c in match pieces with
[before;after] ->
let preceeding =
List.length(Str.split (Str.regexp_string "%") before) > 1 in
if preceeding
then Coccilib.include_match false
else
if List.mem f !extensible_functions
then Coccilib.include_match false
else fixed := before ^ ce ^ after
| _ -> Coccilib.include_match false

@changed2@
constant char [] s.c;
identifier s2.fixed;
position s.p;
identifier s.f;
@@

f(...,
-c@p
+fixed
,...)
// </smpl>

#1 lore raw

PATCH 1/20 mtd: s3c2410: fix misspelling of current function in string

Replace a misspelled function name by %s and then __func__.

s3c2410 is the name of the file, but using the exact function name should make it easier to connect the error message to the code.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/mtd/nand/s3c2410.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/s3c2410.c +1 -1
index 35aef5e..0a9c41f 100644
@@ -948,7 +948,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
 
 	cpu_type = platform_get_device_id(pdev)->driver_data;
 
-	pr_debug("s3c2410_nand_probe(%p)\n", pdev);
+	pr_debug("%s(%p)\n", __func__, pdev);
 
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
 	if (info = NULL) {
#2 lore raw

Re: [PATCH 1/20] mtd: s3c2410: fix misspelling of current function in string

Quoted 22 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

s3c2410 is the name of the file, but using the exact function name should make it easier to connect the error message to the code.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/mtd/nand/s3c2410.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/s3c2410.c +0 -0
index 35aef5e..0a9c41f 100644

drivers/mtd/nand/s3c2410.c static int s3c24xx_nand_probe(struct platform_device *pdev) · line 951

Quoted 5 lines
drivers/mtd/nand/s3c2410.c +1 -1
@@ -948,7 +948,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
 
        cpu_type = platform_get_device_id(pdev)->driver_data;
 
-       pr_debug("s3c2410_nand_probe(%p)\n", pdev);
+       pr_debug("%s(%p)\n", __func__, pdev);

I think we can drop the line completely.
We have ftrace to trace function calls...

Signature · 2 lines
Thanks,
//richard
#3 lore raw

Re: [PATCH 1/20] mtd: s3c2410: fix misspelling of current function in string

Quoted 6 lines
Quoted 6 lines
drivers/mtd/nand/s3c2410.c +0 -0
index 35aef5e..0a9c41f 100644
@@ -948,7 +948,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
 
Quoted 7 lines

drivers/mtd/nand/s3c2410.c static int s3c24xx_nand_probe(struct platform_device *pdev) · line 951

Quoted 4 lines
drivers/mtd/nand/s3c2410.c +1 -1
        cpu_type = platform_get_device_id(pdev)->driver_data;
 
-       pr_debug("s3c2410_nand_probe(%p)\n", pdev);
+       pr_debug("%s(%p)\n", __func__, pdev);

I think we can drop the line completely.
We have ftrace to trace function calls...

Should the "initialised ok" at the end of the function be remove as well?

Will it be confusing if this cleanup is done in this function, but not in others where it may be useful? Perhaps s3c2410_nand_update_chip, for example?

julia

#4 lore raw

Re: [PATCH 1/20] mtd: s3c2410: fix misspelling of current function in string

Am 08.12.2014 um 08:11 schrieb Julia Lawall:

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
drivers/mtd/nand/s3c2410.c +0 -0
index 35aef5e..0a9c41f 100644
@@ -948,7 +948,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
 
Quoted 7 lines

drivers/mtd/nand/s3c2410.c static int s3c24xx_nand_probe(struct platform_device *pdev) · line 951

Quoted 4 lines
drivers/mtd/nand/s3c2410.c +1 -1
        cpu_type = platform_get_device_id(pdev)->driver_data;
 
-       pr_debug("s3c2410_nand_probe(%p)\n", pdev);
+       pr_debug("%s(%p)\n", __func__, pdev);

I think we can drop the line completely.
We have ftrace to trace function calls...

Quoted 5 lines

Should the "initialised ok" at the end of the function be remove as well?

Will it be confusing if this cleanup is done in this function, but not in others where it may be useful? Perhaps s3c2410_nand_update_chip, for example?

Hmm, this driver seems to have a lot of debugging printks(). IMHO we can remove them.
Let's see what Brain says.

Thanks,
//richard

#5 lore raw

Re: [PATCH 1/20] mtd: s3c2410: fix misspelling of current function in string

Quoted 17 lines · Richard Weinberger

Am 08.12.2014 um 08:11 schrieb Julia Lawall:

Quoted 16 lines
Quoted 6 lines
Quoted 6 lines
drivers/mtd/nand/s3c2410.c +0 -0
index 35aef5e..0a9c41f 100644
@@ -948,7 +948,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
 
Quoted 7 lines

drivers/mtd/nand/s3c2410.c static int s3c24xx_nand_probe(struct platform_device *pdev) · line 951

Quoted 4 lines
drivers/mtd/nand/s3c2410.c +1 -1
        cpu_type = platform_get_device_id(pdev)->driver_data;
 
-       pr_debug("s3c2410_nand_probe(%p)\n", pdev);
+       pr_debug("%s(%p)\n", __func__, pdev);

I think we can drop the line completely.
We have ftrace to trace function calls...

Should the "initialised ok" at the end of the function be remove as well?

Quoted 7 lines
Quoted 3 lines

Will it be confusing if this cleanup is done in this function, but not in others where it may be useful? Perhaps s3c2410_nand_update_chip, for example?

Hmm, this driver seems to have a lot of debugging printks(). IMHO we can remove them.
Let's see what Brain says.

I'm a little late for this one, but I can apply this instead:

From: Brian Norris <[email protected]>
Date: Fri, 6 Feb 2015 03:25:28 -0800
Subject: [PATCH] mtd: s3c2410: drop useless / misspelled debug prints

s3c2410_nand_probe is not the name of the function.

These prints have little utility, so let's just kill them.

---
 drivers/mtd/nand/s3c2410.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/mtd/nand/s3c2410.c +0 -3
index 35aef5edb588..0e02be47ce1d 100644
@@ -948,8 +948,6 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
 
 	cpu_type = platform_get_device_id(pdev)->driver_data;
 
-	pr_debug("s3c2410_nand_probe(%p)\n", pdev);
-
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
 	if (info = NULL) {
 		err = -ENOMEM;
@@ -1045,7 +1043,6 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
 		s3c2410_nand_clk_set_state(info, CLOCK_SUSPEND);
 	}
 
-	pr_debug("initialised ok\n");
 	return 0;
 
  exit_error:
Signature · 1 line
2.3.0
#6 lore raw

PATCH 2/20 PCI: keystone: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

The function name contains pcie, not pci as in the string.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/pci/host/pci-keystone.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pci-keystone.c +1 -1
index 78f79e3..e2f600e 100644
@@ -119,7 +119,7 @@ static void ks_pcie_msi_irq_handler(unsigned int irq, struct irq_desc *desc)
 	struct pcie_port *pp = &ks_pcie->pp;
 	struct irq_chip *chip = irq_desc_get_chip(desc);
 
-	dev_dbg(pp->dev, "ks_pci_msi_irq_handler, irq %d\n", irq);
+	dev_dbg(pp->dev, "%s, irq %d\n", __func__, irq);
 
 	/*
 	 * The chained irq handler installation would have replaced normal
Acked-by on v1 2/20
#7 lore raw

Re: [PATCH 2/20] PCI: keystone: fix misspelling of current function in string

Quoted 22 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

The function name contains pcie, not pci as in the string.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

  drivers/pci/host/pci-keystone.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pci-keystone.c +0 -0
index 78f79e3..e2f600e 100644

drivers/pci/host/pci-keystone.c static void ks_pcie_msi_irq_handler(unsigned int irq, struct irq_desc *desc) · line 125

Quoted 8 lines
drivers/pci/host/pci-keystone.c +1 -1
@@ -119,7 +119,7 @@ static void ks_pcie_msi_irq_handler(unsigned int irq, struct irq_desc *desc)
  	struct pcie_port *pp =&ks_pcie->pp;
  	struct irq_chip *chip = irq_desc_get_chip(desc);
 
-	dev_dbg(pp->dev, "ks_pci_msi_irq_handler, irq %d\n", irq);
+	dev_dbg(pp->dev, "%s, irq %d\n", __func__, irq);
 
  	/*
  	 * The chained irq handler installation would have replaced normal
Signature · 2 lines
Murali Karicheri
Linux Kernel, Texas Instruments
maintainer
#8 lore raw

Re: [PATCH 2/20] PCI: keystone: fix misspelling of current function in string

In reply to Julia Lawall
Quoted 8 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

The function name contains pcie, not pci as in the string.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

Applied with Murali's ack to pci/host-keystone for v3.20, thanks!

Quoted 21 lines

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/pci/host/pci-keystone.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pci-keystone.c +1 -1
index 78f79e3..e2f600e 100644
@@ -119,7 +119,7 @@ static void ks_pcie_msi_irq_handler(unsigned int irq, struct irq_desc *desc)
 	struct pcie_port *pp = &ks_pcie->pp;
 	struct irq_chip *chip = irq_desc_get_chip(desc);
 
-	dev_dbg(pp->dev, "ks_pci_msi_irq_handler, irq %d\n", irq);
+	dev_dbg(pp->dev, "%s, irq %d\n", __func__, irq);
 
 	/*
 	 * The chained irq handler installation would have replaced normal
#9 lore raw

PATCH 3/20 PCI: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

The function name begins with pci, not cpci.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/pci/hotplug/pci_hotplug_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/hotplug/pci_hotplug_core.c +1 -1
index 56d8486..d3f8330 100644
@@ -532,7 +532,7 @@ static int __init pci_hotplug_init(void)
 
 	result = cpci_hotplug_init(debug);
 	if (result) {
-		err("cpci_hotplug_init with error %d\n", result);
+		err("%s with error %d\n", __func__, result);
 		return result;
 	}
 
#10 lore raw

Re: [PATCH 3/20] PCI: fix misspelling of current function in string

Quoted 3 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

The function name begins with pci, not cpci.

...

drivers/pci/hotplug/pci_hotplug_core.c static int __init pci_hotplug_init(void) · line 537

Quoted 6 lines
drivers/pci/hotplug/pci_hotplug_core.c +1 -1
 	result = cpci_hotplug_init(debug);
 	if (result) {
-		err("cpci_hotplug_init with error %d\n", result);
+		err("%s with error %d\n", __func__, result);
 		return result;
 	}

This one seems to be a false positive; I think the err() is reporting on the result from the call of the function which is indeed called cpci_hotplug_init.

I just skimmed the rest quickly, but they seem ok.

Rasmus

#11 lore raw

Re: [PATCH 3/20] PCI: fix misspelling of current function in string

Quoted 6 lines · Rasmus Villemoes
Quoted 3 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

The function name begins with pci, not cpci.

...

Quoted 10 lines

drivers/pci/hotplug/pci_hotplug_core.c static int __init pci_hotplug_init(void) · line 537

Quoted 6 lines
drivers/pci/hotplug/pci_hotplug_core.c +1 -1
 	result = cpci_hotplug_init(debug);
 	if (result) {
-		err("cpci_hotplug_init with error %d\n", result);
+		err("%s with error %d\n", __func__, result);
 		return result;
 	}

This one seems to be a false positive; I think the err() is reporting on the result from the call of the function which is indeed called cpci_hotplug_init.

Agreed. Thanks.

julia

#12 lore raw

PATCH 4/20 dmfe: fix misspelling of current function in string

In reply to Julia Lawall

The function name contains cleanup, not clean.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/ethernet/dec/tulip/dmfe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/dec/tulip/dmfe.c +1 -1
index c820560..50a0077 100644
@@ -2265,7 +2265,7 @@ static int __init dmfe_init_module(void)
 
 static void __exit dmfe_cleanup_module(void)
 {
-	DMFE_DBUG(0, "dmfe_clean_module() ", debug);
+	DMFE_DBUG(0, "dmfe_cleanup_module() ", debug);
 	pci_unregister_driver(&dmfe_driver);
 }
 
Acked-by on v1 4/20
#13 lore raw

Re: [PATCH 4/20] dmfe: fix misspelling of current function in string

Quoted 6 lines · Julia Lawall

The function name contains cleanup, not clean.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

Thanks - seems like a obvious mistake.

Quoted 22 lines

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/ethernet/dec/tulip/dmfe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/dec/tulip/dmfe.c +1 -1
index c820560..50a0077 100644
@@ -2265,7 +2265,7 @@ static int __init dmfe_init_module(void)
 
 static void __exit dmfe_cleanup_module(void)
 {
-       DMFE_DBUG(0, "dmfe_clean_module() ", debug);
+       DMFE_DBUG(0, "dmfe_cleanup_module() ", debug);
        pci_unregister_driver(&dmfe_driver);
 }
 
#15 lore raw

PATCH 5/20 isdn: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

In the first case, the print is just dropped, because kmalloc itself does enough error reporting.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/isdn/hisax/hfc_2bs0.c |    2 +-
 drivers/isdn/hisax/hfc_sx.c   |    3 ++-
 drivers/isdn/hisax/hfc_usb.c  |    5 ++---
 drivers/isdn/hisax/ipacx.c    |    2 +-
 drivers/isdn/hisax/isdnl1.c   |    2 +-
 drivers/isdn/hisax/isdnl3.c   |    2 +-
 drivers/isdn/hysdn/hycapi.c   |    2 +-
 drivers/isdn/pcbit/layer2.c   |    1 -
 8 files changed, 9 insertions(+), 10 deletions(-)
drivers/isdn/pcbit/layer2.c +0 -1
index 42ecfef..46e1240 100644
@@ -85,7 +85,6 @@ pcbit_l2_write(struct pcbit_dev *dev, ulong msg, ushort refnum,
 	}
 	if ((frame = kmalloc(sizeof(struct frame_buf),
 			     GFP_ATOMIC)) = NULL) {
-		printk(KERN_WARNING "pcbit_2_write: kmalloc failed\n");
 		dev_kfree_skb(skb);
 		return -1;
 	}
drivers/isdn/hisax/ipacx.c +1 -1
index 5faa5de..9cc26b4 100644
@@ -580,7 +580,7 @@ bch_fill_fifo(struct BCState *bcs)
 	if (cs->debug & L1_DEB_HSCX_FIFO) {
 		char *t = bcs->blog;
 
-		t += sprintf(t, "chb_fill_fifo() B-%d cnt %d", hscx, count);
+		t += sprintf(t, "%s() B-%d cnt %d", __func__, hscx, count);
 		QuickHex(t, ptr, count);
 		debugl1(cs, "%s", bcs->blog);
 	}
drivers/isdn/hisax/hfc_usb.c +2 -3
index 849a807..678bd52 100644
@@ -927,9 +927,8 @@ start_int_fifo(usb_fifo *fifo)
 	fifo->active = 1;	/* must be marked active */
 	errcode = usb_submit_urb(fifo->urb, GFP_KERNEL);
 	if (errcode) {
-		printk(KERN_ERR
-		       "HFC-S USB: submit URB error(start_int_info): status:%i\n",
-		       errcode);
+		printk(KERN_ERR "HFC-S USB: submit URB error(%s): status:%i\n",
+		       __func__, errcode);
 		fifo->active = 0;
 		fifo->skbuff = NULL;
 	}
drivers/isdn/hisax/hfc_2bs0.c +1 -1
index 838531b..14dada4 100644
@@ -31,7 +31,7 @@ WaitForBusy(struct IsdnCardState *cs)
 		to--;
 	}
 	if (!to) {
-		printk(KERN_WARNING "HiSax: waitforBusy timeout\n");
+		printk(KERN_WARNING "HiSax: %s timeout\n", __func__);
 		return (0);
 	} else
 		return (to);
drivers/isdn/hisax/isdnl1.c +1 -1
index 8000957..a560842 100644
@@ -867,7 +867,7 @@ l1_msg(struct IsdnCardState *cs, int pr, void *arg) {
 			break;
 		default:
 			if (cs->debug)
-				debugl1(cs, "l1msg %04X unhandled", pr);
+				debugl1(cs, "%s %04X unhandled", __func__, pr);
 			break;
 		}
 		st = st->next;
drivers/isdn/hisax/hfc_sx.c +2 -1
index fa1fefd..b1fad81 100644
@@ -1159,7 +1159,8 @@ hfcsx_l2l1(struct PStack *st, int pr, void *arg)
 	case (PH_PULL | INDICATION):
 		spin_lock_irqsave(&bcs->cs->lock, flags);
 		if (bcs->tx_skb) {
-			printk(KERN_WARNING "hfc_l2l1: this shouldn't happen\n");
+			printk(KERN_WARNING "%s: this shouldn't happen\n",
+			       __func__);
 		} else {
 //				test_and_set_bit(BC_FLG_BUSY, &bcs->Flag);
 			bcs->tx_skb = skb;
drivers/isdn/hisax/isdnl3.c +1 -1
index 45b0384..c754706 100644
@@ -153,7 +153,7 @@ void
 newl3state(struct l3_process *pc, int state)
 {
 	if (pc->debug & L3_DEB_STATE)
-		l3_debug(pc->st, "newstate cr %d %d --> %d",
+		l3_debug(pc->st, "%s cr %d %d --> %d", __func__,
 			 pc->callref & 0x7F,
 			 pc->state, state);
 	pc->state = state;
drivers/isdn/hysdn/hycapi.c +1 -1
index 00aad10..93bae94 100644
@@ -501,7 +501,7 @@ static char *hycapi_procinfo(struct capi_ctr *ctrl)
 {
 	hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata);
 #ifdef HYCAPI_PRINTFNAMES
-	printk(KERN_NOTICE "hycapi_proc_info\n");
+	printk(KERN_NOTICE "%s\n", __func__);
 #endif
 	if (!cinfo)
 		return "";
maintainer Applied
#16 lore raw

Re: [PATCH 5/20] isdn: fix misspelling of current function in string

From: Julia Lawall <[email protected]>
Date: Sun, 7 Dec 2014 20:20:47 +0100

Quoted 9 lines

Replace a misspelled function name by %s and then __func__.

In the first case, the print is just dropped, because kmalloc itself does enough error reporting.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

Applied.

#17 lore raw

PATCH 6/20 TTY: fix misspelling of current function in string

In reply to Julia Lawall

Replace the last argument of serial_paranoia_check by the actual function name.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/tty/amiserial.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/amiserial.c +1 -1
index d9f85f9..b2d7600 100644
@@ -931,7 +931,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
 	struct serial_state *info = tty->driver_data;
         unsigned long flags;
 
-	if (serial_paranoia_check(info, tty->name, "rs_send_char"))
+	if (serial_paranoia_check(info, tty->name, "rs_send_xchar"))
 		return;
 
 	info->x_char = ch;
#18 lore raw

Re: [PATCH 6/20] TTY: fix misspelling of current function in string

Quoted 20 lines · Julia Lawall

Replace the last argument of serial_paranoia_check by the actual function name.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/tty/amiserial.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/amiserial.c +0 -0
index d9f85f9..b2d7600 100644

drivers/tty/amiserial.c static void rs_send_xchar(struct tty_struct *tty, char ch) · line 934

Quoted 5 lines
drivers/tty/amiserial.c +1 -1
@@ -931,7 +931,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
 	struct serial_state *info = tty->driver_data;
         unsigned long flags;
 
-	if (serial_paranoia_check(info, tty->name, "rs_send_char"))
+	if (serial_paranoia_check(info, tty->name, "rs_send_xchar"))

I wonder, why not to use __func__ here too?

thanks,

Signature · 2 lines
js
suse labs
#19 lore raw

Re: [PATCH 6/20] TTY: fix misspelling of current function in string

Quoted 3 lines · Jiri Slaby
Quoted 2 lines · Julia Lawall

Replace the last argument of serial_paranoia_check by the actual function name.

[]

Quoted 1 line

drivers/tty/amiserial.c

Quoted 1 line
drivers/tty/amiserial.c +0 -0

[]

Quoted 8 lines

drivers/tty/amiserial.c static void rs_send_xchar(struct tty_struct *tty, char ch) · line 934

Quoted 6 lines
drivers/tty/amiserial.c +1 -1
@@ -931,7 +931,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
 	struct serial_state *info = tty->driver_data;
         unsigned long flags;
 
-	if (serial_paranoia_check(info, tty->name, "rs_send_char"))
+	if (serial_paranoia_check(info, tty->name, "rs_send_xchar"))

I wonder, why not to use __func__ here too?

Nearly identical functions are used in amiserial and cyclades. Disabled in amiserial, enabled in cyclades.

It might be better to add it to some file like
drivers/tty/debug_utils.h

It'd probably be better to change:

static inline int serial_paranoia_check(struct serial_state *info,
char *name, const char *routine)
{

#ifdef SERIAL_PARANOIA_CHECK
	static const char *badmagic 		"Warning: bad magic number for serial struct (%s) in %s\n";
	static const char *badinfo 		"Warning: null async_struct for (%s) in %s\n";

	if (!info) {
		printk(badinfo, name, routine);
		return 1;
	}
	if (info->magic != SERIAL_MAGIC) {
		printk(badmagic, name, routine);
		return 1;
	}
#endif
	return 0;
}

to something like:

static inline int serial_paranoia_check(struct serial_state *info, char *name) {

#ifdef SERIAL_PARANOIA_CHECK
	if (!info) {
		pr_warn("async_struct for (%s) is NULL in %pf\n",
			name, __builtin_return_address(0));
		return 1;
	}
	if (info->magic != SERIAL_MAGIC) {
		pr_warn("serial struct (%s) has bad magic number in %pf\n",
			name, __builtin_return_address(0));
		return 1;
	}
#endif
	return 0;
}

and remove all the function names from the callers.

#20 lore raw

Re: [PATCH 6/20] TTY: fix misspelling of current function in string

Quoted 11 lines · Joe Perches
Quoted 3 lines · Jiri Slaby
Quoted 2 lines · Julia Lawall

Replace the last argument of serial_paranoia_check by the actual function name.

[]

Quoted 1 line

drivers/tty/amiserial.c

Quoted 1 line
drivers/tty/amiserial.c +0 -0

[]

Quoted 4 lines
Quoted 4 lines
drivers/tty/amiserial.c +0 -0
@@ -931,7 +931,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
 	struct serial_state *info = tty->driver_data;
         unsigned long flags;
 
Quoted 6 lines
Quoted 4 lines

drivers/tty/amiserial.c static void rs_send_xchar(struct tty_struct *tty, char ch) · line 934

Quoted 2 lines
drivers/tty/amiserial.c +1 -1
-	if (serial_paranoia_check(info, tty->name, "rs_send_char"))
+	if (serial_paranoia_check(info, tty->name, "rs_send_xchar"))

I wonder, why not to use __func__ here too?

Nearly identical functions are used in amiserial and cyclades.

And I would bet more. They are mostly copy&paste drivers.

Quoted 4 lines

Disabled in amiserial, enabled in cyclades.

It might be better to add it to some file like
drivers/tty/debug_utils.h

Oh no, these should better die, not being generalized. But since the drivers have nearly no users, if some at all, nobody wants to touch the code.

Signature · 2 lines
js
suse labs
#21 lore raw

PATCH 7/20 drm/i915: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

The message is sort of ambiguous, but I assume that it is intended to refer to the function in which the problem is detected.

 drivers/gpu/drm/i915/i915_gem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +1 -1
index d2ba315..fa21d1c 100644
@@ -4335,7 +4335,7 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
 	}
 
 	if (obj->pin_filp != file) {
-		DRM_DEBUG("Not pinned by caller in i915_gem_pin_ioctl(): %d\n",
+		DRM_DEBUG("Not pinned by caller in %s(): %d\n", __func__,
 			  args->handle);
 		ret = -EINVAL;
 		goto out;
maintainer
#22 lore raw

Re: [PATCH 7/20] drm/i915: fix misspelling of current function in string

Quoted 5 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

Quoted 8 lines

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

The message is sort of ambiguous, but I assume that it is intended to refer to the function in which the problem is detected.

Hmm, DRM_DEBUG prints __func__ too.

Jani.

Quoted 18 lines
 drivers/gpu/drm/i915/i915_gem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +1 -1
index d2ba315..fa21d1c 100644
@@ -4335,7 +4335,7 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
 	}
 
 	if (obj->pin_filp != file) {
-		DRM_DEBUG("Not pinned by caller in i915_gem_pin_ioctl(): %d\n",
+		DRM_DEBUG("Not pinned by caller in %s(): %d\n", __func__,
 			  args->handle);
 		ret = -EINVAL;
 		goto out;
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#23 lore raw

Re: [PATCH 7/20] drm/i915: fix misspelling of current function in string

Quoted 8 lines · Jani Nikula
Quoted 7 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

Quoted 8 lines
Quoted 6 lines

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

The message is sort of ambiguous, but I assume that it is intended to refer to the function in which the problem is detected.

Hmm, DRM_DEBUG prints __func__ too.

We've killed the pin ioctl for 3.20 hence didn't even bother to come up with an opinion ;-)
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#24 lore raw

PATCH 8/20 USB: isp1760: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

The function name starts with isp, not ips.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/usb/host/isp1760-if.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/isp1760-if.c +1 -1
index 09254a4..939d376 100644
@@ -318,7 +318,7 @@ static void isp1761_pci_remove(struct pci_dev *dev)
 
 static void isp1761_pci_shutdown(struct pci_dev *dev)
 {
-	printk(KERN_ERR "ips1761_pci_shutdown\n");
+	printk(KERN_ERR "%s\n", __func__);
 }
 
 static const struct pci_device_id isp1760_plx [] = {
#25 lore raw

Re: [PATCH 8/20] USB: isp1760: fix misspelling of current function in string

Julia,

Quoted 21 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

The function name starts with isp, not ips.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/usb/host/isp1760-if.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/isp1760-if.c +0 -0
index 09254a4..939d376 100644

drivers/usb/host/isp1760-if.c static void isp1761_pci_remove(struct pci_dev *dev) · line 323

Quoted 7 lines
drivers/usb/host/isp1760-if.c +1 -1
@@ -318,7 +318,7 @@ static void isp1761_pci_remove(struct pci_dev *dev)
 
 static void isp1761_pci_shutdown(struct pci_dev *dev)
 {
-	printk(KERN_ERR "ips1761_pci_shutdown\n");
+	printk(KERN_ERR "%s\n", __func__);
 }
 

You can also switch from printk to pr_err and that would fix thte checkpatch warning for this patch.

Quoted 6 lines
drivers/usb/host/isp1760-if.c +0 -1
 static const struct pci_device_id isp1760_plx [] = {
 
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
- Jeremiah Mahler
#26 lore raw

Re: [PATCH 8/20] USB: isp1760: fix misspelling of current function in string

Quoted 25 lines · Jeremiah Mahler

Julia,

Quoted 22 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

The function name starts with isp, not ips.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/usb/host/isp1760-if.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/isp1760-if.c +0 -0
index 09254a4..939d376 100644
@@ -318,7 +318,7 @@ static void isp1761_pci_remove(struct pci_dev *dev)
 
Quoted 8 lines

drivers/usb/host/isp1760-if.c static void isp1761_pci_remove(struct pci_dev *dev) · line 323

Quoted 6 lines
drivers/usb/host/isp1760-if.c +1 -1
 static void isp1761_pci_shutdown(struct pci_dev *dev)
 {
-	printk(KERN_ERR "ips1761_pci_shutdown\n");
+	printk(KERN_ERR "%s\n", __func__);
 }
 

You can also switch from printk to pr_err and that would fix thte checkpatch warning for this patch.

Yeah, I didn't want to do too much at once, since tha could be done all at once in a lot of other places too. But I will fix up this one.

julia

Quoted 14 lines
Quoted 6 lines
drivers/usb/host/isp1760-if.c +0 -1
 static const struct pci_device_id isp1760_plx [] = {
 
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
- Jeremiah Mahler
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#27 lore raw

Re: [PATCH 8/20] USB: isp1760: fix misspelling of current function in string

Julia,

Quoted 8 lines · Julia Lawall
Quoted 4 lines · Jeremiah Mahler

Julia,

Quoted 1 line · Julia Lawall

Replace a misspelled function name by %s and then __func__.

[...]

Quoted 10 lines
Quoted 9 lines

drivers/usb/host/isp1760-if.c static void isp1761_pci_remove(struct pci_dev *dev) · line 322

Quoted 7 lines

static void isp1761_pci_shutdown(struct pci_dev *dev) {

drivers/usb/host/isp1760-if.c +1 -1
-	printk(KERN_ERR "ips1761_pci_shutdown\n");
+	printk(KERN_ERR "%s\n", __func__);
 }

You can also switch from printk to pr_err and that would fix thte checkpatch warning for this patch.

Quoted 5 lines

Yeah, I didn't want to do too much at once, since tha could be done all at once in a lot of other places too. But I will fix up this one.

julia

I agree, doing too much at once is usually bad. But these are pretty small and it is good if your patch doesn't have any checkpatch issues.

Quoted 14 lines
Quoted 14 lines
Quoted 6 lines

static const struct pci_device_id isp1760_plx [] = {

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
- Jeremiah Mahler
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 1 line
- Jeremiah Mahler
#28 lore raw

PATCH 9/20 drivers/scsi: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/scsi/atp870u.c   |   10 +++++-----
 drivers/scsi/imm.c       |    2 +-
 drivers/scsi/initio.c    |    2 +-
 drivers/scsi/ncr53c8xx.c |    3 ++-
 drivers/scsi/ppa.c       |    2 +-
 5 files changed, 10 insertions(+), 9 deletions(-)
drivers/scsi/initio.c +1 -1
index e5dae7b..85fd163 100644
@@ -1034,7 +1034,7 @@ static int initio_bad_seq(struct initio_host * host)
 {
 	struct scsi_ctrl_blk *scb;
 
-	printk("initio_bad_seg c=%d\n", host->index);
+	printk("%s c=%d\n", __func__, host->index);
 
 	if ((scb = host->active) != NULL) {
 		initio_unlink_busy_scb(host, scb);
drivers/scsi/ncr53c8xx.c +2 -1
index 5b93ed8..347fb49 100644
@@ -772,7 +772,8 @@ static int __init sym53c8xx__setup(char *str)
 			break;
 #endif
 		default:
-			printk("sym53c8xx_setup: unexpected boot option '%.*s' ignored\n", (int)(pc-cur+1), cur);
+			printk("%s: unexpected boot option '%.*s' ignored\n",
+			       __func__, (int)(pc-cur+1), cur);
 			break;
 		}
 
drivers/scsi/ppa.c +1 -1
index 1db8b26..4c1f08e 100644
@@ -365,7 +365,7 @@ static int ppa_in(ppa_struct *dev, char *buffer, int len)
 		break;
 
 	default:
-		printk(KERN_ERR "PPA: bug in ppa_ins()\n");
+		printk(KERN_ERR "PPA: bug in %s()\n", __func__);
 		r = 0;
 		break;
 	}
drivers/scsi/atp870u.c +5 -5
index a795d81..ebb4556 100644
@@ -3016,12 +3016,12 @@ flash_ok_885:
 			goto scsi_add_fail;
 		scsi_scan_host(shpnt);
 #ifdef ED_DBGP			
-		printk("atp870u_prob : exit\n");
+		printk("%s : exit\n", __func__);
 #endif		
 		return 0;
 
 scsi_add_fail:
-	printk("atp870u_prob:scsi_add_fail\n");
+	printk("%s:scsi_add_fail\n", __func__);
 	if(ent->device=ATP885_DEVID) {
 		release_region(base_io, 0xff);
 	} else if((ent->device=ATP880_DEVID1)||(ent->device=ATP880_DEVID2)) {
@@ -3030,13 +3030,13 @@ scsi_add_fail:
 		release_region(base_io, 0x40);
 	}
 request_io_fail:
-	printk("atp870u_prob:request_io_fail\n");
+	printk("%s:request_io_fail\n", __func__);
 	free_irq(pdev->irq, shpnt);
 free_tables:
-	printk("atp870u_prob:free_table\n");
+	printk("%s:free_table\n", __func__);
 	atp870u_free_tables(shpnt);
 unregister:
-	printk("atp870u_prob:unregister\n");
+	printk("%s:unregister\n", __func__);
 	scsi_host_put(shpnt);
 	return -1;		
 err_eio:
drivers/scsi/imm.c +1 -1
index 89a8266..1f2a668 100644
@@ -439,7 +439,7 @@ static int imm_in(imm_struct *dev, char *buffer, int len)
 		break;
 
 	default:
-		printk("IMM: bug in imm_ins()\n");
+		printk("IMM: bug in %s()\n", __func__);
 		r = 0;
 		break;
 	}
#29 lore raw

PATCH 10/20 uli526x: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/ethernet/dec/tulip/uli526x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/dec/tulip/uli526x.c +1 -1
index 4061f9b..1c5916b 100644
@@ -1837,7 +1837,7 @@ static int __init uli526x_init_module(void)
 
 static void __exit uli526x_cleanup_module(void)
 {
-	ULI526X_DBUG(0, "uli526x_clean_module() ", debug);
+	ULI526X_DBUG(0, "uli526x_cleanup_module() ", debug);
 	pci_unregister_driver(&uli526x_driver);
 }
 
#30 lore raw

Re: [PATCH 10/20] uli526x: fix misspelling of current function in string

Quoted 1 line · Julia Lawall

Replace a misspelled function name by %s and then __func__.

Patch is correct but this commit message is not. Please correct and add my Ack-by.

cheers,
grant

Quoted 26 lines

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/ethernet/dec/tulip/uli526x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/dec/tulip/uli526x.c +1 -1
index 4061f9b..1c5916b 100644
@@ -1837,7 +1837,7 @@ static int __init uli526x_init_module(void)
 
 static void __exit uli526x_cleanup_module(void)
 {
-       ULI526X_DBUG(0, "uli526x_clean_module() ", debug);
+       ULI526X_DBUG(0, "uli526x_cleanup_module() ", debug);
        pci_unregister_driver(&uli526x_driver);
 }
 
#31 lore raw

PATCH v2 10/20 uli526x: fix misspelling of current function in string

The function is named uli526x_cleanup_module, rather than uli526x_clean_module.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
v2: fixed commit message

The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/ethernet/dec/tulip/uli526x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/dec/tulip/uli526x.c +1 -1
index 4061f9b..1c5916b 100644
@@ -1837,7 +1837,7 @@ static int __init uli526x_init_module(void)
 
 static void __exit uli526x_cleanup_module(void)
 {
-	ULI526X_DBUG(0, "uli526x_clean_module() ", debug);
+	ULI526X_DBUG(0, "uli526x_cleanup_module() ", debug);
 	pci_unregister_driver(&uli526x_driver);
 }
 
#33 lore raw

PATCH 11/20 vme: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This is the get function, not the set function, as was indicated by the string.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/vme/vme.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vme/vme.c +1 -1
index 7516030..d95fb84 100644
@@ -502,7 +502,7 @@ int vme_master_get(struct vme_resource *resource, int *enabled,
 	image = list_entry(resource->entry, struct vme_master_resource, list);
 
 	if (bridge->master_get = NULL) {
-		printk(KERN_WARNING "vme_master_set not supported\n");
+		printk(KERN_WARNING "%s not supported\n", __func__);
 		return -EINVAL;
 	}
 
#34 lore raw

PATCH 12/20 hp100: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/ethernet/hp/hp100.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/hp/hp100.c +5 -2
index 76a6e0c..ae6e30d 100644
@@ -490,7 +490,8 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 
 	eid = hp100_read_id(ioaddr);
 	if (eid = NULL) {	/* bad checksum? */
-		printk(KERN_WARNING "hp100_probe: bad ID checksum at base port 0x%x\n", ioaddr);
+		printk(KERN_WARNING "%s: bad ID checksum at base port 0x%x\n",
+		       __func__, ioaddr);
 		goto out2;
 	}
 
@@ -498,7 +499,9 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 	for (i = uc = 0; i < 7; i++)
 		uc += hp100_inb(LAN_ADDR + i);
 	if (uc != 0xff) {
-		printk(KERN_WARNING "hp100_probe: bad lan address checksum at port 0x%x)\n", ioaddr);
+		printk(KERN_WARNING
+		       "%s: bad lan address checksum at port 0x%x)\n",
+		       __func__, ioaddr);
 		err = -EIO;
 		goto out2;
 	}
#35 lore raw

Re: [PATCH 12/20] hp100: fix misspelling of current function in string

Julia,

Quoted 19 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/ethernet/hp/hp100.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/hp/hp100.c +0 -0
index 76a6e0c..ae6e30d 100644

drivers/net/ethernet/hp/hp100.c static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus, · line 494

Quoted 6 lines
drivers/net/ethernet/hp/hp100.c +2 -1
@@ -490,7 +490,8 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 
 	eid = hp100_read_id(ioaddr);
 	if (eid = NULL) {	/* bad checksum? */
-		printk(KERN_WARNING "hp100_probe: bad ID checksum at base port 0x%x\n", ioaddr);
+		printk(KERN_WARNING "%s: bad ID checksum at base port 0x%x\n",
+		       __func__, ioaddr);

More printk statements that can be change to pr_warn() to fix the checkpatch warning.

drivers/net/ethernet/hp/hp100.c static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus, · line 504

Quoted 11 lines
drivers/net/ethernet/hp/hp100.c +3 -1
 		goto out2;
 	}
 
@@ -498,7 +499,9 @@ static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
 	for (i = uc = 0; i < 7; i++)
 		uc += hp100_inb(LAN_ADDR + i);
 	if (uc != 0xff) {
-		printk(KERN_WARNING "hp100_probe: bad lan address checksum at port 0x%x)\n", ioaddr);
+		printk(KERN_WARNING
+		       "%s: bad lan address checksum at port 0x%x)\n",
+		       __func__, ioaddr);

And here too.

Quoted 9 lines
drivers/net/ethernet/hp/hp100.c +0 -1
 		err = -EIO;
 		goto out2;
 	}
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 1 line
- Jeremiah Mahler
#38 lore raw

PATCH 13/20 zd1211rw: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/wireless/zd1211rw/zd_chip.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/zd1211rw/zd_chip.c +3 -3
index 73a49b8..07b94ed 100644
@@ -129,7 +129,7 @@ int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr
 	r = zd_ioread16v_locked(chip, v16, a16, count16);
 	if (r) {
 		dev_dbg_f(zd_chip_dev(chip),
-			  "error: zd_ioread16v_locked. Error number %d\n", r);
+			  "error: %s. Error number %d\n", __func__, r);
 		return r;
 	}
 
@@ -256,8 +256,8 @@ int zd_iowrite32a_locked(struct zd_chip *chip,
 		if (r) {
 			zd_usb_iowrite16v_async_end(&chip->usb, 0);
 			dev_dbg_f(zd_chip_dev(chip),
-				"error _zd_iowrite32v_locked."
-				" Error number %d\n", r);
+				"error _%s. Error number %d\n", __func__,
+				r);
 			return r;
 		}
 	}
#39 lore raw

PATCH 14/20 chelsio: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/ethernet/chelsio/cxgb/sge.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb/sge.c +1 -1
index 4c58793..86222a1 100644
@@ -301,7 +301,7 @@ unsigned int t1_sched_update_parms(struct sge *sge, unsigned int port,
 	struct sched_port *p = &s->p[port];
 	unsigned int max_avail_segs;
 
-	pr_debug("t1_sched_update_params mtu=%d speed=%d\n", mtu, speed);
+	pr_debug("%s mtu=%d speed=%d\n", __func__, mtu, speed);
 	if (speed)
 		p->speed = speed;
 	if (mtu)
maintainer Applied
#40 lore raw

Re: [PATCH 14/20] chelsio: fix misspelling of current function in string

From: Julia Lawall <[email protected]>
Date: Sun, 7 Dec 2014 20:20:56 +0100

Quoted 6 lines

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

Applied.

#42 lore raw

PATCH 15/20 hostap_cs: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/wireless/hostap/hostap_cs.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/net/wireless/hostap/hostap_cs.c +5 -10
index b6ec519..50033aa 100644
@@ -381,18 +381,15 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
 
 	res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor);
 	if (res != 0) {
-		printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
-		       "(%d)\n", res);
+		printk(KERN_DEBUG "%s failed 1 (%d)\n", __func__, res);
 		return;
 	}
-	printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n",
-		old_cor);
+	printk(KERN_DEBUG "%s: original COR %02x\n", __func__, old_cor);
 
 	res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
 				old_cor | COR_SOFT_RESET);
 	if (res != 0) {
-		printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
-		       "(%d)\n", res);
+		printk(KERN_DEBUG "%s failed 2 (%d)\n", __func__, res);
 		return;
 	}
 
@@ -401,8 +398,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
 	/* Setup Genesis mode */
 	res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr);
 	if (res != 0) {
-		printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
-		       "(%d)\n", res);
+		printk(KERN_DEBUG "%s failed 3 (%d)\n", __func__, res);
 		return;
 	}
 	mdelay(10);
@@ -410,8 +406,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
 	res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
 				old_cor & ~COR_SOFT_RESET);
 	if (res != 0) {
-		printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
-		       "(%d)\n", res);
+		printk(KERN_DEBUG "%s failed 4 (%d)\n", __func__, res);
 		return;
 	}
 
#43 lore raw

PATCH 16/20 rtlwifi: rtl8821ae: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

8821 was written as 8812.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/net/wireless/rtlwifi/rtl8821ae/dm.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/wireless/rtlwifi/rtl8821ae/dm.c +5 -6
index 9be1061..ba30b0d 100644
@@ -2078,8 +2078,7 @@ void rtl8821ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw,
 	if (rtldm->tx_rate != 0xFF)
 		tx_rate = rtl8821ae_hw_rate_to_mrate(hw, rtldm->tx_rate);
 
-	RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
-		 "==>rtl8812ae_dm_txpwr_track_set_pwr\n");
+	RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "==>%s\n", __func__);
 
 	if (tx_rate != 0xFF) { /* Mimic Modify High Rate BBSwing Limit.*/
 		/*CCK*/
@@ -2128,7 +2127,7 @@ void rtl8821ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw,
 
 	if (method = BBSWING) {
 		RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
-			 "==>rtl8812ae_dm_txpwr_track_set_pwr\n");
+			 "==>%s\n", __func__);
 		if (rf_path = RF90_PATH_A) {
 			final_swing_idx[RF90_PATH_A]  				(rtldm->ofdm_index[RF90_PATH_A] >
@@ -2260,7 +2259,8 @@ void rtl8821ae_dm_txpower_tracking_callback_thermalmeter(
 	rtldm->txpower_trackinginit = true;
 
 	RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
-		 "==>rtl8812ae_dm_txpower_tracking_callback_thermalmeter,\n pDM_Odm->BbSwingIdxCckBase: %d,pDM_Odm->BbSwingIdxOfdmBase[A]:%d, pDM_Odm->DefaultOfdmIndex: %d\n",
+		 "==>%s,\n pDM_Odm->BbSwingIdxCckBase: %d,pDM_Odm->BbSwingIdxOfdmBase[A]:%d, pDM_Odm->DefaultOfdmIndex: %d\n",
+		 __func__,
 		 rtldm->swing_idx_cck_base,
 		 rtldm->swing_idx_ofdm_base[RF90_PATH_A],
 		 rtldm->default_ofdm_index);
@@ -2539,8 +2539,7 @@ void rtl8821ae_dm_txpower_tracking_callback_thermalmeter(
 		}
 	}
 
-	RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
-		 "<==rtl8812ae_dm_txpower_tracking_callback_thermalmeter\n");
+	RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "<==%s\n", __func__);
 }
 
 void rtl8821ae_dm_check_txpower_tracking_thermalmeter(struct ieee80211_hw *hw)
#44 lore raw

PATCH 17/20 drm/i2c: tda998x: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/gpu/drm/i2c/tda998x_drv.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i2c/tda998x_drv.c +1 -1
index d476279..14acac8 100644
@@ -385,7 +385,7 @@ set_page(struct tda998x_priv *priv, uint16_t reg)
 		};
 		int ret = i2c_master_send(client, buf, sizeof(buf));
 		if (ret < 0) {
-			dev_err(&client->dev, "setpage %04x err %d\n",
+			dev_err(&client->dev, "%s %04x err %d\n", __func__,
 					reg, ret);
 			return ret;
 		}
#45 lore raw

PATCH 18/20 usb: gadget: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/usb/gadget/function/f_hid.c  |    5 +++--
 drivers/usb/gadget/function/f_midi.c |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/f_midi.c +1 -1
index a904403..259b656 100644
@@ -520,7 +520,7 @@ static void f_midi_transmit(struct f_midi *midi, struct usb_request *req)
 		req = midi_alloc_ep_req(ep, midi->buflen);
 
 	if (!req) {
-		ERROR(midi, "gmidi_transmit: alloc_ep_request failed\n");
+		ERROR(midi, "%s: alloc_ep_request failed\n", __func__);
 		return;
 	}
 	req->length = 0;
drivers/usb/gadget/function/f_hid.c +3 -2
index 6e04e30..a1bc3e3 100644
@@ -399,8 +399,9 @@ static int hidg_setup(struct usb_function *f,
 	value	= __le16_to_cpu(ctrl->wValue);
 	length	= __le16_to_cpu(ctrl->wLength);
 
-	VDBG(cdev, "hid_setup crtl_request : bRequestType:0x%x bRequest:0x%x "
-		"Value:0x%x\n", ctrl->bRequestType, ctrl->bRequest, value);
+	VDBG(cdev,
+	     "%s crtl_request : bRequestType:0x%x bRequest:0x%x Value:0x%x\n",
+	     __func__, ctrl->bRequestType, ctrl->bRequest, value);
 
 	switch ((ctrl->bRequestType << 8) | ctrl->bRequest) {
 	case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8
#46 lore raw

PATCH 19/20 TTY: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/tty/rocket.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/rocket.c +2 -2
index 383c4c7..c8dd8dc 100644
@@ -1390,7 +1390,7 @@ static void rp_unthrottle(struct tty_struct *tty)
 	       tty->ldisc.chars_in_buffer(tty));
 #endif
 
-	if (rocket_paranoia_check(info, "rp_throttle"))
+	if (rocket_paranoia_check(info, "rp_unthrottle"))
 		return;
 
 	if (I_IXOFF(tty))
@@ -1458,7 +1458,7 @@ static void rp_wait_until_sent(struct tty_struct *tty, int timeout)
 
 	orig_jiffies = jiffies;
 #ifdef ROCKET_DEBUG_WAIT_UNTIL_SENT
-	printk(KERN_INFO "In RP_wait_until_sent(%d) (jiff=%lu)...\n", timeout,
+	printk(KERN_INFO "In %s(%d) (jiff=%lu)...\n", __func__, timeout,
 	       jiffies);
 	printk(KERN_INFO "cps=%d...\n", info->cps);
 #endif
#47 lore raw

Re: [PATCH 19/20] TTY: fix misspelling of current function in string

Julia,

Quoted 9 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover

[...]

drivers/tty/rocket.c static void rp_wait_until_sent(struct tty_struct *tty, int timeout) · line 1464

Quoted 10 lines
drivers/tty/rocket.c +1 -1
@@ -1458,7 +1458,7 @@ static void rp_wait_until_sent(struct tty_struct *tty, int timeout)
 
 	orig_jiffies = jiffies;
 #ifdef ROCKET_DEBUG_WAIT_UNTIL_SENT
-	printk(KERN_INFO "In RP_wait_until_sent(%d) (jiff=%lu)...\n", timeout,
+	printk(KERN_INFO "In %s(%d) (jiff=%lu)...\n", __func__, timeout,
 	       jiffies);
 	printk(KERN_INFO "cps=%d...\n", info->cps);
 #endif

More printk, pr_info, I'm sure you get the idea :-)

I would probably change the printk directly below it too, since it is right there, but it is up to you.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
- Jeremiah Mahler
#48 lore raw

Re: [PATCH 19/20] TTY: fix misspelling of current function in string

Quoted 15 lines · Jeremiah Mahler

Julia,

Quoted 9 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover

[...]

Quoted 2 lines
(quoted diff) +0 -0
@@ -1458,7 +1458,7 @@ static void rp_wait_until_sent(struct tty_struct *tty, int timeout)
 
Quoted 9 lines

drivers/tty/rocket.c static void rp_wait_until_sent(struct tty_struct *tty, int timeout) · line 1464

Quoted 8 lines
drivers/tty/rocket.c +1 -1
 	orig_jiffies = jiffies;
 #ifdef ROCKET_DEBUG_WAIT_UNTIL_SENT
-	printk(KERN_INFO "In RP_wait_until_sent(%d) (jiff=%lu)...\n", timeout,
+	printk(KERN_INFO "In %s(%d) (jiff=%lu)...\n", __func__, timeout,
 	       jiffies);
 	printk(KERN_INFO "cps=%d...\n", info->cps);
 #endif

More printk, pr_info, I'm sure you get the idea :-)

Well, these are drivers, so it should probably be dev_info, etc.

I have the impression that satisfying checkpatch would require a more complicated change than the original patch.

I would still find it better to makes these changes in another patch series.

julia

#49 lore raw

PATCH 20/20 drm/radeon: fix misspelling of current function in string

In reply to Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/gpu/drm/radeon/cik.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/cik.c +10 -6
index 6dcde37..24d5e43 100644
@@ -7367,34 +7367,38 @@ int cik_irq_set(struct radeon_device *rdev)
 	}
 	if (atomic_read(&rdev->irq.ring_int[CAYMAN_RING_TYPE_CP1_INDEX])) {
 		struct radeon_ring *ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX];
-		DRM_DEBUG("si_irq_set: sw int cp1\n");
+		DRM_DEBUG("%s: sw int cp1\n", __func__);
 		if (ring->me == 1) {
 			switch (ring->pipe) {
 			case 0:
 				cp_m1p0 |= TIME_STAMP_INT_ENABLE;
 				break;
 			default:
-				DRM_DEBUG("si_irq_set: sw int cp1 invalid pipe %d\n", ring->pipe);
+				DRM_DEBUG("%s: sw int cp1 invalid pipe %d\n",
+					  __func__, ring->pipe);
 				break;
 			}
 		} else {
-			DRM_DEBUG("si_irq_set: sw int cp1 invalid me %d\n", ring->me);
+			DRM_DEBUG("%s: sw int cp1 invalid me %d\n", __func__,
+				  ring->me);
 		}
 	}
 	if (atomic_read(&rdev->irq.ring_int[CAYMAN_RING_TYPE_CP2_INDEX])) {
 		struct radeon_ring *ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX];
-		DRM_DEBUG("si_irq_set: sw int cp2\n");
+		DRM_DEBUG("%s: sw int cp2\n", __func__);
 		if (ring->me == 1) {
 			switch (ring->pipe) {
 			case 0:
 				cp_m1p0 |= TIME_STAMP_INT_ENABLE;
 				break;
 			default:
-				DRM_DEBUG("si_irq_set: sw int cp2 invalid pipe %d\n", ring->pipe);
+				DRM_DEBUG("%s: sw int cp2 invalid pipe %d\n",
+					  __func__, ring->pipe);
 				break;
 			}
 		} else {
-			DRM_DEBUG("si_irq_set: sw int cp2 invalid me %d\n", ring->me);
+			DRM_DEBUG("%s: sw int cp2 invalid me %d\n", __func__,
+				  ring->me);
 		}
 	}
 
#50 lore raw

Re: [PATCH 20/20] drm/radeon: fix misspelling of current function in string

Quoted 6 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

Looks fine to me. For consistency, any chance you'd want to fix up the other places that use function names directly with this style patch?

Alex

Quoted 62 lines

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/gpu/drm/radeon/cik.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/cik.c +10 -6
index 6dcde37..24d5e43 100644
@@ -7367,34 +7367,38 @@ int cik_irq_set(struct radeon_device *rdev)
        }
        if (atomic_read(&rdev->irq.ring_int[CAYMAN_RING_TYPE_CP1_INDEX])) {
                struct radeon_ring *ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX];
-               DRM_DEBUG("si_irq_set: sw int cp1\n");
+               DRM_DEBUG("%s: sw int cp1\n", __func__);
                if (ring->me = 1) {
                        switch (ring->pipe) {
                        case 0:
                                cp_m1p0 |= TIME_STAMP_INT_ENABLE;
                                break;
                        default:
-                               DRM_DEBUG("si_irq_set: sw int cp1 invalid pipe %d\n", ring->pipe);
+                               DRM_DEBUG("%s: sw int cp1 invalid pipe %d\n",
+                                         __func__, ring->pipe);
                                break;
                        }
                } else {
-                       DRM_DEBUG("si_irq_set: sw int cp1 invalid me %d\n", ring->me);
+                       DRM_DEBUG("%s: sw int cp1 invalid me %d\n", __func__,
+                                 ring->me);
                }
        }
        if (atomic_read(&rdev->irq.ring_int[CAYMAN_RING_TYPE_CP2_INDEX])) {
                struct radeon_ring *ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX];
-               DRM_DEBUG("si_irq_set: sw int cp2\n");
+               DRM_DEBUG("%s: sw int cp2\n", __func__);
                if (ring->me = 1) {
                        switch (ring->pipe) {
                        case 0:
                                cp_m1p0 |= TIME_STAMP_INT_ENABLE;
                                break;
                        default:
-                               DRM_DEBUG("si_irq_set: sw int cp2 invalid pipe %d\n", ring->pipe);
+                               DRM_DEBUG("%s: sw int cp2 invalid pipe %d\n",
+                                         __func__, ring->pipe);
                                break;
                        }
                } else {
-                       DRM_DEBUG("si_irq_set: sw int cp2 invalid me %d\n", ring->me);
+                       DRM_DEBUG("%s: sw int cp2 invalid me %d\n", __func__,
+                                 ring->me);
                }
        }
 

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#51 lore raw

Re: [PATCH 20/20] drm/radeon: fix misspelling of current function in string

Quoted 11 lines · Alex Deucher
Quoted 6 lines · Julia Lawall

Replace a misspelled function name by %s and then __func__.

This was done using Coccinelle, including the use of Levenshtein distance, as proposed by Rasmus Villemoes.

Looks fine to me. For consistency, any chance you'd want to fix up the other places that use function names directly with this style patch?

I will try to do that soon.

julia

Quoted 70 lines

Alex

Quoted 58 lines

---
The semantic patch is difficult to summarize, but is available in the cover letter of this patch series.

 drivers/gpu/drm/radeon/cik.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/cik.c +10 -6
index 6dcde37..24d5e43 100644
@@ -7367,34 +7367,38 @@ int cik_irq_set(struct radeon_device *rdev)
        }
        if (atomic_read(&rdev->irq.ring_int[CAYMAN_RING_TYPE_CP1_INDEX])) {
                struct radeon_ring *ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX];
-               DRM_DEBUG("si_irq_set: sw int cp1\n");
+               DRM_DEBUG("%s: sw int cp1\n", __func__);
                if (ring->me == 1) {
                        switch (ring->pipe) {
                        case 0:
                                cp_m1p0 |= TIME_STAMP_INT_ENABLE;
                                break;
                        default:
-                               DRM_DEBUG("si_irq_set: sw int cp1 invalid pipe %d\n", ring->pipe);
+                               DRM_DEBUG("%s: sw int cp1 invalid pipe %d\n",
+                                         __func__, ring->pipe);
                                break;
                        }
                } else {
-                       DRM_DEBUG("si_irq_set: sw int cp1 invalid me %d\n", ring->me);
+                       DRM_DEBUG("%s: sw int cp1 invalid me %d\n", __func__,
+                                 ring->me);
                }
        }
        if (atomic_read(&rdev->irq.ring_int[CAYMAN_RING_TYPE_CP2_INDEX])) {
                struct radeon_ring *ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX];
-               DRM_DEBUG("si_irq_set: sw int cp2\n");
+               DRM_DEBUG("%s: sw int cp2\n", __func__);
                if (ring->me == 1) {
                        switch (ring->pipe) {
                        case 0:
                                cp_m1p0 |= TIME_STAMP_INT_ENABLE;
                                break;
                        default:
-                               DRM_DEBUG("si_irq_set: sw int cp2 invalid pipe %d\n", ring->pipe);
+                               DRM_DEBUG("%s: sw int cp2 invalid pipe %d\n",
+                                         __func__, ring->pipe);
                                break;
                        }
                } else {
-                       DRM_DEBUG("si_irq_set: sw int cp2 invalid me %d\n", ring->me);
+                       DRM_DEBUG("%s: sw int cp2 invalid me %d\n", __func__,
+                                 ring->me);
                }
        }
 
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#52 lore raw
In reply to Julia Lawall

Hi Julia,

Quoted 3 lines · Julia Lawall

These patches replace what appears to be a reference to the name of the current function but is misspelled in some way by either the name of the function itself, or by %s and then __func__ in an argument list.

Would there be any value in doing this for _all_ cases where the function name is written in a format string?

Thanks,

Signature · 4 lines
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
#53 lore raw
Quoted 9 lines · Julian Calaby

Hi Julia,

Quoted 3 lines · Julia Lawall

These patches replace what appears to be a reference to the name of the current function but is misspelled in some way by either the name of the function itself, or by %s and then __func__ in an argument list.

Would there be any value in doing this for _all_ cases where the function name is written in a format string?

Probably. But there are a lot of them. Even for the misspellings, I have only don about 1/3 of the cases.

On the other hand, the misspelling have to be checked carefully, because a misspelling of one thing could be the correct spelling of the thing thst was actually intended.

Joe, however, points out that a lot of these prints are just for function tracing, and could be removed. I worked on another semantic patch that tries to do that. It might be better to remove those prints completely, rather than sending one patch to transform them and then one patch to remove them after that. That is why for this series I did only the ones where there was actually a problem.

julia
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#54 lore raw

Hi Julia,

Quoted 19 lines · Julia Lawall
Quoted 9 lines · Julian Calaby

Hi Julia,

Quoted 3 lines · Julia Lawall

These patches replace what appears to be a reference to the name of the current function but is misspelled in some way by either the name of the function itself, or by %s and then __func__ in an argument list.

Would there be any value in doing this for _all_ cases where the function name is written in a format string?

Probably. But there are a lot of them. Even for the misspellings, I have only don about 1/3 of the cases.

On the other hand, the misspelling have to be checked carefully, because a misspelling of one thing could be the correct spelling of the thing thst was actually intended.

Quoted 6 lines

Joe, however, points out that a lot of these prints are just for function tracing, and could be removed. I worked on another semantic patch that tries to do that. It might be better to remove those prints completely, rather than sending one patch to transform them and then one patch to remove them after that. That is why for this series I did only the ones where there was actually a problem.

Ok, that makes sense.

Either way though, this is a really interesting application of the semantic patching. Nice work!

Thanks,

Signature · 8 lines
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#55 lore raw
In reply to Julia Lawall
Quoted 3 lines · Julia Lawall

These patches replace what appears to be a reference to the name of the current function but is misspelled in some way by either the name of the function itself, or by %s and then __func__ in an argument list.

At least a few of these seem to be function tracing style uses that might as well be deleted instead.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel