From mboxrd@z Thu Jan 1 00:00:00 1970 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 0992DC0015E for ; Tue, 15 Aug 2023 17:57:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237655AbjHOR4r (ORCPT ); Tue, 15 Aug 2023 13:56:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239018AbjHOR4X (ORCPT ); Tue, 15 Aug 2023 13:56:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC122C1 for ; Tue, 15 Aug 2023 10:56:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5170064813 for ; Tue, 15 Aug 2023 17:56:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F7D9C433C8; Tue, 15 Aug 2023 17:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692122181; bh=utvsbPCDEn/v13ZQGZ6Zerunk7My2jCipKdwTA4ir3w=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Ss//IbLmAuMfbydXMwQwnneSTx6u1GhhHi312hceUpaGFP/imfGJbO0wL/Lp60bpH Z5ubx5j6RWpDVe150w3oTz+0oXcmMpdQr7SN8t8UJHapqaYK+RPtDs5QlU9VxBF9h0 4hUXl3NaE83H5YH+hEB+e/3zSzT57YnQiW7tnNtRsSsK97WT1CJKKu2Rrrw1V4wBvk mhRpCYsOe09lKGSLLln3qRhZ6dLePWKgWYDsCJYxu1+ymmggJBXw5AMJpQZnc6Z1va Tm/zlx+lmZ2IPNG7UIthogYckg0z9JnvtUXBt46czSoNnrEgXYnXYYSTNQ96dmPsfO BeCaTJhkGo68w== Date: Tue, 15 Aug 2023 12:56:19 -0500 From: Bjorn Helgaas To: Jialin Zhang Cc: bhelgaas@google.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, x86@kernel.org, linux-pci@vger.kernel.org, liwei391@huawei.com, wangxiongfeng2@huawei.com Subject: Re: [PATCH] x86/PCI: Use pci_dev_id() to simplify the code Message-ID: <20230815175619.GA232335@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230815022440.3513792-1-zhangjialin11@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Tue, Aug 15, 2023 at 10:24:40AM +0800, Jialin Zhang 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. Use pci_dev_id() to > simplify the code a little bit. s/for a pci/for a PCI/ s/mannually/manually/ Or you could use the commit log I tweaked for the similar drivers/pci patches: When we have a struct pci_dev *, use pci_dev_id() instead of manually composing the ID from dev->bus->number and dev->devfn. If you fix the typos or update the commit log: Acked-by: Bjorn Helgaas > Signed-off-by: Jialin Zhang > --- > arch/x86/pci/pcbios.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c > index 4f15280732ed..fc05ec31cabf 100644 > --- a/arch/x86/pci/pcbios.c > +++ b/arch/x86/pci/pcbios.c > @@ -412,7 +412,7 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq) > "1:" > : "=a" (ret) > : "0" (PCIBIOS_SET_PCI_HW_INT), > - "b" ((dev->bus->number << 8) | dev->devfn), > + "b" (pci_dev_id(dev)), > "c" ((irq << 8) | (pin + 10)), > "S" (&pci_indirect)); > return !(ret & 0xff00); > -- > 2.25.1 >