From patchwork Thu Mar 23 11:53:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74028 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2864797wrt; Thu, 23 Mar 2023 04:58:48 -0700 (PDT) Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TuLVwMlP X-Google-Smtp-Source: AKy350Y295tgTXtk9kK1rnrMvITqFSCy4uWaYdfjZ35SO1hi/5EdBoHA+J57xDYlgXptZaaJGnzO X-Received: by 2002:a17:90a:8b92:b0:240:883:8ff8 with SMTP id z18-20020a17090a8b9200b0024008838ff8mr6183838pjn.3.1679572728654; Thu, 23 Mar 2023 04:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679572728; cv=none; d=google.com; s=arc-20160816; b=TLSB39x6ya+rYKFoR1rjR+pjn0JjgZLYzkpohz9NxN8oC54+6uOAk/wawQ4wXXreHy rx7N8QIC9JUfCmSxqvbdISyFwGdRs9PyD2mugnBrI59Dk5BLLDQGWa67dgKZgtP5LvWb oOP/6AUZmPsT9WSWneznE2dY6t4ukMC0JmARXMZZ23QEG+YZVdda6ymB0lCxD0xGXifK LcHeTUVJwUoYwxJjnQX0wtRvUnDWLZGeaQFmOn0IZMHXzwlvSQ0o9H+EqP1EPtdxcJ09 6gt+au6saCkfptOPar4JJsfon/qm5mPjqCxpXs1m0q6kwKjY/8SN5+2zd5U6t0A6posr 92gw== 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=e28/Aphzssb7x3wtsuVlhO9EMFot1z8DPyozyjw+aCs=; b=V98yea8JPvJbWtO241JiRr8s1xUZeXKpeHudD5f/1K4xK5kiyvkJ2dPNYLQ2XN6uYi 9xZ/VJAmEn+spTNETsXuUuxUCQBY9NMiBsymtBhm6x5oXSTy5ldhQCsKVVL+/khtG/9E qxpD71nbeGMNeDyiKdY0h2Bv4zX0yhifh/5gr8fjhIducofz2NhqJPTnbfE53bg4MDvr gQFiU3kMtN+LhItk3ghGO2Ufhs4L89KFOE2q2YkTHWS01HfPcjDNbwOQPXspaNQemRmC lb93Ps6HI9Z6vimrj1b5mcfN+SrhW3GaL5pyMasW+vHToBo5/hgfP34RZYoR56vQxGPS vbgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TuLVwMlP; 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.58.36; Thu, 23 Mar 2023 04:58: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=TuLVwMlP; 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 S230010AbjCWLxw (ORCPT + 99 others); Thu, 23 Mar 2023 07:53:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230484AbjCWLxu (ORCPT ); Thu, 23 Mar 2023 07:53:50 -0400 Received: from out-18.mta1.migadu.com (out-18.mta1.migadu.com [IPv6:2001:41d0:203:375::12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84DFA35261 for ; Thu, 23 Mar 2023 04:53:43 -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=1679572421; 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=e28/Aphzssb7x3wtsuVlhO9EMFot1z8DPyozyjw+aCs=; b=TuLVwMlPfRTu/gRt3GON+vXtXxPXWLk3U7HM1L2Aw4Q7lzZJ2A/xGInpNXmkW4T3vHvMC4 2j5LSzHo2XPKRipGBtjKRFmWmD3GYH1+9XEOADOXkBBUxC8JfbxXvxbDAAviO686tyejSX 94ket3Yl5552HzttE+aQ4IG845aaR9k= From: Cai Huoqing To: cai.huoqing@linux.dev Cc: Sanjay R Mehta , Shyam Sundar S K , Jon Mason , Dave Jiang , Allen Hubbe , Frank Li , ntb@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] ntb_hw_amd: Remove redundant pci_clear_master Date: Thu, 23 Mar 2023 19:53:33 +0800 Message-Id: <20230323115336.12986-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?1761159653485676637?= X-GMAIL-MSGID: =?utf-8?q?1761159653485676637?= 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/ntb/hw/amd/ntb_hw_amd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c index 730f2103b91d..855ff65f64a5 100644 --- a/drivers/ntb/hw/amd/ntb_hw_amd.c +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c @@ -1194,7 +1194,6 @@ static int amd_ntb_init_pci(struct amd_ntb_dev *ndev, return 0; err_dma_mask: - pci_clear_master(pdev); pci_release_regions(pdev); err_pci_regions: pci_disable_device(pdev); @@ -1209,7 +1208,6 @@ static void amd_ntb_deinit_pci(struct amd_ntb_dev *ndev) pci_iounmap(pdev, ndev->self_mmio); - pci_clear_master(pdev); pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); From patchwork Thu Mar 23 11:53:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74030 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2864923wrt; Thu, 23 Mar 2023 04:59:10 -0700 (PDT) X-Google-Smtp-Source: AK7set+oWSE2+autZoU/o6ZLjg2P901dU9xWjIhoz7VhMuiD26D9rG+idecInTsKi6bJfCiyTLME X-Received: by 2002:a17:903:1112:b0:19c:be0c:738 with SMTP id n18-20020a170903111200b0019cbe0c0738mr6628801plh.59.1679572749955; Thu, 23 Mar 2023 04:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679572749; cv=none; d=google.com; s=arc-20160816; b=rWmmodYkX1tVEv0mIR2Ieruni67jvgNRlEiOIppFUp2M0zqAvT30JxttqlHBoD3+yA mrLCjWDvdazrpfmLRL1bcBOFK6dzhZzfX1nPZam3CXuNM18NI2PuM2b4rsB3crlq31r8 u5P71+41M4GCk+VmRqdypcryMuW1DeniY0VjeyAHUctgGArRsbs+aP3VL8zqxMTzDCXq BeopHAqyoHOMy6/Y22bZfBZ7qa2VYUnaROlJCNWYYRutWJ6YWfXBC31lV/Z0gvlLY8eh VJD9jdoX5Rf0Lz96zK2Nr+j0x7ZdQUmVtQ2xEc70XaU6SyWA9skQC5ut9I4ti3h9z1QA 7J/A== 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=PnSSHRcrR5kFgCbV0GetmQZQzrR6bOqKhnFTbrmqJ+c=; b=MSn9n7pYF4/TkVrZjrTf3XXOb6E+RMerjCOjIoQdDv50yhtiJ+Wa+MswFBnyCgdhWr JvOmw9UYfaAlk5aSBSUgd/Ygl8ckTJWW2gt8gogPhcKaEraBd+/pkGhOt0SABVE/es8a V4lKu40tPN5KcDIc/DZGnARo7AcZdEzMHV83xQHqdIfxOrBR3DafXpp4lQL07VkKOL9a blHVJUrOn+mYNgruk/3K/qiWB1fXlzEZqut2zFP02uchbdyQENWIkeBRjNgpcFShB/Wj z213ZPa8e0A1awNpvLHfEURdkD00UCn+oF/sus6K2kxbUzPjJCttH7erLW/PTGrcU7f0 4veA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="j+4X/N4e"; 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 e3-20020a170902b78300b001a203ea2b08si1607163pls.48.2023.03.23.04.58.58; Thu, 23 Mar 2023 04:59:09 -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="j+4X/N4e"; 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 S231452AbjCWLx6 (ORCPT + 99 others); Thu, 23 Mar 2023 07:53:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231276AbjCWLxx (ORCPT ); Thu, 23 Mar 2023 07:53:53 -0400 Received: from out-30.mta1.migadu.com (out-30.mta1.migadu.com [IPv6:2001:41d0:203:375::1e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D1C0303FF for ; Thu, 23 Mar 2023 04:53:48 -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=1679572426; 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=PnSSHRcrR5kFgCbV0GetmQZQzrR6bOqKhnFTbrmqJ+c=; b=j+4X/N4eLopB79ZdMGXuaOcK0ouHxUnTsHRW7JDtGWQVxZXIhAjI7mltW0RNM8gYxriLzF krNoei2HM8DSfaRzrcjVEm7Ctrhy3mZc2NE9trRoAPm3EkujNDCzPCw6RLV2riXVWaLV2B 8d3ooR+Nu+IcxQ5VT4B6YDqCuAnvJkQ= From: Cai Huoqing To: cai.huoqing@linux.dev Cc: Sanjay R Mehta , Shyam Sundar S K , Jon Mason , Dave Jiang , Allen Hubbe , Frank Li , ntb@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] ntb: epf: Remove redundant pci_clear_master Date: Thu, 23 Mar 2023 19:53:34 +0800 Message-Id: <20230323115336.12986-2-cai.huoqing@linux.dev> In-Reply-To: <20230323115336.12986-1-cai.huoqing@linux.dev> References: <20230323115336.12986-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?1761159675923266232?= X-GMAIL-MSGID: =?utf-8?q?1761159675923266232?= 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/ntb/hw/epf/ntb_hw_epf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c index 3ece49cb18ff..d80f205810a4 100644 --- a/drivers/ntb/hw/epf/ntb_hw_epf.c +++ b/drivers/ntb/hw/epf/ntb_hw_epf.c @@ -617,14 +617,11 @@ static int ntb_epf_init_pci(struct ntb_epf_dev *ndev, ndev->db_reg = pci_iomap(pdev, ndev->db_reg_bar, 0); if (!ndev->db_reg) { ret = -EIO; - goto err_dma_mask; + goto err_pci_regions; } return 0; -err_dma_mask: - pci_clear_master(pdev); - err_pci_regions: pci_disable_device(pdev); @@ -642,7 +639,6 @@ static void ntb_epf_deinit_pci(struct ntb_epf_dev *ndev) pci_iounmap(pdev, ndev->peer_spad_reg); pci_iounmap(pdev, ndev->db_reg); - pci_clear_master(pdev); pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); From patchwork Thu Mar 23 11:53:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74031 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2864999wrt; Thu, 23 Mar 2023 04:59:23 -0700 (PDT) X-Google-Smtp-Source: AK7set9+v4gQ1scKq8a8Y5DbECug3K2QFyD3png7Z04aQuhuBw6XQwnHV6rfiVK62KuLOdOGKJMq X-Received: by 2002:a05:6a00:338f:b0:627:f40a:fd35 with SMTP id cm15-20020a056a00338f00b00627f40afd35mr5372477pfb.10.1679572763359; Thu, 23 Mar 2023 04:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679572763; cv=none; d=google.com; s=arc-20160816; b=RBBDMloo0GrikMB1BKyR6OjMA323EjjxedbkNE7xZoG5EgoCfbI7ZoLrf0mbtRNGfl DOpKprK1UozozuapcQVTu7dBDNWUuMKKcWNJlwe5AQRYkZZz+/m1MFavoSL4g8sk7Gm1 nTohDLWByCyLgQTp3madQWQGJZWIh8g/l8FTIN6O9tBjUFwqae8TAqXYhOJ6amplNwoV YNqk9KRvglnd/Avx9F4iJfLAnBrogzB7Gxrn4aOEH4fGBl396YgbXsRngvrimTDCrJS/ UZClZBkJCGYePs9Ls0L2lYgG4XJe+A81zL6pnNOVM9UeAopcWWcKJDyc5IkTLp6eC4x6 jcwg== 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=P4FY3EEAjGMGaZUzTwyD8wRiA7SbipJR+ORYUAZzQpA=; b=AUFTWZ8W2bN5TyjmK8tMOQRMYuXuWPhSmN58p+0qveTJyt3oZSBjxxWOqerwB2L8MR NaP4ZHQlZlHtLvNSyadJy8Wdoyab7mLtuW8QJmvY2QUVcyfU/bI48EyLJMUN8J/fSeIS QL3bpqWxoHRj+49OkcpUIDN0gwrH333IFL8qHGKYzcUrZwmUHr7gKWJSzsbIzLrf6DSs HFtwVh9XRXhIkddXGudMwStzTSVYN+UIzW65lT1zWHvljAEvicVQMcCgGFfA/fcYnOhL YXxicOX28Jk2UUtNdMGB3Z1Iu2z4ZqJrKpKL4i4jHWbs1N+ZWriGFHbfv2pjPp9XYXpH vIjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=jm990LnV; 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 125-20020a630183000000b0050be5c0b5d6si18125020pgb.617.2023.03.23.04.58.50; Thu, 23 Mar 2023 04:59:23 -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=jm990LnV; 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 S231776AbjCWLyH (ORCPT + 99 others); Thu, 23 Mar 2023 07:54:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231508AbjCWLx7 (ORCPT ); Thu, 23 Mar 2023 07:53:59 -0400 Received: from out-39.mta0.migadu.com (out-39.mta0.migadu.com [IPv6:2001:41d0:1004:224b::27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89D9134C10 for ; Thu, 23 Mar 2023 04:53:53 -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=1679572431; 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=P4FY3EEAjGMGaZUzTwyD8wRiA7SbipJR+ORYUAZzQpA=; b=jm990LnVNAP4u+eLYixqUc+RFWiz/m/delvGMV7SYM09mn+kQAKNx9ZKhmPrfr4eHOq/kM 9TJyan3qKtRl5UP7+ESwgKwbnYRdGrlCTB+i07snUggXzSAh6qnV2dKC/tDhRuBJv/vcMG 4dVZRDnB3FHV3edpYV2OJnKIaCHXHpQ= From: Cai Huoqing To: cai.huoqing@linux.dev Cc: Sanjay R Mehta , Shyam Sundar S K , Jon Mason , Dave Jiang , Allen Hubbe , Frank Li , ntb@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] ntb: intel: Remove redundant pci_clear_master Date: Thu, 23 Mar 2023 19:53:35 +0800 Message-Id: <20230323115336.12986-3-cai.huoqing@linux.dev> In-Reply-To: <20230323115336.12986-1-cai.huoqing@linux.dev> References: <20230323115336.12986-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?1761159690195031752?= X-GMAIL-MSGID: =?utf-8?q?1761159690195031752?= 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 Acked-by: Dave Jiang --- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_hw_gen1.c index 60a4ebc7bf35..9ab836d0d4f1 100644 --- a/drivers/ntb/hw/intel/ntb_hw_gen1.c +++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c @@ -1791,7 +1791,6 @@ static int intel_ntb_init_pci(struct intel_ntb_dev *ndev, struct pci_dev *pdev) err_mmio: err_dma_mask: - pci_clear_master(pdev); pci_release_regions(pdev); err_pci_regions: pci_disable_device(pdev); @@ -1808,7 +1807,6 @@ static void intel_ntb_deinit_pci(struct intel_ntb_dev *ndev) pci_iounmap(pdev, ndev->peer_mmio); pci_iounmap(pdev, ndev->self_mmio); - pci_clear_master(pdev); pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL);