From: Simon Horman <horms@kernel.org>
To: Jialin Zhang <zhangjialin11@huawei.com>
Cc: shayagr@amazon.com, akiyano@amazon.com, darinzon@amazon.com,
ndagan@amazon.com, saeedb@amazon.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
michal.kubiak@intel.com, yuancan@huawei.com,
netdev@vger.kernel.org, liwei391@huawei.com,
wangxiongfeng2@huawei.com
Subject: Re: [PATCH] net: ena: Use pci_dev_id() to simplify the code
Date: Tue, 15 Aug 2023 18:04:39 +0200 [thread overview]
Message-ID: <ZNuiF7D/fDRhPVoi@vergenet.net> (raw)
In-Reply-To: <20230815024248.3519068-1-zhangjialin11@huawei.com>
On Tue, Aug 15, 2023 at 10:42:48AM +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
nit: mannually -> manually
> simplify the code a little bit.
>
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
> ---
> drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> index d19593fae226..ad32ca81f7ef 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> @@ -3267,7 +3267,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev, struct pci_dev *pd
>
> host_info = ena_dev->host_attr.host_info;
>
> - host_info->bdf = (pdev->bus->number << 8) | pdev->devfn;
> + host_info->bdf = pci_dev_id(pdev);
> host_info->os_type = ENA_ADMIN_OS_LINUX;
> host_info->kernel_ver = LINUX_VERSION_CODE;
> strscpy(host_info->kernel_ver_str, utsname()->version,
> --
> 2.25.1
>
>
next prev parent reply other threads:[~2023-08-15 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 2:42 [PATCH] net: ena: Use pci_dev_id() to simplify the code Jialin Zhang
2023-08-15 7:23 ` Leon Romanovsky
2023-08-15 8:31 ` Shay Agroskin
2023-08-15 16:04 ` Simon Horman [this message]
2023-08-18 2:20 ` patchwork-bot+netdevbpf
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=ZNuiF7D/fDRhPVoi@vergenet.net \
--to=horms@kernel.org \
--cc=akiyano@amazon.com \
--cc=darinzon@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=liwei391@huawei.com \
--cc=michal.kubiak@intel.com \
--cc=ndagan@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedb@amazon.com \
--cc=shayagr@amazon.com \
--cc=wangxiongfeng2@huawei.com \
--cc=yuancan@huawei.com \
--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).