From patchwork Thu Mar 23 11:57:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2866367wrt; Thu, 23 Mar 2023 05:01:35 -0700 (PDT) X-Google-Smtp-Source: AK7set8rHGmRT/gLKH5nKIcXNs7FJUGGppBzwoeNZoxltrfC0/UA8qEArdo16bS0cxQOanCoZpD8 X-Received: by 2002:a17:90a:19d5:b0:23f:5273:1ae0 with SMTP id 21-20020a17090a19d500b0023f52731ae0mr7067985pjj.45.1679572895458; Thu, 23 Mar 2023 05:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679572895; cv=none; d=google.com; s=arc-20160816; b=maV7coWFvVpZMd57X8r/pTL2C6IXDTfc0IIuD7bHcNZmhN6D+BYivA5NTWfi/xiuIu HTC3ye5bvdivfMmygYIAI0DqRNJdaFQnbXZYnJQMOgohAte/chY95mVMDToy8zmgE1aS 5Jf6i4nUx0rqjzE78Jl3FTxXtBW4imLeye9Sx11rJt9hm+stqJEv5L2Z++Lu3n/U71zZ +QigqeSDcsxk7dX9jvgJpPWoOcxbqsrdAZVhwwfNRhSrFkyv/8laMPi7CzoC3KCuw6lm jplxbcg7HZYTB8wV8DMrlmY70X8DUBODvVtQRHfnbi5DddnqMpQa1hQd0Ns2uOlZyeVb I2WA== 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=wmqRaGyi3JH4o0KZA2eTUBxg4BRr4LpAbEfXiy8+oTI=; b=chM7IcAE2E0UcXXsiS/d5XS0C7S8Ug+WxLGGTvFRpW1n/bcmOuKJUKQDzw+P1WsEcG 9+a+6JegcIZ93RwNGDfbObRAqf/6WNdZIJZZ1X/HjriaH1y7xZTm1e3QHa3C+YHR++gd yl5rModzPxgbKb6WH3hjdmtlmX4R12nQzk7HmtKfw+2WQ28SgG3CM21+UYhx2S67reRe zzaqPX5N6ZPoV5nK4tgmsd3XgWqpPIHN+jOGTvrhGAmB5b5dE6yvp9Ad10vnEGEb61rG XAht8+fVm2/6IBX8xrF2+OClc9xNYDwLmvQkGXJE82fnScCqd0eevkGSlv9THZMN/7rl zd2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=bLmbke4O; 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 w11-20020a17090abc0b00b0022c17104488si1651168pjr.25.2023.03.23.05.01.21; Thu, 23 Mar 2023 05:01:35 -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=bLmbke4O; 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 S230416AbjCWL7R (ORCPT + 99 others); Thu, 23 Mar 2023 07:59:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231277AbjCWL6m (ORCPT ); Thu, 23 Mar 2023 07:58:42 -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 CED903433B for ; Thu, 23 Mar 2023 04:57:47 -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=1679572665; 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=wmqRaGyi3JH4o0KZA2eTUBxg4BRr4LpAbEfXiy8+oTI=; b=bLmbke4OQaFppFOXuIrOCuoDf88knLrRGc0uNO6Gr9n/JEeBCjXJKVR9HiAwHhLenM/qfr oFRHp+dMBOeBA9B8/YIO9kcmTgmHAple4WjNCVcCznI3+0WUI3i9TW4mF6GeeJaXFfXk7Y 3KPxIDusCMpmCW2Xn+N3tuwlF1ArqBA= From: Cai Huoqing To: cai.huoqing@linux.dev Cc: Christian Benvenuti , Nelson Escobar , Jason Gunthorpe , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] RDMA/usnic: Remove redundant pci_clear_master Date: Thu, 23 Mar 2023 19:57:42 +0800 Message-Id: <20230323115742.13836-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?1761159828231904331?= X-GMAIL-MSGID: =?utf-8?q?1761159828231904331?= 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/infiniband/hw/usnic/usnic_ib_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c index 46653ad56f5a..13b654ddd3cc 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c @@ -602,7 +602,6 @@ static int usnic_ib_pci_probe(struct pci_dev *pdev, usnic_vnic_free(vf->vnic); out_release_regions: pci_set_drvdata(pdev, NULL); - pci_clear_master(pdev); pci_release_regions(pdev); out_disable_device: pci_disable_device(pdev); @@ -623,7 +622,6 @@ static void usnic_ib_pci_remove(struct pci_dev *pdev) kref_put(&pf->vf_cnt, usnic_ib_undiscover_pf); usnic_vnic_free(vf->vnic); pci_set_drvdata(pdev, NULL); - pci_clear_master(pdev); pci_release_regions(pdev); pci_disable_device(pdev); kfree(vf);