netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/27] Use setup_timer
@ 2014-12-26 14:35 Julia Lawall
  2014-12-26 14:35 ` [PATCH 4/27] atheros: atlx: " Julia Lawall
                   ` (14 more replies)
  0 siblings, 15 replies; 23+ messages in thread
From: Julia Lawall @ 2014-12-26 14:35 UTC (permalink / raw)
  To: wil6210
  Cc: kernel-janitors, linux-wireless, netdev, linux-kernel,
	linux-media, linux-usb

These patches group a call to init_timer and initialization of the function
and data fields into a call to setup_timer.  Is there is no initialization
of the data field before add_timer is called, the the data value is set to
0UL.  If the data value has a cast to something other than unsigned long,
it is changes to a cast to unsigned long, which is the type of the data
field.

The semantic patch that performs this change is shown below
(http://coccinelle.lip6.fr/).  This semantic patch is fairly restrictive on
what appears between the init_timer call and the two field initializations,
to ensure that the there is no code that the initializations depend on.

// <smpl>
@@
expression t,d,f,e1,e2;
identifier x1,x2;
statement S1,S2;
@@

(
-t.data = d;
|
-t.function = f;
|
-init_timer(&t);
+setup_timer(&t,f,d);
|
-init_timer_on_stack(&t);
+setup_timer_on_stack(&t,f,d);
)
<... when != S1
t.x1 = e1;
...>
(
-t.data = d;
|
-t.function = f;
|
-init_timer(&t);
+setup_timer(&t,f,d);
|
-init_timer_on_stack(&t);
+setup_timer_on_stack(&t,f,d);
)
<... when != S2
t.x2 = e2;
...>
(
-t.data = d;
|
-t.function = f;
|
-init_timer(&t);
+setup_timer(&t,f,d);
|
-init_timer_on_stack(&t);
+setup_timer_on_stack(&t,f,d);
)

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

@@
expression t,d,f,e1,e2;
identifier x1,x2;
statement S1,S2;
@@

(
-t->data = d;
|
-t->function = f;
|
-init_timer(t);
+setup_timer(t,f,d);
|
-init_timer_on_stack(t);
+setup_timer_on_stack(t,f,d);
)
<... when != S1
t->x1 = e1;
...>
(
-t->data = d;
|
-t->function = f;
|
-init_timer(t);
+setup_timer(t,f,d);
|
-init_timer_on_stack(t);
+setup_timer_on_stack(t,f,d);
)
<... when != S2
t->x2 = e2;
...>
(
-t->data = d;
|
-t->function = f;
|
-init_timer(t);
+setup_timer(t,f,d);
|
-init_timer_on_stack(t);
+setup_timer_on_stack(t,f,d);
)

// ---------------------------------------------------------------------
// no initialization of data field

@@
expression t,d1,d2,f;
@@

(
-init_timer(&t);
+setup_timer(&t,f,0UL);
|
-init_timer_on_stack(&t);
+setup_timer_on_stack(&t,f,0UL);
)
... when != t.data = d1;
-t.function = f;
... when != t.data = d2;
add_timer(&t);

@@
expression t,d,f,fn;
type T;
@@

-t.function = f;
... when != t.data
    when != fn(...,(T)t,...)
(
-init_timer(&t);
+setup_timer(&t,f,d);
|
-init_timer_on_stack(&t);
+setup_timer_on_stack(&t,f,0UL);
)
... when != t.data = d;
add_timer(&t);

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

@@
expression t,d1,d2,f;
@@

(
-init_timer(t);
+setup_timer(t,f,0UL);
|
-init_timer_on_stack(t);
+setup_timer_on_stack(t,f,0UL);
)
... when != t->data = d1;
-t->function = f;
... when != t->data = d2;
add_timer(t);

@@
expression t,d,f,fn;
type T;
@@

-t->function = f;
... when != t.data
    when != fn(...,(T)t,...)
(
-init_timer(t);
+setup_timer(t,f,d);
|
-init_timer_on_stack(t);
+setup_timer_on_stack(t,f,0UL);
)
... when != t->data = d;
add_timer(t);

// ---------------------------------------------------------------------
// change data field type

@@
expression d;
type T;
@@

(
setup_timer
|
setup_timer_on_stack
)
 (...,
(
  (unsigned long)d
|
- (T)
+ (unsigned long)
  d
)
 )
// </smpl>

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

end of thread, other threads:[~2015-01-07 17:53 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-26 14:35 [PATCH 0/27] Use setup_timer Julia Lawall
2014-12-26 14:35 ` [PATCH 4/27] atheros: atlx: " Julia Lawall
2014-12-30 23:35   ` David Miller
2014-12-26 14:35 ` [PATCH 3/27] atl1e: " Julia Lawall
2014-12-30 23:35   ` David Miller
2014-12-26 14:35 ` [PATCH 8/27] wireless: cw1200: " Julia Lawall
     [not found]   ` <1419604558-29743-7-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
2015-01-07 17:53     ` Kalle Valo
2014-12-26 14:35 ` [PATCH 7/27] cw1200: main: " Julia Lawall
2014-12-26 14:35 ` [PATCH 6/27] cw1200: queue: " Julia Lawall
2014-12-26 14:35 ` [PATCH 11/27] ksz884x: " Julia Lawall
2014-12-30 23:35   ` David Miller
2014-12-26 14:35 ` [PATCH 13/27] iwlwifi: dvm: tt: " Julia Lawall
2014-12-26 14:35 ` [PATCH 12/27] iwlwifi: dvm: main: " Julia Lawall
2014-12-27 19:55   ` Grumbach, Emmanuel
2014-12-26 14:35 ` [PATCH 15/27] net: sxgbe: " Julia Lawall
2014-12-30 23:34   ` David Miller
2014-12-26 14:35 ` [PATCH 16/27] ath6kl: " Julia Lawall
     [not found] ` <1419604558-29743-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
2014-12-26 14:35   ` [PATCH 18/27] iwl4965: " Julia Lawall
2014-12-26 14:35   ` [PATCH 17/27] iwl3945: " Julia Lawall
2014-12-26 14:35 ` [PATCH 24/27] orinoco_usb: " Julia Lawall
2014-12-26 14:35 ` [PATCH 27/27] mwifiex: main: " Julia Lawall
2014-12-26 14:35 ` [PATCH 26/27] mwifiex: 11n_rxreorder: " Julia Lawall
2014-12-26 14:35 ` [PATCH 25/27] mwifiex: tdls: " Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).