From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807AbcEZAgV (ORCPT ); Wed, 25 May 2016 20:36:21 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:36002 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751836AbcEZAgT (ORCPT ); Wed, 25 May 2016 20:36:19 -0400 Date: Wed, 25 May 2016 17:36:15 -0700 From: Dmitry Torokhov To: Manfred Schlaegl Cc: Thierry Reding , Manfred Schlaegl , Luis de Bethencourt , Olivier Sobrie , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH] Input: pwm-beeper - fix: scheduling while atomic Message-ID: <20160526003615.GE22369@dtor-ws> References: <56C4735E.6020300@gmx.at> <20160222194639.GD26177@dtor-ws> <20160512121852.GB26824@ulmo.ba.sec> <5735F4E3.20008@gmx.at> <573C8761.9070601@gmx.at> <20160520165918.GE14951@dtor-ws> <574411B5.2010407@gmx.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <574411B5.2010407@gmx.at> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 24, 2016 at 10:32:53AM +0200, Manfred Schlaegl wrote: > On 2016-05-20 18:59, Dmitry Torokhov wrote: > > Hi Manfred, > > > > On Wed, May 18, 2016 at 05:16:49PM +0200, Manfred Schlaegl wrote: > >> @@ -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. -- Dmitry