From nobody Sat Feb 7 07:25:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E594C001B0 for ; Tue, 8 Aug 2023 02:56:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229983AbjHHC4a (ORCPT ); Mon, 7 Aug 2023 22:56:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbjHHC42 (ORCPT ); Mon, 7 Aug 2023 22:56:28 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D9AFE62 for ; Mon, 7 Aug 2023 19:56:27 -0700 (PDT) Received: from dggpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RKd613DH3zNmdB; Tue, 8 Aug 2023 10:52:57 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 8 Aug 2023 10:56:25 +0800 From: Xiongfeng Wang To: , , CC: , , Subject: [PATCH] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the code Date: Tue, 8 Aug 2023 11:08:35 +0800 Message-ID: <20230808030835.167538-1-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Yang Yingliang 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_blo= ck *nb, unsigned long actio if (!root_port) return 0; =20 - port_devid =3D PCI_DEVID(root_port->bus->number, root_port->devfn); + port_devid =3D pci_dev_id(root_port); if (port_devid < hisi_ptt->lower_bdf || port_devid > hisi_ptt->upper_bdf) return 0; =20 info.is_port =3D pci_pcie_type(pdev) =3D=3D PCI_EXP_TYPE_ROOT_PORT; - info.devid =3D PCI_DEVID(pdev->bus->number, pdev->devfn); + info.devid =3D pci_dev_id(pdev); =20 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; =20 - port_devid =3D PCI_DEVID(root_port->bus->number, root_port->devfn); + port_devid =3D 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 =3D hisi_ptt_alloc_add_filter(hisi_ptt, PCI_DEVID(pdev->bus->numbe= r, pdev->devfn), + filter =3D hisi_ptt_alloc_add_filter(hisi_ptt, pci_dev_id(pdev), pci_pcie_type(pdev) =3D=3D PCI_EXP_TYPE_ROOT_PORT); if (!filter) return -ENOMEM; --=20 2.20.1