Message ID | 20240903072301.117767-1-zhangzekun11@huawei.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] net: txgbe: Simplify code with pci_dev_id() | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next |
netdev/apply | fail | Patch does not apply to net-next-0 |
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 <zhangzekun11@huawei.com> > --- > 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.
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) {
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 <zhangzekun11@huawei.com> --- drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)