[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230811110702.31019-5-zhengzengkai@huawei.com>
Date: Fri, 11 Aug 2023 19:07:01 +0800
From: Zheng Zengkai <zhengzengkai@...wei.com>
To: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <mark.einon@...il.com>, <siva.kallam@...adcom.com>,
<prashant@...adcom.com>, <mchan@...adcom.com>,
<steve.glendinning@...well.net>, <mw@...ihalf.com>,
<jiawenwu@...stnetic.com>, <mengyuanlou@...-swift.com>
CC: <netdev@...r.kernel.org>, <wangxiongfeng2@...wei.com>,
<zhengzengkai@...wei.com>
Subject: [PATCH net-next 4/5] net: tc35815: Use pci_dev_id() to simplify the code
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@...wei.com>
---
drivers/net/ethernet/toshiba/tc35815.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c
index b50be67b398b..14cf6ecf6d0d 100644
--- a/drivers/net/ethernet/toshiba/tc35815.c
+++ b/drivers/net/ethernet/toshiba/tc35815.c
@@ -667,8 +667,7 @@ static int tc_mii_init(struct net_device *dev)
lp->mii_bus->name = "tc35815_mii_bus";
lp->mii_bus->read = tc_mdio_read;
lp->mii_bus->write = tc_mdio_write;
- snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "%x",
- (lp->pci_dev->bus->number << 8) | lp->pci_dev->devfn);
+ snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "%x", pci_dev_id(lp->pci_dev));
lp->mii_bus->priv = dev;
lp->mii_bus->parent = &lp->pci_dev->dev;
err = mdiobus_register(lp->mii_bus);
--
2.20.1
Powered by blists - more mailing lists