From patchwork Thu Mar 23 11:33:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2863583wrt; Thu, 23 Mar 2023 04:55:48 -0700 (PDT) Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=oIZNjjNq X-Google-Smtp-Source: AK7set8q/Iy/jLHJx7Xh2EZcusE0xO99RcQbtmLaIhmjlpZcwCBwGKlYwhtMKe3N8ady6r/KYyrg X-Received: by 2002:a17:90b:4c04:b0:23b:4614:6f84 with SMTP id na4-20020a17090b4c0400b0023b46146f84mr7829107pjb.28.1679572548690; Thu, 23 Mar 2023 04:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679572548; cv=none; d=google.com; s=arc-20160816; b=INZUNCHKa/yk/Jw0zNNu5NYrvTW/d1/pxfkeYxIBbdqPy6tndeZUUgK5QhNW4ext0g Jh2HCisTl9Wi6JscV6IlHiz1qXjcLF103qDKagCai9CIpkGOGvjJATjvwgsRvMRzLSx5 l2QV5ND7Asvmi4xW3vramOYN3ssgecSRYfSz3YwHFAwLNWab6MJMC6rjoT+U0hgfLhiL CeVhS/ZkpFldEws6HXlNYwYHFMJqYGrezbiNelfO6kvg1tPg6DLAVWbhUO2zfRp+b2JT 8VwnOhCv06z0HmR7ZHyI9uJRt8dZ0eSE7WwUB4TQ1tYVCCqs2wNd4D2MWrtz6Mcj97k9 84Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LD+4wHknWReXY1ZN3HVGaa4vo8/47rX5RURrjIAJyfI=; b=c8hxW+CkzscMF+8bTMZ0KJFBjxnKDR7w8QOxqhTwGCTC/dXNBFOiyIxoJB9/krKPFQ eyidU+cS7dzYEyGhwFR6NJgB83p9y6rbwul6htTVF5SLZkPtVt021erNfN6NQHfuqh4A Lsdvt9tpW+KNemryvXWLWebVVOohz30XNz9QyeJzio8h9ELxXDqw9m2l/t9Ygqq/tmtA 4LEX5L5OrNVim8AJKT3cSazLgVtyzxzfWLutPyFcoM93FkpW88C84xnr/6ytrh3ohX9X UOhIk9tPcULjzdGbo9/VHy4QBZB0NfuywX2DdoO1J6tmRuaFIOm+GrSz5cGj9yFBMwyS X1jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=oIZNjjNq; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lt3-20020a17090b354300b00230c8e3ed4bsi1591314pjb.24.2023.03.23.04.55.36; Thu, 23 Mar 2023 04:55:48 -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=@linux.dev header.s=key1 header.b=oIZNjjNq; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231384AbjCWLde (ORCPT + 99 others); Thu, 23 Mar 2023 07:33:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231346AbjCWLdb (ORCPT ); Thu, 23 Mar 2023 07:33:31 -0400 Received: from out-49.mta1.migadu.com (out-49.mta1.migadu.com [IPv6:2001:41d0:203:375::31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1C391C318 for ; Thu, 23 Mar 2023 04:33:30 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1679571209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LD+4wHknWReXY1ZN3HVGaa4vo8/47rX5RURrjIAJyfI=; b=oIZNjjNqvUoureAd5J2qZ8+iUS+rSsgpWoQuJQ7q5AcNBthaZz8hvo+NrKVH4b5mV+A+D+ SYFXaEpsN1adwQiclxMMVRJ9GDyZOeb4GZnArN0DIs3WfPyIqtosG8YnSjp7poxfD0pklI Wm0ktkk4rCQjZNOlB13YypAJRyA3oKE= From: Cai Huoqing To: cai.huoqing@linux.dev Cc: Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Pavel Pisa , Ondrej Ille , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] can: ctucanfd: Remove redundant pci_clear_master Date: Thu, 23 Mar 2023 19:33:16 +0800 Message-Id: <20230323113318.9473-2-cai.huoqing@linux.dev> In-Reply-To: <20230323113318.9473-1-cai.huoqing@linux.dev> References: <20230323113318.9473-1-cai.huoqing@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TO_EQ_FM_DIRECT_MX autolearn=no 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761159464950483112?= X-GMAIL-MSGID: =?utf-8?q?1761159464950483112?= Remove pci_clear_master to simplify the code, the bus-mastering is also cleared in do_pci_disable_device, like this: ./drivers/pci/pci.c:2197 static void do_pci_disable_device(struct pci_dev *dev) { u16 pci_command; pci_read_config_word(dev, PCI_COMMAND, &pci_command); if (pci_command & PCI_COMMAND_MASTER) { pci_command &= ~PCI_COMMAND_MASTER; pci_write_config_word(dev, PCI_COMMAND, pci_command); } pcibios_disable_device(dev); }. And dev->is_busmaster is set to 0 in pci_disable_device. Signed-off-by: Cai Huoqing --- drivers/net/can/ctucanfd/ctucanfd_pci.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/can/ctucanfd/ctucanfd_pci.c b/drivers/net/can/ctucanfd/ctucanfd_pci.c index 8f2956a8ae43..9da09e7dd63a 100644 --- a/drivers/net/can/ctucanfd/ctucanfd_pci.c +++ b/drivers/net/can/ctucanfd/ctucanfd_pci.c @@ -206,10 +206,8 @@ static int ctucan_pci_probe(struct pci_dev *pdev, err_pci_iounmap_bar1: pci_iounmap(pdev, addr); err_release_regions: - if (msi_ok) { + if (msi_ok) pci_disable_msi(pdev); - pci_clear_master(pdev); - } pci_release_regions(pdev); err_disable_device: pci_disable_device(pdev); @@ -257,10 +255,8 @@ static void ctucan_pci_remove(struct pci_dev *pdev) pci_iounmap(pdev, bdata->bar1_base); - if (bdata->use_msi) { + if (bdata->use_msi) pci_disable_msi(pdev); - pci_clear_master(pdev); - } pci_release_regions(pdev); pci_disable_device(pdev);