[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230811110702.31019-4-zhengzengkai@huawei.com>
Date: Fri, 11 Aug 2023 19:07:00 +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 3/5] net: smsc: 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/smsc/smsc9420.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c
index 71fbb358bb7d..350becc0c6ec 100644
--- a/drivers/net/ethernet/smsc/smsc9420.c
+++ b/drivers/net/ethernet/smsc/smsc9420.c
@@ -1144,8 +1144,7 @@ static int smsc9420_mii_init(struct net_device *dev)
goto err_out_1;
}
pd->mii_bus->name = DRV_MDIONAME;
- snprintf(pd->mii_bus->id, MII_BUS_ID_SIZE, "%x",
- (pd->pdev->bus->number << 8) | pd->pdev->devfn);
+ snprintf(pd->mii_bus->id, MII_BUS_ID_SIZE, "%x", pci_dev_id(pd->pdev));
pd->mii_bus->priv = pd;
pd->mii_bus->read = smsc9420_mii_read;
pd->mii_bus->write = smsc9420_mii_write;
--
2.20.1
Powered by blists - more mailing lists