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

leds: 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.function = f;
-t.data = d;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Bryan Wu <cooloney@gmail.com>

authored by

Julia Lawall and committed by
Bryan Wu
137fe48d 56d06fde

+2 -3
+2 -3
drivers/leds/led-class.c
··· 239 239 240 240 INIT_WORK(&led_cdev->set_brightness_work, set_brightness_delayed); 241 241 242 - init_timer(&led_cdev->blink_timer); 243 - led_cdev->blink_timer.function = led_timer_function; 244 - led_cdev->blink_timer.data = (unsigned long)led_cdev; 242 + setup_timer(&led_cdev->blink_timer, led_timer_function, 243 + (unsigned long)led_cdev); 245 244 246 245 #ifdef CONFIG_LEDS_TRIGGERS 247 246 led_trigger_set_default(led_cdev);