From b05ad710241f4a0adf9b5f9830b469acecb33156 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 12 Jan 2011 12:03:05 -0800 Subject: [PATCH] leds: cpcap: Convert to global non-reentrant workqueue schedule_work puts work items into a global workqueue that is not single threaded. If the work item is running when a second schedule_work is called, the second one could be immediately scheduled onto the second cpu while the first one is running, breaking the synchronization expected in cpcap_brightness_work. Fix by converting schedule_work to queue_work(system_nrt_wq), which puts the work on a global single-threaded workqueue. Change-Id: Ieba89e0353b86f11350cb37552afbce5abe87088 Signed-off-by: Colin Cross --- drivers/leds/leds-ld-cpcap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/leds/leds-ld-cpcap.c b/drivers/leds/leds-ld-cpcap.c index acd0fe4fe227..1bcdf7faad5f 100755 --- a/drivers/leds/leds-ld-cpcap.c +++ b/drivers/leds/leds-ld-cpcap.c @@ -48,7 +48,7 @@ static void cpcap_set(struct led_classdev *led_cdev, brightness = 255; cpcap_led_data->brightness = brightness; - schedule_work(&cpcap_led_data->brightness_work); + queue_work(system_nrt_wq, &cpcap_led_data->brightness_work); } EXPORT_SYMBOL(cpcap_set); @@ -62,7 +62,7 @@ cpcap_led_set_blink(struct cpcap_led_data *info, unsigned long blink) cpcap_uc_start(info->cpcap, CPCAP_MACRO_6); } else { cpcap_uc_stop(info->cpcap, CPCAP_MACRO_6); - schedule_work(&info->brightness_work); + queue_work(system_nrt_wq, &info->brightness_work); } } } -- 2.34.1