Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp2499317qtg; Thu, 23 Mar 2023 04:57:46 -0700 (PDT) X-Google-Smtp-Source: AK7set9sZgQzjnPiOy/frjEqM8Dqeb3OZe+tKRXA9brtvDrIJsqMjY0uwNC9Yr9VB0bIy2lFTNVo X-Received: by 2002:a62:4ec9:0:b0:625:cf6d:b260 with SMTP id c192-20020a624ec9000000b00625cf6db260mr6168998pfb.6.1679572666140; Thu, 23 Mar 2023 04:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679572666; cv=none; d=google.com; s=arc-20160816; b=nUs+buXGXF/m+z6T/LNhcJrjruOqt6txnqZTyFd58Ty5kADDg8aiYI2yVHVqnYpUDP 1rNSvhx/xTtWhGKXyD0rt+YQk9RLR4xQ8zUaP08/4ZsYMW/KWLD/bkMqYKSIQcRqa6Ky ul6MdLgV6iv9Vncvqj9veUlOClxSmxHQl99RROjLJQfXj889L1QHa41SOtxGtkgiWy2W UP0DYpczt2YQ3RqlXVcurNj4oHfrn6gG6a48qTjj7N59tAACP5pzKuRfpbdfx7xVOglp +oTgn6PQ25VT+dB9skfa3c0XL1Yd1/VrKVBfv1qE0V/3n7cTh+Ixhe45w6cn+E+TZU8u vcnQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a056a00190400b006261813566dsi18640125pfi.223.2023.03.23.04.57.34; Thu, 23 Mar 2023 04:57:46 -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 S231356AbjCWLx6 (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 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/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); -- 2.34.1