Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'net-phy-clean-up-phy-h'

Heiner Kallweit says:

====================
net: phy: clean up phy.h

This series is a starting point to clean up phy.h and remove
definitions which are phylib-internal.
====================

Link: https://patch.msgid.link/d14f8a69-dc21-4ff7-8401-574ffe2f4bc5@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+23 -52
+3 -3
drivers/net/phy/phy.c
··· 302 302 cmd->base.port = PORT_BNC; 303 303 else 304 304 cmd->base.port = phydev->port; 305 - cmd->base.transceiver = phy_is_internal(phydev) ? 305 + cmd->base.transceiver = phydev->is_internal ? 306 306 XCVR_INTERNAL : XCVR_EXTERNAL; 307 307 cmd->base.phy_address = phydev->mdio.addr; 308 308 cmd->base.autoneg = phydev->autoneg; ··· 520 520 * @phydev: the phy_device struct 521 521 * @jiffies: Run the state machine after these jiffies 522 522 */ 523 - void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies) 523 + static void phy_queue_state_machine(struct phy_device *phydev, 524 + unsigned long jiffies) 524 525 { 525 526 mod_delayed_work(system_power_efficient_wq, &phydev->state_queue, 526 527 jiffies); 527 528 } 528 - EXPORT_SYMBOL(phy_queue_state_machine); 529 529 530 530 /** 531 531 * phy_trigger_machine - Trigger the state machine to run now
+20 -20
drivers/net/phy/phy_device.c
··· 45 45 MODULE_AUTHOR("Andy Fleming"); 46 46 MODULE_LICENSE("GPL"); 47 47 48 + #define PHY_ANY_ID "MATCH ANY PHY" 49 + #define PHY_ANY_UID 0xffffffff 50 + 51 + struct phy_fixup { 52 + struct list_head list; 53 + char bus_id[MII_BUS_ID_SIZE + 3]; 54 + u32 phy_uid; 55 + u32 phy_uid_mask; 56 + int (*run)(struct phy_device *phydev); 57 + }; 58 + 48 59 __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_basic_features) __ro_after_init; 49 60 EXPORT_SYMBOL_GPL(phy_basic_features); 50 61 ··· 91 80 ETHTOOL_LINK_MODE_Backplane_BIT, 92 81 }; 93 82 94 - const int phy_10_100_features_array[4] = { 83 + static const int phy_10_100_features_array[4] = { 95 84 ETHTOOL_LINK_MODE_10baseT_Half_BIT, 96 85 ETHTOOL_LINK_MODE_10baseT_Full_BIT, 97 86 ETHTOOL_LINK_MODE_100baseT_Half_BIT, 98 87 ETHTOOL_LINK_MODE_100baseT_Full_BIT, 99 88 }; 100 - EXPORT_SYMBOL_GPL(phy_10_100_features_array); 101 89 102 - const int phy_basic_t1_features_array[3] = { 90 + static const int phy_basic_t1_features_array[3] = { 103 91 ETHTOOL_LINK_MODE_TP_BIT, 104 92 ETHTOOL_LINK_MODE_10baseT1L_Full_BIT, 105 93 ETHTOOL_LINK_MODE_100baseT1_Full_BIT, 106 94 }; 107 - EXPORT_SYMBOL_GPL(phy_basic_t1_features_array); 108 95 109 - const int phy_basic_t1s_p2mp_features_array[2] = { 96 + static const int phy_basic_t1s_p2mp_features_array[2] = { 110 97 ETHTOOL_LINK_MODE_TP_BIT, 111 98 ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT, 112 99 }; 113 - EXPORT_SYMBOL_GPL(phy_basic_t1s_p2mp_features_array); 114 100 115 - const int phy_gbit_features_array[2] = { 101 + static const int phy_gbit_features_array[2] = { 116 102 ETHTOOL_LINK_MODE_1000baseT_Half_BIT, 117 103 ETHTOOL_LINK_MODE_1000baseT_Full_BIT, 118 104 }; 119 - EXPORT_SYMBOL_GPL(phy_gbit_features_array); 120 - 121 - const int phy_10gbit_features_array[1] = { 122 - ETHTOOL_LINK_MODE_10000baseT_Full_BIT, 123 - }; 124 - EXPORT_SYMBOL_GPL(phy_10gbit_features_array); 125 105 126 106 static const int phy_eee_cap1_features_array[] = { 127 107 ETHTOOL_LINK_MODE_100baseT_Full_BIT, ··· 187 185 linkmode_set_bit_array(phy_gbit_features_array, 188 186 ARRAY_SIZE(phy_gbit_features_array), 189 187 phy_10gbit_features); 190 - linkmode_set_bit_array(phy_10gbit_features_array, 191 - ARRAY_SIZE(phy_10gbit_features_array), 192 - phy_10gbit_features); 188 + linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, 189 + phy_10gbit_features); 193 190 194 191 linkmode_set_bit_array(phy_eee_cap1_features_array, 195 192 ARRAY_SIZE(phy_eee_cap1_features_array), ··· 379 378 * comparison 380 379 * @run: The actual code to be run when a matching PHY is found 381 380 */ 382 - int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask, 383 - int (*run)(struct phy_device *)) 381 + static int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask, 382 + int (*run)(struct phy_device *)) 384 383 { 385 384 struct phy_fixup *fixup = kzalloc(sizeof(*fixup), GFP_KERNEL); 386 385 ··· 398 397 399 398 return 0; 400 399 } 401 - EXPORT_SYMBOL(phy_register_fixup); 402 400 403 401 /* Registers a fixup to be run on any PHY with the UID in phy_uid */ 404 402 int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask, ··· 544 544 struct phy_device *phydev = to_phy_device(dev); 545 545 const char *mode = NULL; 546 546 547 - if (phy_is_internal(phydev)) 547 + if (phydev->is_internal) 548 548 mode = "internal"; 549 549 else 550 550 mode = phy_modes(phydev->interface);
-29
include/linux/phy.h
··· 54 54 #define PHY_EEE_CAP2_FEATURES ((unsigned long *)&phy_eee_cap2_features) 55 55 56 56 extern const int phy_basic_ports_array[3]; 57 - extern const int phy_10_100_features_array[4]; 58 - extern const int phy_basic_t1_features_array[3]; 59 - extern const int phy_basic_t1s_p2mp_features_array[2]; 60 - extern const int phy_gbit_features_array[2]; 61 - extern const int phy_10gbit_features_array[1]; 62 57 63 58 /* 64 59 * Set phydev->irq to PHY_POLL if interrupts are not supported, ··· 1282 1287 #define to_phy_driver(d) container_of_const(to_mdio_common_driver(d), \ 1283 1288 struct phy_driver, mdiodrv) 1284 1289 1285 - #define PHY_ANY_ID "MATCH ANY PHY" 1286 - #define PHY_ANY_UID 0xffffffff 1287 - 1288 1290 #define PHY_ID_MATCH_EXACT(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 0) 1289 1291 #define PHY_ID_MATCH_MODEL(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 4) 1290 1292 #define PHY_ID_MATCH_VENDOR(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 10) ··· 1313 1321 { 1314 1322 return phy_id_compare(id, phydev->phy_id, phydev->drv->phy_id_mask); 1315 1323 } 1316 - 1317 - /* A Structure for boards to register fixups with the PHY Lib */ 1318 - struct phy_fixup { 1319 - struct list_head list; 1320 - char bus_id[MII_BUS_ID_SIZE + 3]; 1321 - u32 phy_uid; 1322 - u32 phy_uid_mask; 1323 - int (*run)(struct phy_device *phydev); 1324 - }; 1325 1324 1326 1325 const char *phy_speed_to_str(int speed); 1327 1326 const char *phy_duplex_to_str(unsigned int duplex); ··· 1740 1757 } 1741 1758 1742 1759 /** 1743 - * phy_is_internal - Convenience function for testing if a PHY is internal 1744 - * @phydev: the phy_device struct 1745 - */ 1746 - static inline bool phy_is_internal(struct phy_device *phydev) 1747 - { 1748 - return phydev->is_internal; 1749 - } 1750 - 1751 - /** 1752 1760 * phy_on_sfp - Convenience function for testing if a PHY is on an SFP module 1753 1761 * @phydev: the phy_device struct 1754 1762 */ ··· 2062 2088 struct module *owner); 2063 2089 void phy_error(struct phy_device *phydev); 2064 2090 void phy_state_machine(struct work_struct *work); 2065 - void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies); 2066 2091 void phy_trigger_machine(struct phy_device *phydev); 2067 2092 void phy_mac_interrupt(struct phy_device *phydev); 2068 2093 void phy_start_machine(struct phy_device *phydev); ··· 2100 2127 void phy_resolve_pause(unsigned long *local_adv, unsigned long *partner_adv, 2101 2128 bool *tx_pause, bool *rx_pause); 2102 2129 2103 - int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask, 2104 - int (*run)(struct phy_device *)); 2105 2130 int phy_register_fixup_for_id(const char *bus_id, 2106 2131 int (*run)(struct phy_device *)); 2107 2132 int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,