Re: [PATCH] Input: pwm-beeper - fix: scheduling while atomic
From: Manfred Schlaegl <hidden>
Date: 2016-05-27 08:55:07
Also in:
lkml
On 2016-05-26 02:36, Dmitry Torokhov wrote:
On Tue, May 24, 2016 at 10:32:53AM +0200, Manfred Schlaegl wrote:quoted
On 2016-05-20 18:59, Dmitry Torokhov wrote:quoted
Hi Manfred, On Wed, May 18, 2016 at 05:16:49PM +0200, Manfred Schlaegl wrote:quoted
@@ -133,6 +149,8 @@ static int pwm_beeper_remove(struct platform_device *pdev) { struct pwm_beeper *beeper = platform_get_drvdata(pdev); + cancel_work_sync(&beeper->work); + input_unregister_device(beeper->input);This is racy, request to play may come in after cancel_work_sync() returns but before we unregistered input device. I think you want the version below.Hi Dmitry, yes you are right. Thank you for your feedback. I also see that point, but I think it would be a simpler change just to cancel the worker after unregistering the device (to reorder cancel_work_sync and input_unregister_device).That is an option, but I wanter to have close() because I also want to convert the driver to used devm for allocating resources, and then we'd need close() anyway so that we can get rid of remove() method. Thanks.
Ok. Thanks for clarification. I will send a patch with the modifications you suggested before. The following patch will also have some slight modifications in line numbers to make it apply after cfae56f18 (input: misc: pwm-beeper: Explicitly apply PWM config extracted from pwm_args). best regards, Manfred