diff options
| -rw-r--r-- | drivers/leds/led-class.c | 14 | ||||
| -rw-r--r-- | drivers/leds/led-core.c | 11 | ||||
| -rw-r--r-- | include/linux/leds.h | 3 |
3 files changed, 14 insertions, 14 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 129729d35478..aa29198fca3e 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
| @@ -15,10 +15,10 @@ | |||
| 15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
| 16 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
| 17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
| 18 | #include <linux/timer.h> | ||
| 18 | #include <linux/err.h> | 19 | #include <linux/err.h> |
| 19 | #include <linux/ctype.h> | 20 | #include <linux/ctype.h> |
| 20 | #include <linux/leds.h> | 21 | #include <linux/leds.h> |
| 21 | #include <linux/workqueue.h> | ||
| 22 | #include "leds.h" | 22 | #include "leds.h" |
| 23 | 23 | ||
| 24 | static struct class *leds_class; | 24 | static struct class *leds_class; |
| @@ -97,10 +97,9 @@ static const struct attribute_group *led_groups[] = { | |||
| 97 | NULL, | 97 | NULL, |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | static void led_work_function(struct work_struct *ws) | 100 | static void led_timer_function(unsigned long data) |
| 101 | { | 101 | { |
| 102 | struct led_classdev *led_cdev = | 102 | struct led_classdev *led_cdev = (void *)data; |
| 103 | container_of(ws, struct led_classdev, blink_work.work); | ||
| 104 | unsigned long brightness; | 103 | unsigned long brightness; |
| 105 | unsigned long delay; | 104 | unsigned long delay; |
| 106 | 105 | ||
| @@ -144,8 +143,7 @@ static void led_work_function(struct work_struct *ws) | |||
| 144 | } | 143 | } |
| 145 | } | 144 | } |
| 146 | 145 | ||
| 147 | queue_delayed_work(system_wq, &led_cdev->blink_work, | 146 | mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay)); |
| 148 | msecs_to_jiffies(delay)); | ||
| 149 | } | 147 | } |
| 150 | 148 | ||
| 151 | static void set_brightness_delayed(struct work_struct *ws) | 149 | static void set_brightness_delayed(struct work_struct *ws) |
| @@ -233,7 +231,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) | |||
| 233 | 231 | ||
| 234 | INIT_WORK(&led_cdev->set_brightness_work, set_brightness_delayed); | 232 | INIT_WORK(&led_cdev->set_brightness_work, set_brightness_delayed); |
| 235 | 233 | ||
| 236 | INIT_DELAYED_WORK(&led_cdev->blink_work, led_work_function); | 234 | init_timer(&led_cdev->blink_timer); |
| 235 | led_cdev->blink_timer.function = led_timer_function; | ||
| 236 | led_cdev->blink_timer.data = (unsigned long)led_cdev; | ||
| 237 | 237 | ||
| 238 | #ifdef CONFIG_LEDS_TRIGGERS | 238 | #ifdef CONFIG_LEDS_TRIGGERS |
| 239 | led_trigger_set_default(led_cdev); | 239 | led_trigger_set_default(led_cdev); |
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index 4bb116867b88..71b40d3bf776 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <linux/rwsem.h> | 17 | #include <linux/rwsem.h> |
| 18 | #include <linux/leds.h> | 18 | #include <linux/leds.h> |
| 19 | #include <linux/workqueue.h> | ||
| 20 | #include "leds.h" | 19 | #include "leds.h" |
| 21 | 20 | ||
| 22 | DECLARE_RWSEM(leds_list_lock); | 21 | DECLARE_RWSEM(leds_list_lock); |
| @@ -52,7 +51,7 @@ static void led_set_software_blink(struct led_classdev *led_cdev, | |||
| 52 | return; | 51 | return; |
| 53 | } | 52 | } |
| 54 | 53 | ||
| 55 | queue_delayed_work(system_wq, &led_cdev->blink_work, 1); | 54 | mod_timer(&led_cdev->blink_timer, jiffies + 1); |
| 56 | } | 55 | } |
| 57 | 56 | ||
| 58 | 57 | ||
| @@ -76,7 +75,7 @@ void led_blink_set(struct led_classdev *led_cdev, | |||
| 76 | unsigned long *delay_on, | 75 | unsigned long *delay_on, |
| 77 | unsigned long *delay_off) | 76 | unsigned long *delay_off) |
| 78 | { | 77 | { |
| 79 | cancel_delayed_work_sync(&led_cdev->blink_work); | 78 | del_timer_sync(&led_cdev->blink_timer); |
| 80 | 79 | ||
| 81 | led_cdev->flags &= ~LED_BLINK_ONESHOT; | 80 | led_cdev->flags &= ~LED_BLINK_ONESHOT; |
| 82 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; | 81 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; |
| @@ -91,7 +90,7 @@ void led_blink_set_oneshot(struct led_classdev *led_cdev, | |||
| 91 | int invert) | 90 | int invert) |
| 92 | { | 91 | { |
| 93 | if ((led_cdev->flags & LED_BLINK_ONESHOT) && | 92 | if ((led_cdev->flags & LED_BLINK_ONESHOT) && |
| 94 | delayed_work_pending(&led_cdev->blink_work)) | 93 | timer_pending(&led_cdev->blink_timer)) |
| 95 | return; | 94 | return; |
| 96 | 95 | ||
| 97 | led_cdev->flags |= LED_BLINK_ONESHOT; | 96 | led_cdev->flags |= LED_BLINK_ONESHOT; |
| @@ -108,7 +107,7 @@ EXPORT_SYMBOL(led_blink_set_oneshot); | |||
| 108 | 107 | ||
| 109 | void led_stop_software_blink(struct led_classdev *led_cdev) | 108 | void led_stop_software_blink(struct led_classdev *led_cdev) |
| 110 | { | 109 | { |
| 111 | cancel_delayed_work_sync(&led_cdev->blink_work); | 110 | del_timer_sync(&led_cdev->blink_timer); |
| 112 | led_cdev->blink_delay_on = 0; | 111 | led_cdev->blink_delay_on = 0; |
| 113 | led_cdev->blink_delay_off = 0; | 112 | led_cdev->blink_delay_off = 0; |
| 114 | } | 113 | } |
| @@ -117,7 +116,7 @@ EXPORT_SYMBOL_GPL(led_stop_software_blink); | |||
| 117 | void led_set_brightness(struct led_classdev *led_cdev, | 116 | void led_set_brightness(struct led_classdev *led_cdev, |
| 118 | enum led_brightness brightness) | 117 | enum led_brightness brightness) |
| 119 | { | 118 | { |
| 120 | /* delay brightness setting if need to stop soft-blink work */ | 119 | /* delay brightness setting if need to stop soft-blink timer */ |
| 121 | if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) { | 120 | if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) { |
| 122 | led_cdev->delayed_set_value = brightness; | 121 | led_cdev->delayed_set_value = brightness; |
| 123 | schedule_work(&led_cdev->set_brightness_work); | 122 | schedule_work(&led_cdev->set_brightness_work); |
diff --git a/include/linux/leds.h b/include/linux/leds.h index 6a599dce7f9d..e43686472197 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
| 16 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
| 17 | #include <linux/rwsem.h> | 17 | #include <linux/rwsem.h> |
| 18 | #include <linux/timer.h> | ||
| 18 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
| 19 | 20 | ||
| 20 | struct device; | 21 | struct device; |
| @@ -68,7 +69,7 @@ struct led_classdev { | |||
| 68 | const char *default_trigger; /* Trigger to use */ | 69 | const char *default_trigger; /* Trigger to use */ |
| 69 | 70 | ||
| 70 | unsigned long blink_delay_on, blink_delay_off; | 71 | unsigned long blink_delay_on, blink_delay_off; |
| 71 | struct delayed_work blink_work; | 72 | struct timer_list blink_timer; |
| 72 | int blink_brightness; | 73 | int blink_brightness; |
| 73 | 74 | ||
| 74 | struct work_struct set_brightness_work; | 75 | struct work_struct set_brightness_work; |
