netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] net: txgbe: use pci_dev_id() helper
@ 2024-08-26  1:21 Yu Liao
  2024-08-27 14:42 ` Simon Horman
  2024-08-27 21:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yu Liao @ 2024-08-26  1:21 UTC (permalink / raw)
  To: jiawenwu, mengyuanlou
  Cc: liaoyu15, liwei391, davem, edumazet, kuba, pabeni, netdev

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: Yu Liao <liaoyu15@huawei.com>
---
 drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
index 5f502265f0a6..67b61afdde96 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
@@ -688,8 +688,7 @@ static int txgbe_ext_phy_init(struct txgbe *txgbe)
 	mii_bus->parent = &pdev->dev;
 	mii_bus->phy_mask = GENMASK(31, 1);
 	mii_bus->priv = wx;
-	snprintf(mii_bus->id, MII_BUS_ID_SIZE, "txgbe-%x",
-		 (pdev->bus->number << 8) | pdev->devfn);
+	snprintf(mii_bus->id, MII_BUS_ID_SIZE, "txgbe-%x", pci_dev_id(pdev));
 
 	ret = devm_mdiobus_register(&pdev->dev, mii_bus);
 	if (ret) {
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] net: txgbe: use pci_dev_id() helper
  2024-08-26  1:21 [PATCH -next] net: txgbe: use pci_dev_id() helper Yu Liao
@ 2024-08-27 14:42 ` Simon Horman
  2024-08-27 21:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-08-27 14:42 UTC (permalink / raw)
  To: Yu Liao
  Cc: jiawenwu, mengyuanlou, liwei391, davem, edumazet, kuba, pabeni,
	netdev

On Mon, Aug 26, 2024 at 09:21:00AM +0800, Yu Liao 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: Yu Liao <liaoyu15@huawei.com>

Thanks Yu Liao,

I agree that pci_dev_id() was being open coded here.
And that it is nicer to use that helper.

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] net: txgbe: use pci_dev_id() helper
  2024-08-26  1:21 [PATCH -next] net: txgbe: use pci_dev_id() helper Yu Liao
  2024-08-27 14:42 ` Simon Horman
@ 2024-08-27 21:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-27 21:30 UTC (permalink / raw)
  To: Yu Liao
  Cc: jiawenwu, mengyuanlou, liwei391, davem, edumazet, kuba, pabeni,
	netdev

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 26 Aug 2024 09:21:00 +0800 you 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: Yu Liao <liaoyu15@huawei.com>
> ---
>  drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Here is the summary with links:
  - [-next] net: txgbe: use pci_dev_id() helper
    https://git.kernel.org/netdev/net-next/c/d76867efebcb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-27 21:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26  1:21 [PATCH -next] net: txgbe: use pci_dev_id() helper Yu Liao
2024-08-27 14:42 ` Simon Horman
2024-08-27 21:30 ` patchwork-bot+netdevbpf

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).