Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp2999rdb; Mon, 14 Aug 2023 07:58:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJEe3WveyqUoyv+B0yq9vClaCw3J/pmerJGWEJUs7zvWocHyUZRzA28Q0sLp6k09BIzTxS X-Received: by 2002:a05:6a21:6d8a:b0:135:66d9:a52f with SMTP id wl10-20020a056a216d8a00b0013566d9a52fmr16643234pzb.7.1692025126464; Mon, 14 Aug 2023 07:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692025126; cv=none; d=google.com; s=arc-20160816; b=En2ZDYT6H2l2kGZd/zNl8z4sB1sUQ11SJJISWhpnwIJzTMUTCTECde81YweDihmbXd j6KAjZXV4hjP+wRfoe5JDvtKXbGsSp7D2VcfXUhd4M/Sr0TcoWEDKTVJ5tgflNKzz1n+ 65lHYLcTvIshwAyDZuAp33l79M9ShlCTM72QUiG3H+mHX2Up2SQEgtaXHsxrXhG6B9Cc C1N1a0ErNb3XYWn1rFDbpw9G888iJWXp0qxBS2TbTM9X4Y9JPppj0Qbvsd39009Zw7An GobgKmYnNbhRCSTRpVxfNFqhg9RVqI//FZpYdfRDWJq3ewhLYWEhTlkrg+msE1FbPl42 P9zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject :cc; bh=SeBTq9EUiv7Gx5/jHxhPIf5hPX7gXZO9s62yFW2RwY0=; fh=9Q3OJeh7l7rRKJsbGH6luL1wen4WvqDVX8/W8AtglIw=; b=KlcVXKzT7w/COMDCZzzbXgg7zBV4+vgp+/NWyIxVubfx0CGVJ7r/nNK1Ylg5tTEtNe 6XV50/Itr9PQ0rrbVRFtNw+Tb919/sWNg7AxgKOVALP6JNsN3tXXkWdJCy25YgWFQexZ Sq6/BT8ddAtpgi+zF9n98m//AGpd91dpXjr8GsVz1gPKI3oZ5Z8lNgjhq4ovLt3euMB1 iDRJ80FDusvafCb41KYu0AtHv1I0We+N4lAxripRGvwZqrIbMGJ8TE2dTvcmAv3a/NWW T1yRZxuIjqAmQOaI7oRf3tMmp9yOdlGjJnBOEcmnPdUtgTvHUs0x10HeFZ/FXIE8L1Vs XLnw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r3-20020a63fc43000000b00564f48726f1si8117573pgk.529.2023.08.14.07.58.34; Mon, 14 Aug 2023 07:58: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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230072AbjHNO2j (ORCPT + 99 others); Mon, 14 Aug 2023 10:28:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232490AbjHNO2c (ORCPT ); Mon, 14 Aug 2023 10:28:32 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7B5319A4 for ; Mon, 14 Aug 2023 07:28:07 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RPcBw6f3szTmM5; Mon, 14 Aug 2023 22:26:00 +0800 (CST) Received: from [10.67.102.169] (10.67.102.169) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 14 Aug 2023 22:28:03 +0800 CC: "suzuki.poulose@arm.com" , Mathieu Poirier , , , , Subject: Re: [PATCH] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the code To: Xiongfeng Wang , References: <20230808030835.167538-1-wangxiongfeng2@huawei.com> From: Yicong Yang Message-ID: <1a155116-9476-88f9-75e4-405570cd70e0@huawei.com> Date: Mon, 14 Aug 2023 22:28:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20230808030835.167538-1-wangxiongfeng2@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.102.169] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On 2023/8/8 11:08, Xiongfeng Wang wrote: > PCI core API pci_dev_id() can be used to get the BDF number for a pci > device. We don't need to compose it mannually using PCI_DEVID(). Use > pci_dev_id() to simplify the code a little bit. > > Signed-off-by: Xiongfeng Wang Reviewed-by: Yicong Yang > --- > drivers/hwtracing/ptt/hisi_ptt.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c > index ba081b6d2435..49ea1b0f7489 100644 > --- a/drivers/hwtracing/ptt/hisi_ptt.c > +++ b/drivers/hwtracing/ptt/hisi_ptt.c > @@ -618,13 +618,13 @@ static int hisi_ptt_notifier_call(struct notifier_block *nb, unsigned long actio > if (!root_port) > return 0; > > - port_devid = PCI_DEVID(root_port->bus->number, root_port->devfn); > + port_devid = pci_dev_id(root_port); > if (port_devid < hisi_ptt->lower_bdf || > port_devid > hisi_ptt->upper_bdf) > return 0; > > info.is_port = pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT; > - info.devid = PCI_DEVID(pdev->bus->number, pdev->devfn); > + info.devid = pci_dev_id(pdev); > > switch (action) { > case BUS_NOTIFY_ADD_DEVICE: > @@ -664,7 +664,7 @@ static int hisi_ptt_init_filters(struct pci_dev *pdev, void *data) > if (!root_port) > return 0; > > - port_devid = PCI_DEVID(root_port->bus->number, root_port->devfn); > + port_devid = pci_dev_id(root_port); > if (port_devid < hisi_ptt->lower_bdf || > port_devid > hisi_ptt->upper_bdf) > return 0; > @@ -674,7 +674,7 @@ static int hisi_ptt_init_filters(struct pci_dev *pdev, void *data) > * should be partial initialized and users would know which filter fails > * through the log. Other functions of PTT device are still available. > */ > - filter = hisi_ptt_alloc_add_filter(hisi_ptt, PCI_DEVID(pdev->bus->number, pdev->devfn), > + filter = hisi_ptt_alloc_add_filter(hisi_ptt, pci_dev_id(pdev), > pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT); > if (!filter) > return -ENOMEM; >