mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/16] drivers/net/atl1c: remove exceptional & on function name
@ 2009-11-18 18:20 Julia Lawall
  2009-11-18 18:40 ` Joe Perches
  2009-11-18 18:47 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2009-11-18 18:20 UTC (permalink / raw)
  To: Jay Cliburn, Chris Snook, Jie Yang, atl1-devel, arnd, joe,
	linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

In this file, function names are otherwise used as pointers without &.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r@
identifier f;
@@

f(...) { ... }

@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/net/atl1c/atl1c_main.c      |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index 5ef9e23..1e2f57d 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -2135,7 +2135,7 @@ static int atl1c_request_irq(struct atl1c_adapter *adapter)
 
 	if (!adapter->have_msi)
 		flags |= IRQF_SHARED;
-	err = request_irq(adapter->pdev->irq, &atl1c_intr, flags,
+	err = request_irq(adapter->pdev->irq, atl1c_intr, flags,
 			netdev->name, netdev);
 	if (err) {
 		if (netif_msg_ifup(adapter))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/16] drivers/net/atl1c: remove exceptional & on function name
  2009-11-18 18:20 [PATCH 1/16] drivers/net/atl1c: remove exceptional & on function name Julia Lawall
@ 2009-11-18 18:40 ` Joe Perches
  2009-11-18 21:07   ` Julia Lawall
  2009-11-18 18:47 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2009-11-18 18:40 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Jay Cliburn, Chris Snook, atl1-devel, Jie Yang, kernel-janitors,
	linux-kernel, arnd

On Wed, 2009-11-18 at 19:20 +0100, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> In this file, function names are otherwise used as pointers without &.
> 
> A simplified version of the semantic patch that makes this change is as
> follows: (http://coccinelle.lip6.fr/)

Hi Julia, thanks for doing this.

Can you please post the complete version of the semantic patch?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/16] drivers/net/atl1c: remove exceptional & on function name
  2009-11-18 18:20 [PATCH 1/16] drivers/net/atl1c: remove exceptional & on function name Julia Lawall
  2009-11-18 18:40 ` Joe Perches
@ 2009-11-18 18:47 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2009-11-18 18:47 UTC (permalink / raw)
  To: julia
  Cc: jcliburn, chris.snook, jie.yang, atl1-devel, arnd, joe,
	linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>
Date: Wed, 18 Nov 2009 19:20:24 +0100 (CET)

Please don't forget to CC: netdev on networking patches.

> In this file, function names are otherwise used as pointers without &.
 ...
> Signed-off-by: Julia Lawall <julia@diku.dk>

Applied to net-next-2.6 thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/16] drivers/net/atl1c: remove exceptional & on function name
  2009-11-18 18:40 ` Joe Perches
@ 2009-11-18 21:07   ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2009-11-18 21:07 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jay Cliburn, Chris Snook, atl1-devel, Jie Yang, kernel-janitors,
	linux-kernel, arnd

On Wed, 18 Nov 2009, Joe Perches wrote:

> On Wed, 2009-11-18 at 19:20 +0100, Julia Lawall wrote:
> > From: Julia Lawall <julia@diku.dk>
> > 
> > In this file, function names are otherwise used as pointers without &.
> > 
> > A simplified version of the semantic patch that makes this change is as
> > follows: (http://coccinelle.lip6.fr/)
> 
> Hi Julia, thanks for doing this.
> 
> Can you please post the complete version of the semantic patch?

There are basically three parts to the following semantic patch.  The 
first part counts the number of references to functions that do and do not 
have & in front of them.  For simplicity, a function is considered to be 
something that is explicitly defined in the current file.  It would be 
possible to also consider functions for which there is only a prototype.

The second part, consisting of the python code in the middle considers the 
counts and decides which transformation to make, if any.  In the end, to 
limit the number of files to consider, I just consider files for which 
there is only one occurrence of one case and more than 9 occurrences of 
the other.  The two small python rules after that one throw away all of 
the matches of function names that do not correspond to the case that is 
desired.

The last few rules do the transformation.  Both transformations are put in 
one rule, which is safe because all matches for the transformation that is 
not wanted have been discarded.

julia

@script:python@
@@

with_and = 0
without_and = 0

@r@
identifier f;
@@

f(...) { ... }

@addr1@
identifier r.f;
position pa;
@@

 &f@pa

@script:python@
p << addr1.pa;
@@

with_and = with_and + 1

@r1@
identifier r.f;
position p;
declarer name  EXPORT_SYMBOL;
@@

(
EXPORT_SYMBOL(f@p);
|
module_init(f@p);
|
module_exit(f@p);
|
f@p(...)
)

@noaddr1@
identifier r.f;
position pn != r1.p;
@@

(
  &f
|
 f@pn
)

@script:python@
p << noaddr1.pn;
@@

without_and = without_and + 1

@script:python@
@@

choose_without_and = False
#if (with_and * 25 < without_and):
#  choose_without_and = True
if (with_and == 1 and without_and > 9):
  choose_without_and = True

choose_with_and = False
#if (without_and * 25 < with_and):
#  choose_with_and = True
if (without_and == 1 and with_and > 9):
  choose_with_and = True

@script:python@
p << addr1.pa;
f << r.f;
@@

if (choose_with_and or not choose_without_and):
  cocci.include_match(False)

@script:python@
p << noaddr1.pn;
f << r.f;
@@

if (choose_without_and or not choose_with_and):
  cocci.include_match(False)

@@
identifier f;
position addr1.pa;
position noaddr1.pn;
@@

(
- &f@pa
+ f
|
- f@pn
+ &f
)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-18 21:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-18 18:20 [PATCH 1/16] drivers/net/atl1c: remove exceptional & on function name Julia Lawall
2009-11-18 18:40 ` Joe Perches
2009-11-18 21:07   ` Julia Lawall
2009-11-18 18:47 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®