Input: pwm-beeper - fix race when suspending
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 19 Jan 2017 19:13:37 +0000 (11:13 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 22 Jan 2017 08:23:19 +0000 (00:23 -0800)
commite9728f0dd7dc06fb0f0d18552ab9599005cd2ab7
treefbbf52c9d3f453c52124a01ff93167d589f5f7a9
parent48a55d7de79f95176f3ab372be66165a60be222f
Input: pwm-beeper - fix race when suspending

Usually userspace sends SND_BELL and SND_TONE events, and by the time
pwm_beeper_suspend() runs userpsace is already frozen, but theoretically
in-kernel users may send these events too, and that may cause
pwm_beeper_event() scheduling another work after we canceled it.

Let's introduce a "suspended" flag and check it in pwm_beeper_event() to
avoid this race.

Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/pwm-beeper.c