Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp2499237qtg; Thu, 23 Mar 2023 04:57:34 -0700 (PDT) Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TuLVwMlP X-Google-Smtp-Source: AK7set8GUBQWNhbFCNgr2pBorDFSpSzF3kf610bUMcX01FcxK4O6VndlVJ/4Hgbw0atQpaegISgx X-Received: by 2002:a17:90b:4b43:b0:23d:1b82:7236 with SMTP id mi3-20020a17090b4b4300b0023d1b827236mr8062070pjb.16.1679572654365; Thu, 23 Mar 2023 04:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679572654; cv=none; d=google.com; s=arc-20160816; b=qnymFC+IvpDzl5PoYuk8Cf0pi7SN+3aZxoqy4ZblEAzCv1eBsg1EZ5wlsU8BNA1eN9 3ZrrDctCaj4af6Iq+rqVxXAWk/iL0ruckdJNOCmtpyJ0wAe2CxCcF1fw3r7Nm4El4BPR vXIRKVASYZ1JqgqumIiwr88i7fkfxvjQZ3/KUnOahU3dX9TdeVcrSIZgUMWxY7sakXV5 eoy9VZQDpXg9a/bENbGJWFNMtWgTPXd6LsP4USTKIJIpsVOfjRbieUixxGSaHVRlz/7b 0YLo2p3pg9vMXq+CJoIkKXHnfLCjZSZKIK97bJTAdcl92JGU1roF/oFzG2lNd9KJSNUP zAKw== 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 Return-Path: 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.57.22; Thu, 23 Mar 2023 04:57:34 -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 S231312AbjCWLxw (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 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: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.34.1