[PATCH net-next v3 01/11] net: phy: get rid of redundant is_c45 information
From: Michael Walle
Date: Wed Jul 12 2023 - 11:07:45 EST
phy_device_create() will be called with is_c45 and c45_ids. If c45_ids
are set, is_c45 is (usually) true. Change the only caller which do
things differently, then drop the is_c45 check in phy_device_create().
This is a preparation patch to replace the is_c45 boolean with an enum
which will indicate how the PHY is accessed (by c22, c45 or
c45-over-c22).
Signed-off-by: Michael Walle <mwalle@xxxxxxxxxx>
---
drivers/net/phy/phy_device.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 0c2014accba7..226d5507c865 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -689,7 +689,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id,
* driver will get bored and give up as soon as it finds that
* there's no driver _already_ loaded.
*/
- if (is_c45 && c45_ids) {
+ if (c45_ids) {
const int num_ids = ARRAY_SIZE(c45_ids->device_ids);
int i;
@@ -970,7 +970,8 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
true, &c45_ids);
}
- return phy_device_create(bus, addr, phy_id, is_c45, &c45_ids);
+ return phy_device_create(bus, addr, phy_id, is_c45,
+ !is_c45 ? NULL : &c45_ids);
}
EXPORT_SYMBOL(get_phy_device);
--
2.39.2