Subject: Re: [PATCH net-next] net: txgbe: Simplify code with pci_dev_id()

From: Jakub Kicinski <[email-masked]>
Date: Wed, 4 Sep 2024 16:35:55 -0700

On Tue, 3 Sep 2024 15:23:01 +0800 Zhang Zekun wrote:
> Use pci_dev_id() to get the BDF number of a pci device, and we don't
> calculate it manually. This can simplify the code a bit.
> 
> Signed-off-by: Zhang Zekun <[email-masked]>
> ---
>  drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
> index 5f502265f0a6..e8e293b1dd61 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
> @@ -689,7 +689,7 @@ static int txgbe_ext_phy_init(struct txgbe *txgbe)
>  	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);
> +		 pci_dev_id(pdev));
>  
>  	ret = devm_mdiobus_register(&pdev->dev, mii_bus);
>  	if (ret) {

Already done and slightly more cleanly in d76867efebcb20752345
by who I presume is your coworker.