Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: Zheng Zengkai <zhengzengkai@huawei.com>, bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, wangxiongfeng2@huawei.com
Subject: Re: [PATCH -next] PCI/P2PDMA: Use pci_dev_id() to simplify the code
Date: Mon, 14 Aug 2023 10:09:19 -0600	[thread overview]
Message-ID: <135cf02e-9f27-96c3-1c68-2cfbb3a1261e@deltatee.com> (raw)
In-Reply-To: <20230811111057.31900-1-zhengzengkai@huawei.com>



On 2023-08-11 05:10, Zheng Zengkai 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 manually. Use pci_dev_id() to
> simplify the code a little bit.
> 
> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
> ---
>  drivers/pci/p2pdma.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
> index 6cd98ffca198..ec04d0ed157b 100644
> --- a/drivers/pci/p2pdma.c
> +++ b/drivers/pci/p2pdma.c
> @@ -532,8 +532,7 @@ static bool host_bridge_whitelist(struct pci_dev *a, struct pci_dev *b,
>  
>  static unsigned long map_types_idx(struct pci_dev *client)
>  {
> -	return (pci_domain_nr(client->bus) << 16) |
> -		(client->bus->number << 8) | client->devfn;
> +	return (pci_domain_nr(client->bus) << 16) | pci_dev_id(client);
>  }
>  
>  /*

Looks good to me, thanks!

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

Logan

      parent reply	other threads:[~2023-08-14 16:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11 11:10 [PATCH -next] PCI/P2PDMA: Use pci_dev_id() to simplify the code Zheng Zengkai
2023-08-11 16:46 ` Bjorn Helgaas
2023-08-14 16:09 ` Logan Gunthorpe [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=135cf02e-9f27-96c3-1c68-2cfbb3a1261e@deltatee.com \
    --to=logang@deltatee.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=wangxiongfeng2@huawei.com \
    --cc=zhengzengkai@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