Message ID | 20230323115336.12986-3-cai.huoqing@linux.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;ezelljr.billy@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <cai.huoqing@linux.dev> To: cai.huoqing@linux.dev Cc: Sanjay R Mehta <sanju.mehta@amd.com>, Shyam Sundar S K <Shyam-sundar.S-k@amd.com>, Jon Mason <jdmason@kudzu.us>, Dave Jiang <dave.jiang@intel.com>, Allen Hubbe <allenbh@gmail.com>, Frank Li <Frank.Li@nxp.com>, 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 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> 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?= |
Series |
[1/3] ntb_hw_amd: Remove redundant pci_clear_master
|
|
Commit Message
Cai Huoqing
March 23, 2023, 11:53 a.m. UTC
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 <cai.huoqing@linux.dev>
---
drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 --
1 file changed, 2 deletions(-)
Comments
On 3/23/23 4:53 AM, Cai Huoqing wrote: > 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 <cai.huoqing@linux.dev> Acked-by: Dave Jiang <dave.jiang@intel.com> > --- > 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);
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);