Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] pvrusb2: Use setup_timer

Convert a call to init_timer and accompanying intializations of
the timer's data and function fields to a call to setup_timer.

A simplified version of the semantic match that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression t,f,d;
@@

-init_timer(&t);
+setup_timer(&t,f,d);
-t.data = d;
-t.function = f;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Julia Lawall and committed by
Mauro Carvalho Chehab
03f23fc5 f57cffb9

+10 -16
+10 -16
drivers/media/usb/pvrusb2/pvrusb2-hdw.c
··· 2425 2425 } 2426 2426 if (!hdw) goto fail; 2427 2427 2428 - init_timer(&hdw->quiescent_timer); 2429 - hdw->quiescent_timer.data = (unsigned long)hdw; 2430 - hdw->quiescent_timer.function = pvr2_hdw_quiescent_timeout; 2428 + setup_timer(&hdw->quiescent_timer, pvr2_hdw_quiescent_timeout, 2429 + (unsigned long)hdw); 2431 2430 2432 - init_timer(&hdw->decoder_stabilization_timer); 2433 - hdw->decoder_stabilization_timer.data = (unsigned long)hdw; 2434 - hdw->decoder_stabilization_timer.function = 2435 - pvr2_hdw_decoder_stabilization_timeout; 2431 + setup_timer(&hdw->decoder_stabilization_timer, 2432 + pvr2_hdw_decoder_stabilization_timeout, 2433 + (unsigned long)hdw); 2436 2434 2437 - init_timer(&hdw->encoder_wait_timer); 2438 - hdw->encoder_wait_timer.data = (unsigned long)hdw; 2439 - hdw->encoder_wait_timer.function = pvr2_hdw_encoder_wait_timeout; 2435 + setup_timer(&hdw->encoder_wait_timer, pvr2_hdw_encoder_wait_timeout, 2436 + (unsigned long)hdw); 2440 2437 2441 - init_timer(&hdw->encoder_run_timer); 2442 - hdw->encoder_run_timer.data = (unsigned long)hdw; 2443 - hdw->encoder_run_timer.function = pvr2_hdw_encoder_run_timeout; 2438 + setup_timer(&hdw->encoder_run_timer, pvr2_hdw_encoder_run_timeout, 2439 + (unsigned long)hdw); 2444 2440 2445 2441 hdw->master_state = PVR2_STATE_DEAD; 2446 2442 ··· 3676 3680 hdw->ctl_timeout_flag = 0; 3677 3681 hdw->ctl_write_pend_flag = 0; 3678 3682 hdw->ctl_read_pend_flag = 0; 3679 - init_timer(&timer); 3683 + setup_timer(&timer, pvr2_ctl_timeout, (unsigned long)hdw); 3680 3684 timer.expires = jiffies + timeout; 3681 - timer.data = (unsigned long)hdw; 3682 - timer.function = pvr2_ctl_timeout; 3683 3685 3684 3686 if (write_len) { 3685 3687 hdw->cmd_debug_state = 2;