Skip to contentSkip to conversation

Staging: Remove & from function name.

PATCH In review Sandhya Bankar 3 participants 8 messages Mar 19, 2016 – Mar 20, 2016 Staging

lore
Share & tools
lore
#0 lore raw

cover Staging: Remove & from function name.

Remove & from function name,when function name passed as an argument to another function. Function name is used as pointer without &.

Sandhya Bankar (2):
Staging: netlogic: Remove & from function name.
Staging: rdma: Remove & from function name.

 drivers/staging/netlogic/xlr_net.c | 2 +-
 drivers/staging/rdma/hfi1/verbs.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.3.4
#1 lore raw

PATCH 1/2 Staging: netlogic: Remove & from function name.

Remove & from function name,when function name passed as an argument to another function. Function name is used as pointer without &.

---
 drivers/staging/netlogic/xlr_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/netlogic/xlr_net.c +1 -1
index aa1cdf6..99445d0 100644
@@ -850,7 +850,7 @@ static int xlr_mii_probe(struct xlr_net_priv *priv)
 
 	/* Attach MAC to PHY */
 	phydev = phy_connect(priv->ndev, phydev_name(phydev),
-			     &xlr_gmac_link_adjust, priv->nd->phy_interface);
+			     xlr_gmac_link_adjust, priv->nd->phy_interface);
 
 	if (IS_ERR(phydev)) {
 		pr_err("could not attach PHY\n");
Signature · 1 line
1.8.3.4
#2 lore raw

PATCH 2/2 Staging: rdma: Remove & from function name.

In reply to Sandhya Bankar

Remove & from function name.

---
 drivers/staging/rdma/hfi1/verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rdma/hfi1/verbs.c +1 -1
index 1761686..ece62b7 100644
@@ -261,7 +261,7 @@ static const opcode_handler opcode_handler_tbl[256] = {
 	[IB_OPCODE_UD_SEND_ONLY]                      = &hfi1_ud_rcv,
 	[IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE]       = &hfi1_ud_rcv,
 	/* CNP */
-	[IB_OPCODE_CNP]				      = &hfi1_cnp_rcv
+	[IB_OPCODE_CNP]				      = hfi1_cnp_rcv
 };
 
 /*
Signature · 1 line
1.8.3.4
#3 lore raw

Re: [Outreachy kernel] [PATCH 2/2] Staging: rdma: Remove & from function name.

Quoted 12 lines · Sandhya Bankar

Remove & from function name.

---
 drivers/staging/rdma/hfi1/verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rdma/hfi1/verbs.c +0 -0
index 1761686..ece62b7 100644

drivers/staging/rdma/hfi1/verbs.c static const opcode_handler opcode_handler_tbl[256] = { · line 264

Quoted 5 lines
drivers/staging/rdma/hfi1/verbs.c +1 -1
@@ -261,7 +261,7 @@ static const opcode_handler opcode_handler_tbl[256] = {
 	[IB_OPCODE_UD_SEND_ONLY]                      = &hfi1_ud_rcv,
 	[IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE]       = &hfi1_ud_rcv,
 	/* CNP */
-	[IB_OPCODE_CNP]				      = &hfi1_cnp_rcv
+	[IB_OPCODE_CNP]				      = hfi1_cnp_rcv

Why not make the change in the other cases?

julia

Quoted 13 lines
drivers/staging/rdma/hfi1/verbs.c +0 -0
 };
 
 /*
Signature · 8 lines
1.8.3.4

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

Re: [Outreachy kernel] [PATCH 2/2] Staging: rdma: Remove & from function name.

Hello,
I have run the following cocci scripts,

############################################
//
// Remove exceptional & on function name
//
// Target: Linux
// Copyright: 2012 - LIP6/INRIA
// License: Licensed under ISC. See LICENSE or
http://www.isc.org/software/license
// Author: Julia Lawall <[email protected]>
// URL: http://coccinelle.lip6.fr/
// URL: http://coccinellery.org/

@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
)
#############################################################################################

The cocci file reported above change only. should i remove in other case also as these are function names?

Quoted 44 lines · Julia Lawall

Review

Quoted 8 lines · Sandhya Bankar

Remove & from function name.

---
 drivers/staging/rdma/hfi1/verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/rdma/hfi1/verbs.c

drivers/staging/rdma/hfi1/verbs.c static const opcode_handler opcode_handler_tbl[256]

Quoted 4 lines

index 1761686..ece62b7 100644

drivers/staging/rdma/hfi1/verbs.c +0 -0
@@ -261,7 +261,7 @@ static const opcode_handler opcode_handler_tbl[256]

= {

drivers/staging/rdma/hfi1/verbs.c static const opcode_handler opcode_handler_tbl[256] = { · line 264

Quoted 5 lines
drivers/staging/rdma/hfi1/verbs.c +1 -1
      [IB_OPCODE_UD_SEND_ONLY]                      = &hfi1_ud_rcv,
      [IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE]       = &hfi1_ud_rcv,
      /* CNP */
-     [IB_OPCODE_CNP]                               = &hfi1_cnp_rcv
+     [IB_OPCODE_CNP]                               = hfi1_cnp_rcv

Why not make the change in the other cases?

