From patchwork Fri Mar 24 01:32:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74295 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp81187wrt; Thu, 23 Mar 2023 18:36:02 -0700 (PDT) X-Google-Smtp-Source: AKy350aos4ySn6DmogEZND4L89e/pogFVTEcPIS6TYt/3Edm+2qoK+pmaM/UqWzN0Q2VV6vlI4hL X-Received: by 2002:a17:902:e889:b0:19a:a815:2858 with SMTP id w9-20020a170902e88900b0019aa8152858mr1191757plg.51.1679621762642; Thu, 23 Mar 2023 18:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679621762; cv=none; d=google.com; s=arc-20160816; b=0JM0RLKQpQLZB5tt8LskSqavDXfF5MwjidvxabV5cHj8IAl+SKOdL8sC/psLGw29j9 RHPNoZJgQs830YA/ZtvKaMCU3ho5r4lsIJb6F3oXq7KwtStJgzRJbHp10h+Aig0F0Nfi Gt7Vj3r6mmVQOrVFEENduOlCpq5m+IQSL0jb9sruL2/g8AdN19w66EgWgkL79F3y43DK 7fNGP3G/hzQBvOD5IznLND8ptZ89mIIJQmYswURU53RS5ONtFm8kBIuuNr+NtdLRJbxk eflfkSuuhHEexgsPO810Ndm85qjE6Xuq1CZ9Ria4kb6wdErcl0ueYJPX9+JE3uSjXPnw 0LTw== 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=W2nbe/qe97oAd0bkNVfAnRrtvuCJRlnabZEg2AKy4ms=; b=yUG6SGwVtEWSnuRuX9D4DopCJl+m7cskUX7PzvwrbeyNQfVivEBfiUJTaonGqrvrlJ OYecz4/fL3P/iiAFtZiyEiI76F5wFifkvTEnghPEz88sct3cz1hjn2KkdacaYzhr+B1p 2at4VfuDVQoXvpMWQIj2IGRMBxtOJGPyubKNzMZMo77XVjA3f4K2HnEWjbMQ27rkBVEI 9Y5gcA0ZjR9D/+Dm3W0X0NMYRN5sgZ1CBpv4SOTRueZDpaWfZMCwR3jss+rRXO5rguIQ cBkxGlPuZajuGZEpVDG13TLfTeKaQiiQDmGcgNyPaMt8pecQ703QHnxo/Fsk2YBY6Z8a bVkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ihN99A1F; 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 x24-20020a63db58000000b0050bfb509db2si19920665pgi.633.2023.03.23.18.35.48; Thu, 23 Mar 2023 18:36:02 -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=ihN99A1F; 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 S230098AbjCXBcg (ORCPT + 99 others); Thu, 23 Mar 2023 21:32:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjCXBce (ORCPT ); Thu, 23 Mar 2023 21:32:34 -0400 Received: from out-45.mta1.migadu.com (out-45.mta1.migadu.com [95.215.58.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E264340C0 for ; Thu, 23 Mar 2023 18:32:32 -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=1679621550; 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=W2nbe/qe97oAd0bkNVfAnRrtvuCJRlnabZEg2AKy4ms=; b=ihN99A1FVxcJ7h4amVIKFbjkcMh/XINOnSx09wZ80dEXEv//9JkdYcwVFzIvU2DTOVL2r1 GtlBvV5dgMSzkx5XdoEPG+MC8dM6jY5qFi8n+Y+8x7/agsDr5qYYCK86BiYQbxnR9VAsSK kMUiRDLq9EE1QY3m3mcCiksOhyW4lf4= 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 v2 1/3] ntb_hw_amd: Remove redundant pci_clear_master Date: Fri, 24 Mar 2023 09:32:18 +0800 Message-Id: <20230324013224.5963-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?1761211069573992793?= X-GMAIL-MSGID: =?utf-8?q?1761211069573992793?= 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 --- v1->v2: No change v1 link: https://lore.kernel.org/lkml/20230323115336.12986-1-cai.huoqing@linux.dev/ 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);