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

[media] usbvision: 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>

The semantic patch also changes the cast to long to a cast to unsigned
long in the data initializer, as unsigned long is the type of the data field.

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
f57cffb9 8bf554ca

+2 -3
+2 -3
drivers/media/usb/usbvision/usbvision-core.c
··· 2194 2194 2195 2195 void usbvision_init_power_off_timer(struct usb_usbvision *usbvision) 2196 2196 { 2197 - init_timer(&usbvision->power_off_timer); 2198 - usbvision->power_off_timer.data = (long)usbvision; 2199 - usbvision->power_off_timer.function = usbvision_power_off_timer; 2197 + setup_timer(&usbvision->power_off_timer, usbvision_power_off_timer, 2198 + (unsigned long)usbvision); 2200 2199 } 2201 2200 2202 2201 void usbvision_set_power_off_timer(struct usb_usbvision *usbvision)