From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91483ECAAD3 for ; Thu, 15 Sep 2022 11:29:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbiIOL3M (ORCPT ); Thu, 15 Sep 2022 07:29:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbiIOL3L (ORCPT ); Thu, 15 Sep 2022 07:29:11 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CFD27C1E7; Thu, 15 Sep 2022 04:29:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1663241350; x=1694777350; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=oOITtVIsEkwDAZ3B7W7N8G7w1xIevx2FVYsHBs5ESYU=; b=eTgW18T+dEaDE4dFg9JZbbb6oOpb4Z0CBsiRs1gpx4LO5z1YkOMShqUb EyOOBlvbITnO77gsG3hYcrkWgSsU2e5LOjRM+bLdnsIfQ6jft38s4scXO Qf7OdVmOdmxn2tcXiRLnnb1P/hWV/94fuHqkGNcl03+1P3K7yp7njsdEb KynHk2DzySfda2BdmjO5pAk+zKcf5m4oxb2Ae1Zan86h//GrR355PJXlc ARdMPbx+4UUGfzVzGuLq4kJf21qQKJ5TK4xlKxJu5yS0InrI6xaujP8vO VK54Zv4vwTHF7U4GO56m7iuxO7CkKAXsPq6fSj8MIFNLPn3ocDB4TvwCd A==; X-IronPort-AV: E=Sophos;i="5.93,317,1654585200"; d="scan'208";a="113816974" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Sep 2022 04:29:09 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Thu, 15 Sep 2022 04:29:09 -0700 Received: from localhost (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Thu, 15 Sep 2022 04:29:09 -0700 Date: Thu, 15 Sep 2022 13:33:33 +0200 From: Horatiu Vultur To: Andy Shevchenko CC: "open list:GPIO SUBSYSTEM" , "Linux Kernel Mailing List" , Linus Walleij , Microchip Linux Driver Support Subject: Re: [PATCH v3] pinctrl: ocelot: Fix interrupt controller Message-ID: <20220915113333.uwgazi6hoeskpeoi@soft-dev3-1.localhost> References: <20220909145942.844102-1-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The 09/09/2022 18:09, Andy Shevchenko wrote: > > On Fri, Sep 9, 2022 at 5:55 PM Horatiu Vultur > wrote: > > Thanks for an update, my comments below. Thanks for all the help and sorry for late reply. > > ... > > > - dev_set_drvdata(dev, info->map); > > + dev_set_drvdata(dev, info); > > I would also change it to platform_set_drvdata() to keep symmetry with > ->remove(). Yes, I will change this. > > ... > > > +static int ocelot_pinctrl_remove(struct platform_device *pdev) > > +{ > > + struct ocelot_pinctrl *info = platform_get_drvdata(pdev); > > > + destroy_workqueue(info->wq); > > Is it a synchronous operation? Anyway, what does guarantee that after > this no other task can schedule a new work due to unmasking an > interrupt? I think you need to be sure your device is quiescent before > killing that workqueue. Something like synchronize_irq() + > disable_irq() or equivalent? (I don't know for sure, you need to > investigate it yourself and find the best suitable way). I have look at descriptions of the functions (synchronize_irq(), disable_irq()) and I think is enough to use only disable_irq(). I also tried something but it didn't have the expected result so I would need to look more into this. I tried to use disable_irq on returned irq inside ocelot_gpiochip_register but I was still getting interrupts after that. Also I was thinking actually to use gpiochip_remove() here in ocelot_pinctrl_remove() before calling destroy_workqueue(). But then I might have problems inside ocelot_irq_work(). I need to check more this. > > > + return 0; > > +} > > -- > With Best Regards, > Andy Shevchenko -- /Horatiu