linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Jialin Zhang <zhangjialin11@huawei.com>
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
Date: Tue, 15 Aug 2023 12:56:19 -0500	[thread overview]
Message-ID: <20230815175619.GA232335@bhelgaas> (raw)
In-Reply-To: <20230815022440.3513792-1-zhangjialin11@huawei.com>

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 <bhelgaas@google.com>

> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
> ---
>  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
> 

      reply	other threads:[~2023-08-15 17:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15  2:24 [PATCH] x86/PCI: Use pci_dev_id() to simplify the code Jialin Zhang
2023-08-15 17:56 ` Bjorn Helgaas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230815175619.GA232335@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wangxiongfeng2@huawei.com \
    --cc=x86@kernel.org \
    --cc=zhangjialin11@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).