Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp655296rwn; Thu, 15 Sep 2022 04:43:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR7k7VZ7a6JXxkXs03jiZ+gZGTZbuOrr3dMmV8xpg7dGjxSsdhvuIp45g7vQpNt3TdtyzUKY X-Received: by 2002:a05:6402:b6c:b0:44e:2faf:1ba4 with SMTP id cb12-20020a0564020b6c00b0044e2faf1ba4mr34729689edb.191.1663242216877; Thu, 15 Sep 2022 04:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663242216; cv=none; d=google.com; s=arc-20160816; b=Y4+bAo9YTzALcaMVXW66hpPNeqsLC/kSPqjb7iLXZUMVXU7kRKWqpTHDApzq/Ch2Rp vbdPpo1DXXM0M5SDn5D5Lo4VRqSX1YAAK0hRI+tLPOCjm7LFYGQTWQ96ewtpecFnUTbY JCcXQ0A/g0QTftHPl71uIvPN6AfflfdHI+mNKPr7Oh52py87HR6Bu2yCbNLgGGhSuuBC ng1ZCqGvLOCkf33d1lQ1Ndi6rm0UXLcX8b+7nUsaq4s099cHZS2+majxb3gUQbXeRjqd yfNPfxiMmikAGtnX8hDclKxs2uOhhtea4vxdBuqKmQvEj/jJpk8Nx3dHhHQ9PssNdHye F2Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IwndMXwm7OIilmUqq8e20Hs1XANPciYLgqb4hlIXkLI=; b=u3lx1Ne+GLYsE0DKmbtDLey7q/tlV3sftElPiXygaQWYkX3bW/hxMK049BQplENeE1 pI4+I/LHXzJuPuO8it384t1basJ2EsgTadKYkc1HBgAgbkQZiz10bKmynd1hb+WWWFLa 9iREwQAqJsNpdkHHeiyqYayiBOgg5j6kAfeiHFag5H0EmXRLaPr2STvNfJ2eqiVLeQmK 83g3l2YK4G8TKy5qtrMZaBRKkTLoR0zloETyJ+ZOtksA8+cvbMaz1EtiQoZuXCs4ASB7 TOe1KGL9vT/51zjj1y5DOVWETO52cFhAoODySm/I2wCd9T7INKrCeIp6YQnRfNhUzFlI LaQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=eTgW18T+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fc5-20020a1709073a4500b0073dc770cdc9si11383767ejc.756.2022.09.15.04.43.11; Thu, 15 Sep 2022 04:43:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=eTgW18T+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbiIOL3N (ORCPT + 99 others); Thu, 15 Sep 2022 07:29:13 -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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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