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>
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 35aef5e..0a9c41f 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -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) {
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index 7516030..d95fb84 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -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;
}
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c
index 76a6e0c..ae6e30d 100644
--- a/drivers/net/ethernet/hp/hp100.c
+++ b/drivers/net/ethernet/hp/hp100.c
@@ -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;
}
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 6dcde37..24d5e43 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -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);
}
}
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index d476279..14acac8 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -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;
}
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index a904403..259b656 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -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;
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 6e04e30..a1bc3e3 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -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
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 383c4c7..c8dd8dc 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -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
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index 09254a4..939d376 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -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 [] = {
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/dm.c b/drivers/net/wireless/rtlwifi/rtl8821ae/dm.c
index 9be1061..ba30b0d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/dm.c
@@ -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)
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 73a49b8..07b94ed 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -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;
}
}
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb/sge.c b/drivers/net/ethernet/chelsio/cxgb/sge.c
index 4c58793..86222a1 100644
--- a/drivers/net/ethernet/chelsio/cxgb/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c
@@ -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)
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index b6ec519..50033aa 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -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;
}
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index e5dae7b..85fd163 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -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);
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 5b93ed8..347fb49 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -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;
}
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index 1db8b26..4c1f08e 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -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;
}
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index a795d81..ebb4556 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -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:
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 89a8266..1f2a668 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -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;
}
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/net/ethernet/dec/tulip/uli526x.c b/drivers/net/ethernet/dec/tulip/uli526x.c
index 4061f9b..1c5916b 100644
--- a/drivers/net/ethernet/dec/tulip/uli526x.c
+++ b/drivers/net/ethernet/dec/tulip/uli526x.c
@@ -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);
}
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index d2ba315..fa21d1c 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -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;
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index d9f85f9..b2d7600 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -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;
The function name contains cleanup, not clean.
This was done using Coccinelle, including the use of Levenshtein distance,
as proposed by Rasmus Villemoes.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/net/ethernet/dec/tulip/dmfe.c b/drivers/net/ethernet/dec/tulip/dmfe.c
index c820560..50a0077 100644
--- a/drivers/net/ethernet/dec/tulip/dmfe.c
+++ b/drivers/net/ethernet/dec/tulip/dmfe.c
@@ -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);
}
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/isdn/pcbit/layer2.c b/drivers/isdn/pcbit/layer2.c
index 42ecfef..46e1240 100644
--- a/drivers/isdn/pcbit/layer2.c
+++ b/drivers/isdn/pcbit/layer2.c
@@ -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;
}
diff --git a/drivers/isdn/hisax/ipacx.c b/drivers/isdn/hisax/ipacx.c
index 5faa5de..9cc26b4 100644
--- a/drivers/isdn/hisax/ipacx.c
+++ b/drivers/isdn/hisax/ipacx.c
@@ -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);
}
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index 849a807..678bd52 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -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;
}
diff --git a/drivers/isdn/hisax/hfc_2bs0.c b/drivers/isdn/hisax/hfc_2bs0.c
index 838531b..14dada4 100644
--- a/drivers/isdn/hisax/hfc_2bs0.c
+++ b/drivers/isdn/hisax/hfc_2bs0.c
@@ -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);
diff --git a/drivers/isdn/hisax/isdnl1.c b/drivers/isdn/hisax/isdnl1.c
index 8000957..a560842 100644
--- a/drivers/isdn/hisax/isdnl1.c
+++ b/drivers/isdn/hisax/isdnl1.c
@@ -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;
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c
index fa1fefd..b1fad81 100644
--- a/drivers/isdn/hisax/hfc_sx.c
+++ b/drivers/isdn/hisax/hfc_sx.c
@@ -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;
diff --git a/drivers/isdn/hisax/isdnl3.c b/drivers/isdn/hisax/isdnl3.c
index 45b0384..c754706 100644
--- a/drivers/isdn/hisax/isdnl3.c
+++ b/drivers/isdn/hisax/isdnl3.c
@@ -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;
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c
index 00aad10..93bae94 100644
--- a/drivers/isdn/hysdn/hycapi.c
+++ b/drivers/isdn/hysdn/hycapi.c
@@ -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 "";
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index 56d8486..d3f8330 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -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;
}
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.
Signed-off-by: Julia Lawall <[email protected]>
---
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(-)
diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
index 78f79e3..e2f600e 100644
--- a/drivers/pci/host/pci-keystone.c
+++ b/drivers/pci/host/pci-keystone.c
@@ -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
On Sun, Dec 7, 2014 at 11:20 AM, Julia Lawall <[email protected]> wrote:
> The function name contains cleanup, not clean.
>
> This was done using Coccinelle, including the use of Levenshtein distance,
> as proposed by Rasmus Villemoes.
>
> Signed-off-by: Julia Lawall <[email protected]>
Thanks - seems like a obvious mistake.
Acked-by: Grant Grundler <[email protected]>
>
> ---
> 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(-)
>
> diff --git a/drivers/net/ethernet/dec/tulip/dmfe.c b/drivers/net/ethernet/dec/tulip/dmfe.c
> index c820560..50a0077 100644
> --- a/drivers/net/ethernet/dec/tulip/dmfe.c
> +++ b/drivers/net/ethernet/dec/tulip/dmfe.c
> @@ -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);
> }
>
>
On Sun, Dec 07 2014, Julia Lawall <[email protected]> wrote:
> Replace a misspelled function name by %s and then __func__.
>
> The function name begins with pci, not cpci.
...
> 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
Julia,
On Sun, Dec 07, 2014 at 08:20:50PM +0100, Julia Lawall wrote:
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> 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(-)
>
> diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
> index 09254a4..939d376 100644
> --- a/drivers/usb/host/isp1760-if.c
> +++ b/drivers/usb/host/isp1760-if.c
> @@ -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.
> 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
--
- Jeremiah Mahler
On Sun, 7 Dec 2014, Rasmus Villemoes wrote:
> On Sun, Dec 07 2014, Julia Lawall <[email protected]> wrote:
>
> > Replace a misspelled function name by %s and then __func__.
> >
> > The function name begins with pci, not cpci.
> ...
> > 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
Julia,
On Sun, Dec 07, 2014 at 08:20:54PM +0100, Julia Lawall wrote:
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> 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(-)
>
> diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c
> index 76a6e0c..ae6e30d 100644
> --- a/drivers/net/ethernet/hp/hp100.c
> +++ b/drivers/net/ethernet/hp/hp100.c
> @@ -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.
> 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.
> 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/
--
- Jeremiah Mahler
On Sun, 7 Dec 2014, Jeremiah Mahler wrote:
> Julia,
>
> On Sun, Dec 07, 2014 at 08:20:50PM +0100, Julia Lawall wrote:
> > 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.
> >
> > Signed-off-by: Julia Lawall <[email protected]>
> >
> > ---
> > 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(-)
> >
> > diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
> > index 09254a4..939d376 100644
> > --- a/drivers/usb/host/isp1760-if.c
> > +++ b/drivers/usb/host/isp1760-if.c
> > @@ -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.
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
> > 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
>
> --
> - 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
>
On Sun, Dec 7, 2014 at 11:20 AM, Julia Lawall <[email protected]> wrote:
> 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
> This was done using Coccinelle, including the use of Levenshtein distance,
> as proposed by Rasmus Villemoes.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> 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(-)
>
> diff --git a/drivers/net/ethernet/dec/tulip/uli526x.c b/drivers/net/ethernet/dec/tulip/uli526x.c
> index 4061f9b..1c5916b 100644
> --- a/drivers/net/ethernet/dec/tulip/uli526x.c
> +++ b/drivers/net/ethernet/dec/tulip/uli526x.c
> @@ -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);
> }
>
>
Julia,
On Sun, Dec 07, 2014 at 09:45:15PM +0100, Julia Lawall wrote:
>
>
> On Sun, 7 Dec 2014, Jeremiah Mahler wrote:
>
> > Julia,
> >
> > On Sun, Dec 07, 2014 at 08:20:50PM +0100, Julia Lawall wrote:
> > > Replace a misspelled function name by %s and then __func__.
[...]
> > >
> > > 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
>
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.
> > > 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
> >
> > --
> > - 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
> >
--
- Jeremiah Mahler
Julia,
On Sun, Dec 07, 2014 at 08:21:01PM +0100, Julia Lawall wrote:
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> The semantic patch is difficult to summarize, but is available in the cover
[...]
> @@ -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.
> --
> 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
--
- Jeremiah Mahler
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.
Signed-off-by: Julia Lawall <[email protected]>
Acked-by: Grant Grundler <[email protected]>
---
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(-)
diff --git a/drivers/net/ethernet/dec/tulip/uli526x.c b/drivers/net/ethernet/dec/tulip/uli526x.c
index 4061f9b..1c5916b 100644
--- a/drivers/net/ethernet/dec/tulip/uli526x.c
+++ b/drivers/net/ethernet/dec/tulip/uli526x.c
@@ -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);
}
On Sun, 7 Dec 2014, Jeremiah Mahler wrote:
> Julia,
>
> On Sun, Dec 07, 2014 at 08:21:01PM +0100, Julia Lawall wrote:
> > 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.
> >
> > Signed-off-by: Julia Lawall <[email protected]>
> >
> > ---
> > The semantic patch is difficult to summarize, but is available in the cover
> [...]
> > @@ -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 :-)
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
On Sun, Dec 7, 2014 at 8:20 PM, Julia Lawall <[email protected]> wrote:
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> 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(-)
>
> diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
> index 35aef5e..0a9c41f 100644
> --- a/drivers/mtd/nand/s3c2410.c
> +++ b/drivers/mtd/nand/s3c2410.c
> @@ -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...
--
Thanks,
//richard
Hi Julia,
On Mon, Dec 8, 2014 at 6:20 AM, Julia Lawall <[email protected]> wrote:
> 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,
--
Julian Calaby
Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
On Sun, 2014-12-07 at 20:20 +0100, Julia Lawall wrote:
> 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.
On Mon, 8 Dec 2014, Julian Calaby wrote:
> Hi Julia,
>
> On Mon, Dec 8, 2014 at 6:20 AM, Julia Lawall <[email protected]> wrote:
> > 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
> > diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
> > index 35aef5e..0a9c41f 100644
> > --- a/drivers/mtd/nand/s3c2410.c
> > +++ b/drivers/mtd/nand/s3c2410.c
> > @@ -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...
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
On 12/07/2014, 08:20 PM, Julia Lawall wrote:
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> 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(-)
>
> diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
> index d9f85f9..b2d7600 100644
> --- a/drivers/tty/amiserial.c
> +++ b/drivers/tty/amiserial.c
> @@ -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,
--
js
suse labs
Am 08.12.2014 um 08:11 schrieb Julia Lawall:
>>> diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
>>> index 35aef5e..0a9c41f 100644
>>> --- a/drivers/mtd/nand/s3c2410.c
>>> +++ b/drivers/mtd/nand/s3c2410.c
>>> @@ -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...
>
> 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
On Mon, 2014-12-08 at 09:49 +0100, Jiri Slaby wrote:
> On 12/07/2014, 08:20 PM, Julia Lawall wrote:
> > Replace the last argument of serial_paranoia_check by the actual function
> > name.
[]
> > diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
[]
> > @@ -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.
On 12/08/2014, 10:18 AM, Joe Perches wrote:
> On Mon, 2014-12-08 at 09:49 +0100, Jiri Slaby wrote:
>> On 12/07/2014, 08:20 PM, Julia Lawall wrote:
>>> Replace the last argument of serial_paranoia_check by the actual function
>>> name.
> []
>>> diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
> []
>>> @@ -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.
And I would bet more. They are mostly copy&paste drivers.
> 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.
--
js
suse labs
On Sun, 07 Dec 2014, Julia Lawall <[email protected]> wrote:
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> 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.
>
> drivers/gpu/drm/i915/i915_gem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index d2ba315..fa21d1c 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -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;
>
--
Jani Nikula, Intel Open Source Technology Center
On Mon, Dec 08, 2014 at 12:24:27PM +0200, Jani Nikula wrote:
> On Sun, 07 Dec 2014, Julia Lawall <[email protected]> wrote:
> > 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.
> >
> > Signed-off-by: Julia Lawall <[email protected]>
> >
> > ---
> > 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
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
On 12/07/2014 02:20 PM, Julia Lawall wrote:
> 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.
>
> Signed-off-by: Julia Lawall<[email protected]>
>
> ---
> 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(-)
>
> diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
> index 78f79e3..e2f600e 100644
> --- a/drivers/pci/host/pci-keystone.c
> +++ b/drivers/pci/host/pci-keystone.c
> @@ -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: Murali Karicheri <[email protected]>
--
Murali Karicheri
Linux Kernel, Texas Instruments
On Sun, Dec 7, 2014 at 2:21 PM, Julia Lawall <[email protected]> wrote:
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
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
>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index 6dcde37..24d5e43 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -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
On Mon, 8 Dec 2014, Alex Deucher wrote:
> On Sun, Dec 7, 2014 at 2:21 PM, Julia Lawall <[email protected]> wrote:
> > 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.
> >
> > Signed-off-by: Julia Lawall <[email protected]>
>
> 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
>
> Alex
>
> >
> > ---
> > 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(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> > index 6dcde37..24d5e43 100644
> > --- a/drivers/gpu/drm/radeon/cik.c
> > +++ b/drivers/gpu/drm/radeon/cik.c
> > @@ -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
> --
> 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
>
From: Julia Lawall <[email protected]>
Date: Sun, 7 Dec 2014 20:20:54 +0100
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
Applied.
From: Julia Lawall <[email protected]>
Date: Sun, 7 Dec 2014 20:20:56 +0100
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
Applied.
From: Julia Lawall <[email protected]>
Date: Sun, 7 Dec 2014 20:20:54 +0100
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
Applied.
From: Julia Lawall <[email protected]>
Date: Sun, 7 Dec 2014 20:20:56 +0100
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
Applied.
From: Julia Lawall <[email protected]>
Date: Sun, 7 Dec 2014 20:20:52 +0100
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
Applied.
From: Julia Lawall <[email protected]>
Date: Sun, 7 Dec 2014 20:20:46 +0100
> The function name contains cleanup, not clean.
>
> This was done using Coccinelle, including the use of Levenshtein distance,
> as proposed by Rasmus Villemoes.
>
> Signed-off-by: Julia Lawall <[email protected]>
Applied.
From: Julia Lawall <[email protected]>
Date: Sun, 7 Dec 2014 20:20:47 +0100
> 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.
>
> Signed-off-by: Julia Lawall <[email protected]>
Applied.
Hi Julia,
On Mon, Dec 8, 2014 at 5:43 PM, Julia Lawall <[email protected]> wrote:
> On Mon, 8 Dec 2014, Julian Calaby wrote:
>
>> Hi Julia,
>>
>> On Mon, Dec 8, 2014 at 6:20 AM, Julia Lawall <[email protected]> wrote:
>> > 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.
Ok, that makes sense.
Either way though, this is a really interesting application of the
semantic patching. Nice work!
Thanks,
--
Julian Calaby
Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
On Mon, Dec 08, 2014 at 10:16:37AM +0100, Richard Weinberger wrote:
> Am 08.12.2014 um 08:11 schrieb Julia Lawall:
> >>> diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
> >>> index 35aef5e..0a9c41f 100644
> >>> --- a/drivers/mtd/nand/s3c2410.c
> >>> +++ b/drivers/mtd/nand/s3c2410.c
> >>> @@ -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...
> >
> > 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.
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.
Reported-by: Julia Lawall <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
---
drivers/mtd/nand/s3c2410.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 35aef5edb588..0e02be47ce1d 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -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:
--
2.3.0