Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp614137rwd; Thu, 18 May 2023 01:12:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5zLfvWDwD5ujgnUftMnsP8pEUu1+RIb5H6XhhFqphnUTFGZhAViELc3ZZpt3MtUbIjXecH X-Received: by 2002:a05:6a00:841:b0:64d:1451:8233 with SMTP id q1-20020a056a00084100b0064d14518233mr2523785pfk.21.1684397531810; Thu, 18 May 2023 01:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684397531; cv=none; d=google.com; s=arc-20160816; b=1HdDQBTc0FLEhcyVuHt7L4jnTGZNqVMnFTQuwjW/H8qspAw8SP90W7+eBDuRoim4Fw QDg//p8lO8L7BHModNjR7IEMKL22oLyzbIEVhKbKlJ2EiV/iZ3L5pdwvPc2CjiNe53hN GKfRvgGoc7eb1vYVJkwMzOJGWezLFnztjJud9kO6ONKCzFC4fijZSJ1aC0N+E2tZ2K6o W0pHSuPQD9wxmcevvXFqKOCXJqhOzMX+5MPZlUgQHbF9PagLEXuak4D9JK3LmoQV+Xho QDhreL4pjQy+6xuECjf10aJXKM6TgOC4qcevyup7aIlBiMGftP3T5BhsYjSDK2DrP22q EbTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:content-disposition :content-transfer-encoding:mime-version:in-reply-to:references:cc :user-agent:date:subject:to:from; bh=Ut9j6irEOPC2du7jC17rTdSsSm/0aEPRjEMP0vk6CqU=; b=ZrrSWxGGkO6/U3lhKFkPZQQ7l3BwdelTjPNFVETkILbCA+VzFKvhaNm55qyHlGlVWg lLPfOhRvkip1D54iSm3Cvdh9nJFTUCKn0KE7L+U3SnMnkqztxHwvYdj7C9BnfswLWtos xLfbMOu9ZtK7mVNJPXxnRgKjTOIsY1qw7CcM1RH0fUITk4R1Iff7+Z1nsYVE6zTr3813 cYnunRSJxsXbDObq5vNnzCvtmJ2JQ7ghO4X01kWVx2l8NYKIEVH0tZlA3ExOWUqGj/uB qW7a9cGBtBv+4CIkXB59W+LR5iV4kaw3sNav7kZFxMEAEidlHjMVmgkIZ5xL1vvRI+mP V7RQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmp.felk.cvut.cz Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i125-20020a625483000000b0062e024b49b8si1061977pfb.150.2023.05.18.01.11.53; Thu, 18 May 2023 01:12:11 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmp.felk.cvut.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229919AbjERIKA (ORCPT + 99 others); Thu, 18 May 2023 04:10:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229905AbjERIJ6 (ORCPT ); Thu, 18 May 2023 04:09:58 -0400 X-Greylist: delayed 1198 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 18 May 2023 01:09:57 PDT Received: from mx-8.mail.web4u.cz (smtp7.web4u.cz [81.91.87.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 551A297; Thu, 18 May 2023 01:09:57 -0700 (PDT) Received: from mx-8.mail.web4u.cz (localhost [IPv6:::1]) by mx-8.mail.web4u.cz (Postfix) with ESMTP id 7630C1FF4E0; Thu, 18 May 2023 09:32:39 +0200 (CEST) Received: from baree.pikron.com (unknown [89.103.131.245]) (Authenticated sender: ppisa@pikron.com) by mx-8.mail.web4u.cz (Postfix) with ESMTPA id 2D4981FF4D8; Thu, 18 May 2023 09:32:39 +0200 (CEST) From: Pavel Pisa To: Christophe JAILLET Subject: Re: [PATCH] can: ctucanfd: Remove a useless netif_napi_del() call Date: Thu, 18 May 2023 09:32:38 +0200 User-Agent: KMail/1.9.10 Cc: Ondrej Ille , Wolfgang Grandegger , "Marc Kleine-Budde" , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-can@vger.kernel.org, netdev@vger.kernel.org References: <58500052a6740806e8af199ece45e97cb5eeb1b8.1684393811.git.christophe.jaillet@wanadoo.fr> In-Reply-To: <58500052a6740806e8af199ece45e97cb5eeb1b8.1684393811.git.christophe.jaillet@wanadoo.fr> X-KMail-QuotePrefix: > MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <202305180932.38815.pisa@cmp.felk.cvut.cz> X-W4U-Auth: 59c178831a6430d3fd87e564e9d84dd1bf4afcea X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Dear Christophe, On Thursday 18 of May 2023 09:10:39 Christophe JAILLET wrote: > free_candev() already calls netif_napi_del(), so there is no need to call > it explicitly. It is harmless, but useless. > > This makes the code mode consistent with the error handling path of > ctucan_probe_common(). OK, but I would suggest to consider to keep sequence in sync with linux/drivers/net/can/ctucanfd/ctucanfd_pci.c where is netif_napi_del() used as well while ((priv = list_first_entry_or_null(&bdata->ndev_list_head, struct ctucan_priv, peers_on_pdev)) != NULL) { ndev = priv->can.dev; unregister_candev(ndev); netif_napi_del(&priv->napi); list_del_init(&priv->peers_on_pdev); free_candev(ndev); } On the other hand, if interrupt can be called for device between unregister_candev() and free_candev() or some other callback which is prevented by netif_napi_del() now then I would consider to keep explicit netif_napi_del() to ensure that no callback is activated to driver there. And for PCI integration it is more critical because list_del_init(&priv->peers_on_pdev); appears in between and I would prefer that no interrupt appears when instance is not on the peers list anymore. Even that would not be a problem for actual CTU CAN FD implementation, peers are accessed only during physical device remove, but I have worked on other controllers in past, which required to coordinate with peers in interrupt handling... So I would be happy for some feedback what is actual guarantee when device is stopped. May it be that it would be even more robust to run removal with two loop where the first one calls unregister_candev() and netif_napi_del() and only the second one removes from peers and call free_candev()... But I am not sure there and it is not problem in actual driver because peers are not used in any other place... > While at it, remove a wrong comment about the return value of this > function. OK, this has been caused probably by prototype change. > Signed-off-by: Christophe JAILLET > --- > The comment went wrong after 45413bf75919 ("can: ctucanfd: Convert to > platform remove callback returning void") --- > drivers/net/can/ctucanfd/ctucanfd_platform.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/net/can/ctucanfd/ctucanfd_platform.c > b/drivers/net/can/ctucanfd/ctucanfd_platform.c index > 55bb10b157b4..8fe224b8dac0 100644 > --- a/drivers/net/can/ctucanfd/ctucanfd_platform.c > +++ b/drivers/net/can/ctucanfd/ctucanfd_platform.c > @@ -84,7 +84,6 @@ static int ctucan_platform_probe(struct platform_device > *pdev) * @pdev: Handle to the platform device structure > * > * This function frees all the resources allocated to the device. > - * Return: 0 always > */ > static void ctucan_platform_remove(struct platform_device *pdev) > { > @@ -95,7 +94,6 @@ static void ctucan_platform_remove(struct platform_device > *pdev) > > unregister_candev(ndev); > pm_runtime_disable(&pdev->dev); > - netif_napi_del(&priv->napi); > free_candev(ndev); > } Best wishes, Pavel Pisa phone: +420 603531357 e-mail: pisa@cmp.felk.cvut.cz Department of Control Engineering FEE CVUT Karlovo namesti 13, 121 35, Prague 2 university: http://control.fel.cvut.cz/ personal: http://cmp.felk.cvut.cz/~pisa projects: https://www.openhub.net/accounts/ppisa CAN related:http://canbus.pages.fel.cvut.cz/ RISC-V education: https://comparch.edu.cvut.cz/ Open Technologies Research Education and Exchange Services https://gitlab.fel.cvut.cz/otrees/org/-/wikis/home