julia

Quoted 8 lines
drivers/staging/rdma/hfi1/verbs.c +0 -1
 };
 
 /*
--

1.8.3.4

--
You received this message because you are subscribed to the Google

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 2 lines

To post to this group, send email to [email protected]. To view this discussion on the web visit

https://groups.google.com/d/msgid/outreachy-kernel/6a66bd13896f6f5e6ff2873e697fbc72af8c8185.1458367377.git.bankarsandhya512%40gmail.com
.

Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.

#5 lore raw

Re: [Outreachy kernel] [PATCH 2/2] Staging: rdma: Remove & from function name.

Quoted 119 lines · sandhya bankar

Hello,
I have run the following cocci scripts,

############################################
//
// Remove exceptional & on function name
//
// Target: Linux
// Copyright: 2012 - LIP6/INRIA
// License: Licensed under ISC. See LICENSE or
http://www.isc.org/software/license
// Author: Julia Lawall <[email protected]>
// URL: http://coccinelle.lip6.fr/
// URL: http://coccinellery.org/

@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
)
#############################################################################################

Quoted 3 lines

The cocci file reported above change only. should i remove in other case also as these are function names?

Try running this with --recursive-includes option added in your spatch command:

// <smpl>
@r@
identifier f;
@@
f(...) { ... }
@@
identifier r.f;
@@
- &f
+ f

@m@
type T;
identifier f;
@@
T f(...);
@@
identifier m.f;
@@
- &f
+ f
// </smpl>

Also, maybe try it only for staging/rdma at first since --recursive-includes may take quite some time.

I ran into the same issue and with Julia's help, this was the solution I found. Hope it works for you.

Amitoj

#6 lore raw

Re: [Outreachy kernel] [PATCH 2/2] Staging: rdma: Remove & from function name.

Thanks for the suggestion Amitoj.
I have run spatch with suggested option but i have not got any output since 15-16 hours.
Is it expected ?

Julia,
Should i change all & from function name? however the cocci file have
not detected these.

Thanks,
Sandhya

Quoted 160 lines · Amitoj Kaur Chawla
Quoted 110 lines · sandhya bankar

Hello,
I have run the following cocci scripts,

############################################
//
// Remove exceptional & on function name
//
// Target: Linux
// Copyright: 2012 - LIP6/INRIA
// License: Licensed under ISC. See LICENSE or
http://www.isc.org/software/license
// Author: Julia Lawall <[email protected]>
// URL: http://coccinelle.lip6.fr/
// URL: http://coccinellery.org/

@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;
@@

Quoted 8 lines

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

#############################################################################################

Quoted 4 lines

The cocci file reported above change only. should i remove in other case also as these are function names?

Try running this with --recursive-includes option added in your spatch command:

// <smpl>
@r@
identifier f;
@@
f(...) { ... }
@@
identifier r.f;
@@
- &f
+ f

@m@
type T;
identifier f;
@@
T f(...);
@@
identifier m.f;
@@
- &f
+ f
// </smpl>

Also, maybe try it only for staging/rdma at first since --recursive-includes may take quite some time.

I ran into the same issue and with Julia's help, this was the solution I found. Hope it works for you.

Amitoj

#7 lore raw

Re: [Outreachy kernel] [PATCH 2/2] Staging: rdma: Remove & from function name.

Quoted 8 lines · sandhya bankar

Thanks for the suggestion Amitoj.
I have run spatch with suggested option but i have not got  any output since 15-16 hours.
Is it expected ?

Julia,
   Should i change all & from function name? however the cocci file have not detected these.

As Amitoj mentioned, it is because the others are not local functions.

Did you use the argument --include-headers-for-types?

You can also just looks at the names nearby and check by hand whether they are functions. Just say in your commit message which parts you did by hand.

julia

Quoted 181 lines

Thanks,
Sandhya

On Sat, Mar 19, 2016 at 8:24 PM, Amitoj Kaur Chawla <[email protected]> wrote:

      On Sat, Mar 19, 2016 at 7:56 PM, sandhya bankar
      <[email protected]> wrote:
      > Hello,
      > I have run the following cocci scripts,
      >
      > ############################################
      > //
      > //  Remove exceptional & on function name
      > //
      > // Target: Linux
      > // Copyright:  2012 - LIP6/INRIA
      > // License:  Licensed under ISC. See LICENSE or
      > http://www.isc.org/software/license
      > // Author: Julia Lawall <[email protected]>
      > // URL: http://coccinelle.lip6.fr/
      > // URL: http://coccinellery.org/
      >
      > @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
      > )
      >###########################################################################
      ##################
      >
      > The cocci file reported above change only. should i remove in
      other case
      > also as these are function names?
      >

Try running this with --recursive-includes option added in your spatch command:

// <smpl>
@r@
identifier f;
@@
f(...) { ... }
@@
identifier r.f;
@@
- &f
+ f

@m@
type T;
identifier f;
@@
T f(...);
@@
identifier m.f;
@@
- &f
+ f
// </smpl>

Also, maybe try it only for staging/rdma at first since --recursive-includes may take quite some time.

I ran into the same issue and with Julia's help, this was the solution I found. Hope it works for you.

Amitoj

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