From patchwork Thu Mar 23 09:03:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 73917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2805176wrt; Thu, 23 Mar 2023 02:22:57 -0700 (PDT) X-Google-Smtp-Source: AK7set+6ufwod/WreVWGuB8kr7iTBuY/9MpqExn2C4cKi1i1GZ5ZhUfwECuqicpTUcEtKTVdwiyh X-Received: by 2002:a17:90b:2243:b0:237:b5d4:c0cc with SMTP id hk3-20020a17090b224300b00237b5d4c0ccmr7067200pjb.39.1679563377691; Thu, 23 Mar 2023 02:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679563377; cv=none; d=google.com; s=arc-20160816; b=iCM3nHs+2fwkuNu3U056Z74IY46XsNXKabMazcgUMPfldna0oAbnx9bbvKVTyb10y6 e1afj5T4mNGVxgSLOBw6qIeLxooWzBa2f5AOACdkeBk7prlU7RCIk3iLszTD1CuMRUfX FthDKZiwN6eJ86froTMbo+YWlMlF3sCj7YWirmRRv7Qy46OiJUHmaK72GUjtIf5PPHa5 iobwV1DjpMLsktrZVNnfEGkwoi5NS21lQNyL0pqr8lN1TXeNffsD6NoeGIcf9d5H3/n5 EsgnQglWrMqKDpjqbaD3j9QOBwXHXrSk5lFL01FCSDoIj7R671rIrk2HXey0PuwjI/7M bw7g== 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=NyEg017C1ywIX1wAn/q5NdZuOMZ8BdSt+EwBakRj+C0=; b=AlxlF22v81aiPe3exjdAXqv04B0Xqt+fFJV+aEKvQ3Oj8qA0wqKL/gLLpNzcJ7WGik 08iw6V8+C3KfDkmbsgCm30ISo7K7xel1wRy/GKtzN/FgWS2QMgCx3/0sCshTEVO0diUq 5FqGM84vk0aKoQVSq6+ulJrD3mH+asra+ldJ1fSH1qgck7nypWCPvZCt2Rq33KrpHLrD 1GfdDA3yaADD0yCle7OfpICg/BpinDXQDGM5srQHHFXnwLrs/jYuaiMBisTbEbzC+shd 647g1+3cCY0RXLex0eAdcU/OF2FKdZSPEqtWrd6iTTtxMOicc0OhyrRQdZVncI4AC1CE +Geg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=rL5is+VM; 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 e19-20020a63d953000000b00502e7159b0fsi18867867pgj.175.2023.03.23.02.22.45; Thu, 23 Mar 2023 02:22:57 -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=rL5is+VM; 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 S230261AbjCWJEt (ORCPT + 99 others); Thu, 23 Mar 2023 05:04:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231622AbjCWJEa (ORCPT ); Thu, 23 Mar 2023 05:04:30 -0400 Received: from out-36.mta1.migadu.com (out-36.mta1.migadu.com [95.215.58.36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1808B1B567 for ; Thu, 23 Mar 2023 02:04:18 -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=1679562257; 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=NyEg017C1ywIX1wAn/q5NdZuOMZ8BdSt+EwBakRj+C0=; b=rL5is+VMlk/R/98gOQvo9hI/r3EWFTkJzCppl65GYIBeu3seWtEy3bFQ9T0ybZpf+HAloY ySfUBZFZ1dYGWavwB3uOqjfUAT6cVbIpUJR6bF90M7f6aT6tD8DECh3ltE0fPxI8wki0AH hQgilZvJ6OCwmyHPHogcL4Nqv+5b90g= 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, Bjorn Helgaas , Jesse Brandeburg , 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 5/8] net/mlx5: Remove redundant pci_clear_master Date: Thu, 23 Mar 2023 17:03:04 +0800 Message-Id: <20230323090314.22431-5-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?1761149848316229992?= X-GMAIL-MSGID: =?utf-8?q?1761149848316229992?= 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/mellanox/mlx5/core/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index d39c3476b6d1..597174ceadc9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -918,7 +918,6 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct pci_dev *pdev, return 0; err_clr_master: - pci_clear_master(dev->pdev); release_bar(dev->pdev); err_disable: mlx5_pci_disable_device(dev); @@ -933,7 +932,6 @@ static void mlx5_pci_close(struct mlx5_core_dev *dev) */ mlx5_drain_health_wq(dev); iounmap(dev->iseg); - pci_clear_master(dev->pdev); release_bar(dev->pdev); mlx5_pci_disable_device(dev); }