[alsa-devel] [PATCH 10/10] ASoC: twl6040: Simplify code in out_drv_event for pending work check

Ujfalusi, Peter peter.ujfalusi at ti.com
Mon Sep 26 19:27:44 CEST 2011

Hi Mark,

On Mon, Sep 26, 2011 at 5:30 PM, Mark Brown
<broonie at opensource.wolfsonmicro.com> wrote:
> Would it not be easier to just not check at all?  It looks like you're
> just deciding if you should schedule the work but schedule_delayed_work
> ought to handle rescheduling of an already scheduled work item fine.

Yeah, we might not need the check.
I think we have other problems here with race conditions...
The best thing to do is to call cancel_delayed_work_sync prior we
do any modification within the twl6040_output structure.
After the cancel_delayed_work_sync, we can be sure that no work
pending, and none is executing at the moment, so we can modify
the ramp configuration, and schedule the work to do the right thing.

Thanks for bringing this to my attention, I knew something was not
right, but I have missed this.
I'll correct this in the v2 series.
BTW: the same issue applies to the wm8350 driver, I think.


More information about the Alsa-devel mailing list