From patchwork Thu Mar 23 11:33:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2858051wrt; Thu, 23 Mar 2023 04:40:52 -0700 (PDT) X-Google-Smtp-Source: AK7set+ljCiGXWkgCov0stukt4kLDPyngT5eVKBZS4jcrGlyT5MDw3Jx1nr8Yo7dbGxIQ+6T7HrD X-Received: by 2002:a17:906:2a47:b0:8b1:347c:85c8 with SMTP id k7-20020a1709062a4700b008b1347c85c8mr9454848eje.17.1679571652744; Thu, 23 Mar 2023 04:40:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679571652; cv=none; d=google.com; s=arc-20160816; b=witIfGIJn8BsdGwXiALilrD5rX16wrulPth0A/RmxmukbRz40BO0+99AJ18fQX3rFs /goeC7aGMhIVOENrpZ5oHC1e7EN9ErPRDl2ZDPvMKUctxFFW7t41Skbrvigpa/iTwTYp RPHrSk+UDHqdmfIns5nblrRg64npuMhWEAMrJBy23YpZA/fplQxLBQULTM7Mg9mxJ/Bl 2fa3Yl1ECi0olFJ1WPelIhAgVBhBhXNjk5o83x8rfpDrOJDv6Xr16LnqO31yqIiQnZiA Y3ZFiUruz98GCGc8ERH+snAc/HKCYGN7gzVaPj5dFaEOMKRNU63U0+XOf4voq8pVIsyX yarg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=QapdO998ju5K1h6JiZaLNUdVyFQrk/GIUE/NUv0juwU=; b=oYywtuhSQoXh2rls3p4tJFZ2HmbefGm2GWAcHajzy0rarrfJeQ7qG4gbAVm43OOhff zOHmftaNtiI96c+UwDRXgRVP/qggE6GR6mAo4QTqAORa2O0FDCo+62UXNBoCXKIsqFND gUQfAVG2qugN8lgjqSMeiIP5giDQTEBceE7/+LWY25SJD3VvBGK9UN65Bk827u26LAX9 Ftkxm55qGhfGQsVHGmZ9ZsQryNYuBAnImesc+CHFTr1cPK5pyQfdSmIKpsggoSJldZav ufpD2Wdyez24NBIzJwoICGfq50MOJzMvUnorKUc6iHKPNJzRrLR9KGfRItJhALIruVuG pVaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=h1ZCc6s1; 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 d5-20020a1709064c4500b009310d4decd9si17148856ejw.313.2023.03.23.04.40.29; Thu, 23 Mar 2023 04:40:52 -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=h1ZCc6s1; 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 S231308AbjCWLd3 (ORCPT + 99 others); Thu, 23 Mar 2023 07:33:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230404AbjCWLd1 (ORCPT ); Thu, 23 Mar 2023 07:33:27 -0400 Received: from out-49.mta0.migadu.com (out-49.mta0.migadu.com [IPv6:2001:41d0:1004:224b::31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5A8B11E85 for ; Thu, 23 Mar 2023 04:33:25 -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=1679571203; 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; bh=QapdO998ju5K1h6JiZaLNUdVyFQrk/GIUE/NUv0juwU=; b=h1ZCc6s1nZLIVwSUcH9w4+hK6WrZLdx5mTbAlgOreyGNwfVuQg/PiOCwS8FDzUUph4U+md /8YlhihBWY6Wrz7qu13MfwHhurQxa0Efwa6x/UiDiSssbTlWJ/dOFlE1GY5ZmCgzsT/fPT BaRi9CvAMs+/oq6V7FgWRAvLB9LEgnk= 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 1/3] can: c_can: Remove redundant pci_clear_master Date: Thu, 23 Mar 2023 19:33:15 +0800 Message-Id: <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?1761158525207094405?= X-GMAIL-MSGID: =?utf-8?q?1761158525207094405?= 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/c_can/c_can_pci.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c index bf2f8c3da1c1..093bea597f4e 100644 --- a/drivers/net/can/c_can/c_can_pci.c +++ b/drivers/net/can/c_can/c_can_pci.c @@ -227,7 +227,6 @@ static int c_can_pci_probe(struct pci_dev *pdev, pci_iounmap(pdev, addr); out_release_regions: pci_disable_msi(pdev); - pci_clear_master(pdev); pci_release_regions(pdev); out_disable_device: pci_disable_device(pdev); @@ -247,7 +246,6 @@ static void c_can_pci_remove(struct pci_dev *pdev) pci_iounmap(pdev, addr); pci_disable_msi(pdev); - pci_clear_master(pdev); pci_release_regions(pdev); pci_disable_device(pdev); } 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); From patchwork Thu Mar 23 11:33:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2864139wrt; Thu, 23 Mar 2023 04:57:11 -0700 (PDT) Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ecVPWu74 X-Google-Smtp-Source: AK7set9Omg6GxqLOnnfm067aueTg+dQQBWK96TC0lvt4vzArMyn1JRYxdPPt8aaZx/CeJ2f3t1Sl X-Received: by 2002:a17:90b:1d10:b0:23f:582d:f45f with SMTP id on16-20020a17090b1d1000b0023f582df45fmr8038165pjb.1.1679572631074; Thu, 23 Mar 2023 04:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679572631; cv=none; d=google.com; s=arc-20160816; b=tmQlDifB4Ld0i8YcMcZCNInsY/Ci7Da7oFBCdKwrzUQyCXLsHlVv47jWUZn7x8o6h6 bKpZGMTF6MVOU9iQcFh8oTNqpU8hPmUgoEWwAvnzDny4uyDwV3yczVHAxswebCu3oavF J2Zuq1VpyqSP4KMMAZwsOcJPhGp223gaitbc7JwFv47eO61dFG11fJ2m3egOuQ6fc6it 9TJwBctfxFFBGSZu9tA2kQbPWfXJwNWrXdBoOzjGaEsOGU3TCGpGACnjhssD9WJRcqtX I9jrK0j4OKBLPWOXp1MXZwoyGs4JhcEXII8zj7WJTTTHIegQYJmpBcJC7/ABP3eYUOz7 O/Zw== 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=sPZcqQ6jZu5o2Ndux434TvzXwFz3PedsAkujCq96hR8=; b=DnNAZfEjcQrWS7HuXRGWybmfkGb4vKOQFwhkpJAQx1qVNTuhvmtz4xgQpXga6lZCA3 qinpsCx9W19BjmeYDBKBcIyIolMR4uoEOCtUTpg2rbkfkFFmqDeqK6n41aolQyrpTc+q QGbFixgX3clvEtKbZUSkWKeg01Kk6XcGiJIqZZ4dODqGWQyK8McBMXWoDzw1YUGysH0v jhP0xNzapBvbiQCyu2SP8O1GXDLq1Kz2BitaVMhm19fQigfCDjhfc7TRrRb2e0KVL2oH iQ1Nbc98BCkbSzDAibsqe8aJIM9vQYxaQpCGx7Eidq/2Q+U4CEShhUZhE4xD+cjIkyAn 2SKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ecVPWu74; 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 l12-20020a17090a408c00b0023f5ee62c13si1522531pjg.179.2023.03.23.04.56.58; Thu, 23 Mar 2023 04:57: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; dkim=pass header.i=@linux.dev header.s=key1 header.b=ecVPWu74; 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 S231416AbjCWLdq (ORCPT + 99 others); Thu, 23 Mar 2023 07:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231393AbjCWLdl (ORCPT ); Thu, 23 Mar 2023 07:33:41 -0400 Received: from out-22.mta1.migadu.com (out-22.mta1.migadu.com [IPv6:2001:41d0:203:375::16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63CE3303E6 for ; Thu, 23 Mar 2023 04:33:36 -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=1679571214; 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=sPZcqQ6jZu5o2Ndux434TvzXwFz3PedsAkujCq96hR8=; b=ecVPWu74WuL7+2PFUH7Yggg/nVH9pne8RIE1QVe5CJ+8Xq4ZFdLn1V0HqFE3lvuurDQtZj /9G2oowpgCtB9bnA1OZtIzXZ/mEtIi6N/0cFs0iop49hOy/BVtJe0XEfC2c1yomRzxucxt uUZZMapq1zx2JabFkDwGGQpqmfGYxL4= 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 3/3] can: kvaser_pciefd: Remove redundant pci_clear_master Date: Thu, 23 Mar 2023 19:33:17 +0800 Message-Id: <20230323113318.9473-3-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?1761159551533658287?= X-GMAIL-MSGID: =?utf-8?q?1761159551533658287?= 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/kvaser_pciefd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c index bcad11709bc9..53e8a914c88b 100644 --- a/drivers/net/can/kvaser_pciefd.c +++ b/drivers/net/can/kvaser_pciefd.c @@ -1907,7 +1907,6 @@ static void kvaser_pciefd_remove(struct pci_dev *pdev) free_irq(pcie->pci->irq, pcie); - pci_clear_master(pdev); pci_iounmap(pdev, pcie->reg_base); pci_release_regions(pdev); pci_disable_device(pdev);