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 <ccross@android.com>
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);
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);
}
}
}