public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] constify inet6_protocol structures
@ 2017-07-28 20:18 Julia Lawall
  2017-07-28 20:18 ` [PATCH 1/2] ipv6: " Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Julia Lawall @ 2017-07-28 20:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: kernel-janitors, bhumirks, netdev, linux-kernel

The inet6_protocol structure is only passed as the first argument to
inet6_add_protocol or inet6_del_protocol, both of which are declared as
const.  Thus the inet6_protocol structure itself can be const.

Done with the help of Coccinelle.

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@

static struct inet6_protocol i@p = { ... };

@ok1@
identifier r.i;
expression e1;
position p;
@@

 \(inet6_add_protocol\|inet6_del_protocol\)(&i@p,...)

@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct inet6_protocol e;
@@

e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@

static
+const
 struct inet6_protocol i = { ... };
// </smpl>

---

 net/ipv6/ip6_gre.c  |    2 +-
 net/ipv6/tcp_ipv6.c |    2 +-
 net/ipv6/udp.c      |    2 +-
 net/l2tp/l2tp_ip6.c |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

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

end of thread, other threads:[~2017-08-01 16:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-28 20:18 [PATCH 0/2] constify inet6_protocol structures Julia Lawall
2017-07-28 20:18 ` [PATCH 1/2] ipv6: " Julia Lawall
2017-07-31  9:56   ` Eric Dumazet
2017-07-31 10:10     ` Julia Lawall
2017-08-01  5:59     ` Julia Lawall
2017-08-01 16:03       ` David Ahern
2017-08-01 16:06         ` Julia Lawall
2017-07-28 20:18 ` [PATCH 2/2] l2tp: " Julia Lawall
2017-07-29  1:53 ` [PATCH 0/2] " David Miller

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