From patchwork Thu Mar 23 09:03:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 73911 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2801188wrt; Thu, 23 Mar 2023 02:11:39 -0700 (PDT) X-Google-Smtp-Source: AK7set+Omv3ELmjXL6gZtgpe/oQ7kdUoFDkjYL6K9NJEhpyWeBahRPkPBA1Pa1jb3NlhVB5kgpHB X-Received: by 2002:a05:6a20:baa3:b0:db:8893:96ad with SMTP id fb35-20020a056a20baa300b000db889396admr2295852pzb.23.1679562698699; Thu, 23 Mar 2023 02:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679562698; cv=none; d=google.com; s=arc-20160816; b=y2VcoQ+MHdNi6OuRURFg0vdbOeevC0SYPBoQZUxTz05cKqS1bNIfhjbSi6hU7ZWlkB Az3cbKFh2/SR0zU8RO6DW3SJJNhljzGO6Z2czKAID0jvQOFDGthAwNOTcVuOe5hSb/t3 546NKDMlJNUFOMPje/VTA4oSQ9aMdZ2fVsN6MywRVJncoE5+4CIzJhVGSbCCLq/nBb5L a+EOuSo/UrOHQAuR5VLeR0tMglY6gPlNlN/ArQd+YK/dxuiTf7NpFJypQlBxOsa3ENxD f53Ubjbe0nY2KUTtH5xMoyj/lGjG1G0ZWyTnym7uqK5OwbA0HszJKdpn350C76jYMYFc rH6A== 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=IiRXdKppa9IBGp5kQGEXwtKfuR/2bgkSL+hNdkioQqs=; b=MlCLzGI5gXl02mcqwDCKJ7azLqkAfC0N4IFo4ze+np3hKMqRAMULJmAF9K0AbDp1t6 xdDnxl1GzbXh4msZafoVgLHMbTq64ZIy+QRX7K0fpMQySTfLWUHzR6LNLPnOQcxJyr3X /g/sRdRtcgOlIusESP5YHdLtd8YRcEMWLFhCge7RRSKk5KOLoDnwTpbIac+VjG4llWTh /eVTPACoxI+JR3ie0FAxNGSF4HH+vOMx+HpLc9cHkV26q/Unb38+4g6Opf9YhfmDzm+E +KoFvTKPKEq5tC9bxfz8M8wLH9Xb/e6iFbJpe57udHyfN4nblZCExGjW+/z3RkOffT2c dntQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="MUeYVTo/"; 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 a15-20020a056a000c8f00b00625c6092a12si19188945pfv.215.2023.03.23.02.11.23; Thu, 23 Mar 2023 02:11:38 -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="MUeYVTo/"; 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 S231381AbjCWJDu (ORCPT + 99 others); Thu, 23 Mar 2023 05:03:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231462AbjCWJDs (ORCPT ); Thu, 23 Mar 2023 05:03:48 -0400 Received: from out-9.mta1.migadu.com (out-9.mta1.migadu.com [95.215.58.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B999E1ABF6 for ; Thu, 23 Mar 2023 02:03:44 -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=1679562222; 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=IiRXdKppa9IBGp5kQGEXwtKfuR/2bgkSL+hNdkioQqs=; b=MUeYVTo/T72JuuTmN+VG/0fI78l9KiugDmSXdYzstalg0UCpuRmQnt59kKJLrc/m1EJMnw DzrmAnc9d9SFr3AI5gwjvc7RzfmXkLSjSFlIsjj6iY7Re6eVWnhRYDOI+YFMVHYQtPQUGe Wmizm0ZHpB7aJqHToDYspG/y2xBvCIc= From: Cai Huoqing To: cai.huoqing@linux.dev Cc: Derek Chickles , Satanand Burla , Felix Manlunas , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Raju Rangoju , Dariusz Marcinkiewicz , Dimitris Michailidis , Yisen Zhuang , Salil Mehta , Saeed Mahameed , Leon Romanovsky , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Shannon Nelson , Brett Creeley , drivers@pensando.io, Jesse Brandeburg , Bjorn Helgaas , Guangbin Huang , Jian Shen , Hao Lan , Jie Wang , Long Li , Jiri Pirko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [PATCH 2/8] net: hisilicon: Remove redundant pci_clear_master Date: Thu, 23 Mar 2023 17:03:01 +0800 Message-Id: <20230323090314.22431-2-cai.huoqing@linux.dev> In-Reply-To: <20230323090314.22431-1-cai.huoqing@linux.dev> References: <20230323090314.22431-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?1761149136051939064?= X-GMAIL-MSGID: =?utf-8?q?1761149136051939064?= 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/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 ++----- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 07ad5f35219e..c3851a6e10c0 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -11365,7 +11365,7 @@ static int hclge_pci_init(struct hclge_dev *hdev) if (!hw->hw.io_base) { dev_err(&pdev->dev, "Can't map configuration register space\n"); ret = -ENOMEM; - goto err_clr_master; + goto err_release_regions; } ret = hclge_dev_mem_map(hdev); @@ -11378,8 +11378,7 @@ static int hclge_pci_init(struct hclge_dev *hdev) err_unmap_io_base: pcim_iounmap(pdev, hdev->hw.hw.io_base); -err_clr_master: - pci_clear_master(pdev); +err_release_regions: pci_release_regions(pdev); err_disable_device: pci_disable_device(pdev); @@ -11396,7 +11395,6 @@ static void hclge_pci_uninit(struct hclge_dev *hdev) pcim_iounmap(pdev, hdev->hw.hw.io_base); pci_free_irq_vectors(pdev); - pci_clear_master(pdev); pci_release_mem_regions(pdev); pci_disable_device(pdev); } @@ -11743,7 +11741,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) hclge_devlink_uninit(hdev); err_pci_uninit: pcim_iounmap(pdev, hdev->hw.hw.io_base); - pci_clear_master(pdev); pci_release_regions(pdev); pci_disable_device(pdev); out: diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index e84e5be8e59e..f24046250341 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -2598,7 +2598,7 @@ static int hclgevf_pci_init(struct hclgevf_dev *hdev) if (!hw->hw.io_base) { dev_err(&pdev->dev, "can't map configuration register space\n"); ret = -ENOMEM; - goto err_clr_master; + goto err_release_regions; } ret = hclgevf_dev_mem_map(hdev); @@ -2609,8 +2609,7 @@ static int hclgevf_pci_init(struct hclgevf_dev *hdev) err_unmap_io_base: pci_iounmap(pdev, hdev->hw.hw.io_base); -err_clr_master: - pci_clear_master(pdev); +err_release_regions: pci_release_regions(pdev); err_disable_device: pci_disable_device(pdev); @@ -2626,7 +2625,6 @@ static void hclgevf_pci_uninit(struct hclgevf_dev *hdev) devm_iounmap(&pdev->dev, hdev->hw.hw.mem_base); pci_iounmap(pdev, hdev->hw.hw.io_base); - pci_clear_master(pdev); pci_release_regions(pdev); pci_disable_device(pdev); }