net: phy: detach PHY driver OPs from phy_driver struct
Subsystems (19)
cover net: phy: detach PHY driver OPs from phy_driver struct
Posting as RFC due to the massive change to a fundamental struct.
While adding some PHY ID for Aquantia, I notice that there is a big problem with duplicating OPs with each PHY.
The original idea to prevent this was to use mask on the PHY ID and identify PHY Family. Problem is that OEM started to use all kind of PHY ID and this is not doable, hence for PHY that have the same OPs, we have to duplicate all of them.
This is present in Aquantia PHY, but is much more present in other PHY, especially in the BCM7XXX where they use a big macro for common PHYs.
To reduce patch delta, I added the additional variable without adding tabs as this would have resulted in a massive patch. Also to have patch bisectable, this change has to be in one go hence I had to use this trick to reduce patch delta.
Other solution to this problem were to introduce additional variables to phy_driver struct but that would have resulted in having 2 different way to do the same thing and that is not O.K.
I took care to compile-test all the PHY, only exception is the unique RUST driver, where I still have to learn that funny language and I didn't had time to update it, so that is the only driver that I think require some fixup.
I posted 2 example that would benefits from this change, but I can find much more in other PHY driver.
Christian Marangi (3):
net: phy: detach PHY driver OPs from phy_driver struct
net: phy: aquantia: use common OPs for PHYs where possible
net: phy: bcm7xxx: use common OPs for PHYs where possible
drivers/net/phy/adin.c | 4 + drivers/net/phy/adin1100.c | 2 + drivers/net/phy/amd.c | 4 + drivers/net/phy/aquantia/aquantia_main.c | 189 +++++++++-------------- drivers/net/phy/ax88796b.c | 6 + drivers/net/phy/bcm-cygnus.c | 4 + drivers/net/phy/bcm54140.c | 2 + drivers/net/phy/bcm63xx.c | 4 + drivers/net/phy/bcm7xxx.c | 72 +++++---- drivers/net/phy/bcm84881.c | 2 + drivers/net/phy/bcm87xx.c | 4 + drivers/net/phy/broadcom.c | 42 +++++ drivers/net/phy/cicada.c | 4 + drivers/net/phy/cortina.c | 2 + drivers/net/phy/davicom.c | 8 + drivers/net/phy/dp83640.c | 2 + drivers/net/phy/dp83822.c | 8 +- drivers/net/phy/dp83848.c | 2 + drivers/net/phy/dp83867.c | 2 + drivers/net/phy/dp83869.c | 2 + drivers/net/phy/dp83tc811.c | 2 + drivers/net/phy/dp83td510.c | 2 + drivers/net/phy/dp83tg720.c | 2 + drivers/net/phy/et1011c.c | 2 + drivers/net/phy/icplus.c | 8 + drivers/net/phy/intel-xway.c | 20 +++ drivers/net/phy/lxt.c | 8 + drivers/net/phy/marvell-88q2xxx.c | 2 + drivers/net/phy/marvell-88x2222.c | 2 + drivers/net/phy/marvell.c | 44 +++++- drivers/net/phy/marvell10g.c | 16 +- drivers/net/phy/mediatek-ge-soc.c | 4 + drivers/net/phy/mediatek-ge.c | 4 + drivers/net/phy/meson-gxl.c | 4 + drivers/net/phy/micrel.c | 54 ++++++- drivers/net/phy/microchip.c | 2 + drivers/net/phy/microchip_t1.c | 4 + drivers/net/phy/microchip_t1s.c | 4 + drivers/net/phy/motorcomm.c | 8 + drivers/net/phy/mscc/mscc_main.c | 30 ++++ drivers/net/phy/mxl-gpy.c | 24 +++ drivers/net/phy/national.c | 2 + drivers/net/phy/ncn26000.c | 2 + drivers/net/phy/nxp-c45-tja11xx.c | 8 +- drivers/net/phy/nxp-cbtx.c | 2 + drivers/net/phy/nxp-tja11xx.c | 16 +- drivers/net/phy/phy-c45.c | 2 + drivers/net/phy/phy-core.c | 18 ++- drivers/net/phy/phy.c | 85 +++++----- drivers/net/phy/phy_device.c | 79 +++++----- drivers/net/phy/qcom/at803x.c | 18 ++- drivers/net/phy/qcom/qca807x.c | 4 + drivers/net/phy/qcom/qca808x.c | 2 + drivers/net/phy/qcom/qca83xx.c | 12 +- drivers/net/phy/qsemi.c | 2 + drivers/net/phy/realtek.c | 46 +++++- drivers/net/phy/rockchip.c | 2 + drivers/net/phy/smsc.c | 14 ++ drivers/net/phy/ste10Xp.c | 4 + drivers/net/phy/teranetics.c | 2 + drivers/net/phy/uPD60620.c | 2 + drivers/net/phy/vitesse.c | 22 +++ drivers/net/phy/xilinx_gmii2rgmii.c | 16 +- include/linux/phy.h | 57 ++++--- 64 files changed, 737 insertions(+), 291 deletions(-)
Signature · 1 line
2.43.0
RFC PATCH 1/3 net: phy: detach PHY driver OPs from phy_driver struct
Detach PHY driver OPs from phy_driver struct. This permits a strict separation between const OPs and PHY model/family specific values/flags.
Many if not all PHYs driver currently have duplicated OPs for different PHY model/family where PHY_ID matching/mask can't be used. This limitation cause the side-effect of having to duplicate the PHY OPs for each PHY ID causing useless bloat/wasted space.
To solve this problem, deatch PHY driver OPs from phy_driver so they can be declared statically and just be referenced by pointer.
Each PHY driver is updated to this new phy_driver structure by simply declaring the OPs in a locally define struct inside phy_driver to reduce patch delta.
--- drivers/net/phy/adin.c | 4 ++ drivers/net/phy/adin1100.c | 2 + drivers/net/phy/amd.c | 4 ++ drivers/net/phy/aquantia/aquantia_main.c | 26 ++++++++ drivers/net/phy/ax88796b.c | 6 ++ drivers/net/phy/bcm-cygnus.c | 4 ++ drivers/net/phy/bcm54140.c | 2 + drivers/net/phy/bcm63xx.c | 4 ++ drivers/net/phy/bcm7xxx.c | 8 +++ drivers/net/phy/bcm84881.c | 2 + drivers/net/phy/bcm87xx.c | 4 ++ drivers/net/phy/broadcom.c | 42 ++++++++++++ drivers/net/phy/cicada.c | 4 ++ drivers/net/phy/cortina.c | 2 + drivers/net/phy/davicom.c | 8 +++ drivers/net/phy/dp83640.c | 2 + drivers/net/phy/dp83822.c | 8 ++- drivers/net/phy/dp83848.c | 2 + drivers/net/phy/dp83867.c | 2 + drivers/net/phy/dp83869.c | 2 + drivers/net/phy/dp83tc811.c | 2 + drivers/net/phy/dp83td510.c | 2 + drivers/net/phy/dp83tg720.c | 2 + drivers/net/phy/et1011c.c | 2 + drivers/net/phy/icplus.c | 8 +++ drivers/net/phy/intel-xway.c | 20 ++++++ drivers/net/phy/lxt.c | 8 +++ drivers/net/phy/marvell-88q2xxx.c | 2 + drivers/net/phy/marvell-88x2222.c | 2 + drivers/net/phy/marvell.c | 44 +++++++++++- drivers/net/phy/marvell10g.c | 16 +++-- drivers/net/phy/mediatek-ge-soc.c | 4 ++ drivers/net/phy/mediatek-ge.c | 4 ++ drivers/net/phy/meson-gxl.c | 4 ++ drivers/net/phy/micrel.c | 54 ++++++++++++--- drivers/net/phy/microchip.c | 2 + drivers/net/phy/microchip_t1.c | 4 ++ drivers/net/phy/microchip_t1s.c | 4 ++ drivers/net/phy/motorcomm.c | 8 +++ drivers/net/phy/mscc/mscc_main.c | 30 +++++++++ drivers/net/phy/mxl-gpy.c | 24 +++++++ drivers/net/phy/national.c | 2 + drivers/net/phy/ncn26000.c | 2 + drivers/net/phy/nxp-c45-tja11xx.c | 8 ++- drivers/net/phy/nxp-cbtx.c | 2 + drivers/net/phy/nxp-tja11xx.c | 16 +++-- drivers/net/phy/phy-c45.c | 2 + drivers/net/phy/phy-core.c | 18 ++--- drivers/net/phy/phy.c | 85 ++++++++++++------------ drivers/net/phy/phy_device.c | 79 +++++++++++----------- drivers/net/phy/qcom/at803x.c | 18 ++++- drivers/net/phy/qcom/qca807x.c | 4 ++ drivers/net/phy/qcom/qca808x.c | 2 + drivers/net/phy/qcom/qca83xx.c | 12 +++- drivers/net/phy/qsemi.c | 2 + drivers/net/phy/realtek.c | 46 ++++++++++++- drivers/net/phy/rockchip.c | 2 + drivers/net/phy/smsc.c | 14 ++++ drivers/net/phy/ste10Xp.c | 4 ++ drivers/net/phy/teranetics.c | 2 + drivers/net/phy/uPD60620.c | 2 + drivers/net/phy/vitesse.c | 22 ++++++ drivers/net/phy/xilinx_gmii2rgmii.c | 16 +++-- include/linux/phy.h | 57 +++++++++------- 64 files changed, 654 insertions(+), 147 deletions(-)
drivers/net/phy/adin.c +4 -0
@@ -994,6 +994,7 @@ static struct phy_driver adin_driver[] = { PHY_ID_MATCH_MODEL(PHY_ID_ADIN1200), .name = "ADIN1200", .flags = PHY_POLL_CABLE_TEST, + .ops = &(const struct phy_driver_ops ){ .probe = adin_probe, .config_init = adin_config_init, .soft_reset = adin_soft_reset,
@@ -1012,11 +1013,13 @@ static struct phy_driver adin_driver[] = { .write_mmd = adin_write_mmd, .cable_test_start = adin_cable_test_start, .cable_test_get_status = adin_cable_test_get_status, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_ADIN1300), .name = "ADIN1300", .flags = PHY_POLL_CABLE_TEST, + .ops = &(const struct phy_driver_ops ){ .probe = adin_probe, .config_init = adin_config_init, .soft_reset = adin_soft_reset,
@@ -1035,6 +1038,7 @@ static struct phy_driver adin_driver[] = { .write_mmd = adin_write_mmd, .cable_test_start = adin_cable_test_start, .cable_test_get_status = adin_cable_test_get_status, + }, }, };
drivers/net/phy/adin1100.c +2 -0
@@ -323,6 +323,7 @@ static struct phy_driver adin_driver[] = { .phy_id = PHY_ID_ADIN1100, .phy_id_mask = 0xffffffcf, .name = "ADIN1100", + .ops = &(const struct phy_driver_ops ){ .get_features = adin_get_features, .soft_reset = adin_soft_reset, .probe = adin_probe,
@@ -335,6 +336,7 @@ static struct phy_driver adin_driver[] = { .resume = adin_resume, .get_sqi = adin_get_sqi, .get_sqi_max = adin_get_sqi_max, + }, }, };
drivers/net/phy/amd.c +4 -0
@@ -94,18 +94,22 @@ static struct phy_driver am79c_drivers[] = { .name = "AM79C874", .phy_id_mask = 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops){ .config_init = am79c_config_init, .config_intr = am79c_config_intr, .handle_interrupt = am79c_handle_interrupt, + }, }, { .phy_id = PHY_ID_AC101L, .name = "AC101L", .phy_id_mask = 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops){ .config_init = am79c_config_init, .config_intr = am79c_config_intr, .handle_interrupt = am79c_handle_interrupt, + }, }, };
drivers/net/phy/aquantia/aquantia_main.c +26 -0
@@ -772,40 +772,49 @@ static struct phy_driver aqr_driver[] = { { PHY_ID_MATCH_MODEL(PHY_ID_AQ1202), .name = "Aquantia AQ1202", + .ops = &(const struct phy_driver_ops ){ .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, + }, }, {PHY_ID_MATCH_MODEL (PHY_ID_AQ2104 ), .name = "Aquantia AQ2104", + .ops = &(const struct phy_driver_ops){ .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, + }, }, {PHY_ID_MATCH_MODEL (PHY_ID_AQR105 ), .name = "Aquantia AQR105", + .ops = &(const struct phy_driver_ops){ .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, .suspend = aqr107_suspend, .resume = aqr107_resume, + }, }, {PHY_ID_MATCH_MODEL (PHY_ID_AQR106 ), .name = "Aquantia AQR106", + .ops = &(const struct phy_driver_ops){ .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, + }, }, {PHY_ID_MATCH_MODEL (PHY_ID_AQR107 ), .name = "Aquantia AQR107", + .ops = &(const struct phy_driver_ops){ .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, .config_init = aqr107_config_init,
@@ -821,10 +830,12 @@ static struct phy_driver aqr_driver[] = { .get_strings = aqr107_get_strings, .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), .name = "Aquantia AQCS109", + .ops = &(const struct phy_driver_ops ){ .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, .config_init = aqcs109_config_init,
@@ -840,10 +851,12 @@ static struct phy_driver aqr_driver[] = { .get_strings = aqr107_get_strings, .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR111), .name = "Aquantia AQR111", + .ops = &(const struct phy_driver_ops ){ .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, .config_init = aqr111_config_init,
@@ -859,10 +872,12 @@ static struct phy_driver aqr_driver[] = { .get_strings = aqr107_get_strings, .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0), .name = "Aquantia AQR111B0", + .ops = &(const struct phy_driver_ops ){ .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, .config_init = aqr111_config_init,
@@ -878,18 +893,22 @@ static struct phy_driver aqr_driver[] = { .get_strings = aqr107_get_strings, .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR405), .name = "Aquantia AQR405", + .ops = &(const struct phy_driver_ops ){ .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, + }, }, {PHY_ID_MATCH_MODEL (PHY_ID_AQR112 ), .name = "Aquantia AQR112", + .ops = &(const struct phy_driver_ops){ .probe = aqr107_probe, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr,
@@ -904,10 +923,12 @@ static struct phy_driver aqr_driver[] = { .get_strings = aqr107_get_strings, .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR412), .name = "Aquantia AQR412", + .ops = &(const struct phy_driver_ops ){ .probe = aqr107_probe, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr,
@@ -922,10 +943,12 @@ static struct phy_driver aqr_driver[] = { .get_strings = aqr107_get_strings, .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113), .name = "Aquantia AQR113", + .ops = &(const struct phy_driver_ops ){ .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, .config_init = aqr113c_config_init,
@@ -941,10 +964,12 @@ static struct phy_driver aqr_driver[] = { .get_strings = aqr107_get_strings, .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), .name = "Aquantia AQR113C", + .ops = &(const struct phy_driver_ops ){ .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, .config_init = aqr113c_config_init,
@@ -960,6 +985,7 @@ static struct phy_driver aqr_driver[] = { .get_strings = aqr107_get_strings, .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, + }, }, };
drivers/net/phy/ax88796b.c +6 -0
@@ -99,24 +99,30 @@ static struct phy_driver asix_driver[] = {PHY_ID_MATCH_EXACT (PHY_ID_ASIX_AX88772A ), .name = "Asix Electronics AX88772A", .flags = PHY_IS_INTERNAL, + .ops = &(const struct phy_driver_ops){ .read_status = asix_ax88772a_read_status, .suspend = genphy_suspend, .resume = genphy_resume, .soft_reset = asix_soft_reset, .link_change_notify = asix_ax88772a_link_change_notify, + }, }, {PHY_ID_MATCH_EXACT (PHY_ID_ASIX_AX88772C ), .name = "Asix Electronics AX88772C", .flags = PHY_IS_INTERNAL, + .ops = &(const struct phy_driver_ops){ .suspend = genphy_suspend, .resume = genphy_resume, .soft_reset = asix_soft_reset, + }, }, { .phy_id = PHY_ID_ASIX_AX88796B, .name = "Asix Electronics AX88796B", .phy_id_mask = 0xfffffff0,/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops){ .soft_reset = asix_soft_reset, + }, } };module_phy_driver (asix_driver );
drivers/net/phy/bcm-cygnus.c +4 -0
@@ -255,17 +255,20 @@ static struct phy_driver bcm_cygnus_phy_driver[] = { .phy_id_mask = 0xfffffff0, .name = "Broadcom Cygnus PHY",/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = bcm_cygnus_config_init, .config_intr = bcm_phy_config_intr, .handle_interrupt = bcm_phy_handle_interrupt, .suspend = genphy_suspend, .resume = bcm_cygnus_resume, + }, }, { .phy_id = PHY_ID_BCM_OMEGA, .phy_id_mask = 0xfffffff0, .name = "Broadcom Omega Combo GPHY",/* PHY_GBIT_FEATURES */ .flags = PHY_IS_INTERNAL, + .ops = &(const struct phy_driver_ops ){ .config_init = bcm_omega_config_init, .suspend = genphy_suspend, .resume = bcm_omega_resume,
@@ -275,6 +278,7 @@ static struct phy_driver bcm_cygnus_phy_driver[] = { .get_strings = bcm_phy_get_strings, .get_stats = bcm_omega_get_phy_stats, .probe = bcm_omega_probe, + }, } };
drivers/net/phy/bcm54140.c +2 -0
@@ -868,6 +868,7 @@ static struct phy_driver bcm54140_drivers[] = { .name = "Broadcom BCM54140", .flags = PHY_POLL_CABLE_TEST, .features = PHY_GBIT_FEATURES, + .ops = &(const struct phy_driver_ops ){ .config_init = bcm54140_config_init, .handle_interrupt = bcm54140_handle_interrupt, .config_intr = bcm54140_config_intr,
@@ -879,6 +880,7 @@ static struct phy_driver bcm54140_drivers[] = { .set_tunable = bcm54140_set_tunable, .cable_test_start = bcm_phy_cable_test_start_rdb, .cable_test_get_status = bcm_phy_cable_test_get_status_rdb, + }, }, };module_phy_driver (bcm54140_drivers);
drivers/net/phy/bcm63xx.c +4 -0
@@ -76,9 +76,11 @@ static struct phy_driver bcm63xx_driver[] = { .name = "Broadcom BCM63XX (1)",/* PHY_BASIC_FEATURES */ .flags = PHY_IS_INTERNAL, + .ops = &(const struct phy_driver_ops ){ .config_init = bcm63xx_config_init, .config_intr = bcm63xx_config_intr, .handle_interrupt = bcm_phy_handle_interrupt, + }, }, {/* same phy as above, with just a different OUI */ .phy_id = 0x002bdc00,
@@ -86,9 +88,11 @@ static struct phy_driver bcm63xx_driver[] = { .name = "Broadcom BCM63XX (2)",/* PHY_BASIC_FEATURES */ .flags = PHY_IS_INTERNAL, + .ops = &(const struct phy_driver_ops ){ .config_init = bcm63xx_config_init, .config_intr = bcm63xx_config_intr, .handle_interrupt = bcm_phy_handle_interrupt, + }, } };module_phy_driver (bcm63xx_driver);
drivers/net/phy/bcm7xxx.c +8 -0
@@ -847,6 +847,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name = _name, \/* PHY_GBIT_FEATURES */ \ .flags = PHY_IS_INTERNAL, \ + .ops = &(const struct phy_driver_ops ){ \ .config_init = bcm7xxx_28nm_config_init, \ .resume = bcm7xxx_28nm_resume, \ .get_tunable = bcm7xxx_28nm_get_tunable, \
@@ -855,6 +856,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .get_strings = bcm_phy_get_strings, \ .get_stats = bcm7xxx_28nm_get_phy_stats, \ .probe = bcm7xxx_28nm_probe, \ + }, \ }#define BCM7XXX_28NM_EPHY (_oui, _name) \
@@ -864,6 +866,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name = _name, \/* PHY_BASIC_FEATURES */ \ .flags = PHY_IS_INTERNAL, \ + .ops = &(const struct phy_driver_ops ){ \ .config_init = bcm7xxx_28nm_ephy_config_init, \ .resume = bcm7xxx_28nm_ephy_resume, \ .get_sset_count = bcm_phy_get_sset_count, \
@@ -872,6 +875,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .probe = bcm7xxx_28nm_probe, \ .read_mmd = bcm7xxx_28nm_ephy_read_mmd, \ .write_mmd = bcm7xxx_28nm_ephy_write_mmd, \ + }, \ }#define BCM7XXX_40NM_EPHY (_oui, _name) \
@@ -881,10 +885,12 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name = _name, \ /* PHY_BASIC_FEATURES */ \ .flags = PHY_IS_INTERNAL, \ + .ops = &(const struct phy_driver_ops){ \ .soft_reset = genphy_soft_reset, \ .config_init = bcm7xxx_config_init, \ .suspend = bcm7xxx_suspend, \ .resume = bcm7xxx_config_init, \ + }, \ }#define BCM7XXX_16NM_EPHY (_oui, _name) \
@@ -894,6 +900,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name = _name, \/* PHY_BASIC_FEATURES */ \ .flags = PHY_IS_INTERNAL, \ + .ops = &(const struct phy_driver_ops ){ \ .get_sset_count = bcm_phy_get_sset_count, \ .get_strings = bcm_phy_get_strings, \ .get_stats = bcm7xxx_28nm_get_phy_stats, \
@@ -902,6 +909,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .config_aneg = genphy_config_aneg, \ .read_status = genphy_read_status, \ .resume = bcm7xxx_16nm_ephy_resume, \ + }, \ } static struct phy_driver bcm7xxx_driver[] = {
drivers/net/phy/bcm84881.c +2 -0
@@ -240,12 +240,14 @@ static struct phy_driver bcm84881_drivers[] = { .phy_id = 0xae025150, .phy_id_mask = 0xfffffff0, .name = "Broadcom BCM84881", + .ops = &(const struct phy_driver_ops ){ .config_init = bcm84881_config_init, .probe = bcm84881_probe, .get_features = bcm84881_get_features, .config_aneg = bcm84881_config_aneg, .aneg_done = bcm84881_aneg_done, .read_status = bcm84881_read_status, + }, }, };
drivers/net/phy/bcm87xx.c +4 -0
@@ -200,6 +200,7 @@ static struct phy_driver bcm87xx_driver[] = { .phy_id = PHY_ID_BCM8706, .phy_id_mask = 0xffffffff, .name = "Broadcom BCM8706", + .ops = &(const struct phy_driver_ops ){ .get_features = bcm87xx_get_features, .config_init = bcm87xx_config_init, .config_aneg = bcm87xx_config_aneg,
@@ -207,10 +208,12 @@ static struct phy_driver bcm87xx_driver[] = { .config_intr = bcm87xx_config_intr, .handle_interrupt = bcm87xx_handle_interrupt, .match_phy_device = bcm8706_match_phy_device, + }, }, { .phy_id = PHY_ID_BCM8727, .phy_id_mask = 0xffffffff, .name = "Broadcom BCM8727", + .ops = &(const struct phy_driver_ops ){ .get_features = bcm87xx_get_features, .config_init = bcm87xx_config_init, .config_aneg = bcm87xx_config_aneg,
@@ -218,6 +221,7 @@ static struct phy_driver bcm87xx_driver[] = { .config_intr = bcm87xx_config_intr, .handle_interrupt = bcm87xx_handle_interrupt, .match_phy_device = bcm8727_match_phy_device, + }, } };module_phy_driver (bcm87xx_driver);
drivers/net/phy/broadcom.c +42 -0
276 lines not on this page · raw message
drivers/net/phy/cicada.c +4 -0
@@ -130,17 +130,21 @@ static struct phy_driver cis820x_driver[] = { .name = "Cicada Cis8201", .phy_id_mask = 0x000ffff0, /* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops){ .config_init = &cis820x_config_init, .config_intr = &cis820x_config_intr, .handle_interrupt = &cis820x_handle_interrupt, + }, }, { .phy_id = 0x000fc440, .name = "Cicada Cis8204", .phy_id_mask = 0x000fffc0, /* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops){ .config_init = &cis820x_config_init, .config_intr = &cis820x_config_intr, .handle_interrupt = &cis820x_handle_interrupt, + }, } };module_phy_driver (cis820x_driver);
drivers/net/phy/cortina.c +2 -0
@@ -79,9 +79,11 @@ static struct phy_driver cortina_driver[] = { .phy_id_mask = 0xffffffff, .name = "Cortina CS4340", .features = PHY_10GBIT_FEATURES, + .ops = &(const struct phy_driver_ops ){ .config_aneg = gen10g_config_aneg, .read_status = cortina_read_status, .probe = cortina_probe, + }, }, };
drivers/net/phy/davicom.c +8 -0
@@ -176,35 +176,43 @@ static struct phy_driver dm91xx_driver[] = { .name = "Davicom DM9161E", .phy_id_mask = 0x0ffffff0,/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = dm9161_config_init, .config_aneg = dm9161_config_aneg, .config_intr = dm9161_config_intr, .handle_interrupt = dm9161_handle_interrupt, + }, }, { .phy_id = 0x0181b8b0, .name = "Davicom DM9161B/C", .phy_id_mask = 0x0ffffff0,/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = dm9161_config_init, .config_aneg = dm9161_config_aneg, .config_intr = dm9161_config_intr, .handle_interrupt = dm9161_handle_interrupt, + }, }, { .phy_id = 0x0181b8a0, .name = "Davicom DM9161A", .phy_id_mask = 0x0ffffff0,/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = dm9161_config_init, .config_aneg = dm9161_config_aneg, .config_intr = dm9161_config_intr, .handle_interrupt = dm9161_handle_interrupt, + }, }, { .phy_id = 0x00181b80, .name = "Davicom DM9131", .phy_id_mask = 0x0ffffff0,/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_intr = dm9161_config_intr, .handle_interrupt = dm9161_handle_interrupt, + }, } };module_phy_driver (dm91xx_driver);
drivers/net/phy/dp83640.c +2 -0
@@ -1520,12 +1520,14 @@ static struct phy_driver dp83640_driver = { .phy_id_mask = 0xfffffff0, .name = "NatSemi DP83640",/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .probe = dp83640_probe, .remove = dp83640_remove, .soft_reset = dp83640_soft_reset, .config_init = dp83640_config_init, .config_intr = dp83640_config_intr, .handle_interrupt = dp83640_handle_interrupt, + }, };static int __init dp83640_init (void )
drivers/net/phy/dp83822.c +7 -1
@@ -544,7 +544,7 @@ static int dp83822_phy_reset(struct phy_device *phydev)if (err <0 )return err; -return phydev->drv->config_init (phydev); +return phydev->drv->ops->config_init (phydev); }#ifdef CONFIG_OF_MDIO
@@ -704,6 +704,7 @@ static int dp83822_resume(struct phy_device *phydev) PHY_ID_MATCH_MODEL(_id), \ .name = (_name), \/* PHY_BASIC_FEATURES */ \ + .ops = &(const struct phy_driver_ops ){\ .probe = dp83822_probe, \ .soft_reset = dp83822_phy_reset, \ .config_init = dp83822_config_init, \
@@ -714,6 +715,7 @@ static int dp83822_resume(struct phy_device *phydev) .handle_interrupt = dp83822_handle_interrupt, \ .suspend = dp83822_suspend, \ .resume = dp83822_resume, \ + }, \ }#define DP83826_PHY_DRIVER (_id, _name) \
@@ -721,6 +723,7 @@ static int dp83822_resume(struct phy_device *phydev) PHY_ID_MATCH_MODEL(_id), \ .name = (_name), \/* PHY_BASIC_FEATURES */ \ + .ops = &(const struct phy_driver_ops ){\ .probe = dp83826_probe, \ .soft_reset = dp83822_phy_reset, \ .config_init = dp83826_config_init, \
@@ -730,6 +733,7 @@ static int dp83822_resume(struct phy_device *phydev) .handle_interrupt = dp83822_handle_interrupt, \ .suspend = dp83822_suspend, \ .resume = dp83822_resume, \ + }, \ }#define DP8382X_PHY_DRIVER (_id, _name) \
@@ -737,6 +741,7 @@ static int dp83822_resume(struct phy_device *phydev) PHY_ID_MATCH_MODEL(_id), \ .name = (_name), \/* PHY_BASIC_FEATURES */ \ + .ops = &(const struct phy_driver_ops ){\ .soft_reset = dp83822_phy_reset, \ .config_init = dp8382x_config_init, \ .get_wol = dp83822_get_wol, \
@@ -745,6 +750,7 @@ static int dp83822_resume(struct phy_device *phydev) .handle_interrupt = dp83822_handle_interrupt, \ .suspend = dp83822_suspend, \ .resume = dp83822_resume, \ + }, \ } static struct phy_driver dp83822_driver[] = {
drivers/net/phy/dp83848.c +2 -0
@@ -139,6 +139,7 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl); .name = _name, \/* PHY_BASIC_FEATURES */ \ \ + .ops = &(const struct phy_driver_ops ){\ .soft_reset = genphy_soft_reset, \ .config_init = _config_init, \ .suspend = genphy_suspend, \
@@ -147,6 +148,7 @@ MODULE_DEVICE_TABLE(mdio, dp83848_tbl);/* IRQ related */ \ .config_intr = dp83848_config_intr, \ .handle_interrupt = dp83848_handle_interrupt, \ + }, \ } static struct phy_driver dp83848_driver[] = {
drivers/net/phy/dp83867.c +2 -0
@@ -1180,6 +1180,7 @@ static struct phy_driver dp83867_driver[] = { .name = "TI DP83867",/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .probe = dp83867_probe, .config_init = dp83867_config_init, .soft_reset = dp83867_phy_reset,
@@ -1206,6 +1207,7 @@ static struct phy_driver dp83867_driver[] = { .led_hw_control_set = dp83867_led_hw_control_set, .led_hw_control_get = dp83867_led_hw_control_get, .led_polarity_set = dp83867_led_polarity_set, + }, }, };module_phy_driver (dp83867_driver);
drivers/net/phy/dp83869.c +2 -0
@@ -893,6 +893,7 @@ static int dp83869_phy_reset(struct phy_device *phydev) { \ PHY_ID_MATCH_MODEL(_id), \ .name = (_name), \ + .ops = &(const struct phy_driver_ops ){ \ .probe = dp83869_probe, \ .config_init = dp83869_config_init, \ .soft_reset = dp83869_phy_reset, \
@@ -905,6 +906,7 @@ static int dp83869_phy_reset(struct phy_device *phydev) .set_wol = dp83869_set_wol, \ .suspend = genphy_suspend, \ .resume = genphy_resume, \ + }, \ } static struct phy_driver dp83869_driver[] = {
drivers/net/phy/dp83tc811.c +2 -0
@@ -390,6 +390,7 @@ static struct phy_driver dp83811_driver[] = { .phy_id_mask = 0xfffffff0, .name = "TI DP83TC811",/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = dp83811_config_init, .config_aneg = dp83811_config_aneg, .soft_reset = dp83811_phy_reset,
@@ -399,6 +400,7 @@ static struct phy_driver dp83811_driver[] = { .handle_interrupt = dp83811_handle_interrupt, .suspend = dp83811_suspend, .resume = dp83811_resume, + }, }, };module_phy_driver (dp83811_driver);
drivers/net/phy/dp83td510.c +2 -0
@@ -221,6 +221,7 @@ static struct phy_driver dp83td510_driver[] = { PHY_ID_MATCH_MODEL(DP83TD510E_PHY_ID), .name = "TI DP83TD510E", + .ops = &(const struct phy_driver_ops ){ .config_aneg = dp83td510_config_aneg, .read_status = dp83td510_read_status, .get_features = dp83td510_get_features,
@@ -231,6 +232,7 @@ static struct phy_driver dp83td510_driver[] = { .suspend = genphy_suspend, .resume = genphy_resume, + }, } };module_phy_driver (dp83td510_driver);
drivers/net/phy/dp83tg720.c +2 -0
@@ -165,6 +165,7 @@ static struct phy_driver dp83tg720_driver[] = { PHY_ID_MATCH_MODEL(DP83TG720S_PHY_ID), .name = "TI DP83TG720S", + .ops = &(const struct phy_driver_ops ){ .config_aneg = dp83tg720_config_aneg, .read_status = dp83tg720_read_status, .get_features = genphy_c45_pma_read_ext_abilities,
@@ -174,6 +175,7 @@ static struct phy_driver dp83tg720_driver[] = { .suspend = genphy_suspend, .resume = genphy_resume, + }, } };module_phy_driver (dp83tg720_driver);
drivers/net/phy/et1011c.c +2 -0
@@ -88,8 +88,10 @@ static struct phy_driver et1011c_driver[] = { { .name = "ET1011C", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_aneg = et1011c_config_aneg, .read_status = et1011c_read_status, + }, } };module_phy_driver (et1011c_driver);
drivers/net/phy/icplus.c +8 -0
@@ -576,21 +576,26 @@ static struct phy_driver icplus_driver[] = { PHY_ID_MATCH_MODEL(IP175C_PHY_ID), .name = "ICPlus IP175C",/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = ip175c_config_init, .config_aneg = ip175c_config_aneg, .read_status = ip175c_read_status, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, {PHY_ID_MATCH_MODEL (IP1001_PHY_ID ), .name = "ICPlus IP1001",/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops){ .config_init = ip1001_config_init, .soft_reset = genphy_soft_reset, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .name ="ICPlus IP101A" , + .ops = &(const struct phy_driver_ops){ .match_phy_device = ip101a_match_phy_device, .probe = ip101a_g_probe, .read_page = ip101a_read_page,
@@ -603,8 +608,10 @@ static struct phy_driver icplus_driver[] = { .soft_reset = genphy_soft_reset, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .name = "ICPlus IP101G", + .ops = &(const struct phy_driver_ops ){ .match_phy_device = ip101g_match_phy_device, .probe = ip101a_g_probe, .read_page = ip101g_read_page,
@@ -620,6 +627,7 @@ static struct phy_driver icplus_driver[] = { .get_stats = ip101g_get_stats, .suspend = genphy_suspend, .resume = genphy_resume, + }, } };module_phy_driver (icplus_driver);
drivers/net/phy/intel-xway.c +20 -0
@@ -353,105 +353,125 @@ static struct phy_driver xway_gphy[] = { .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.3",/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = xway_gphy_config_init, .config_aneg = xway_gphy14_config_aneg, .handle_interrupt = xway_gphy_handle_interrupt, .config_intr = xway_gphy_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = PHY_ID_PHY22F_1_3, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY22F (PEF 7061) v1.3",/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = xway_gphy_config_init, .config_aneg = xway_gphy14_config_aneg, .handle_interrupt = xway_gphy_handle_interrupt, .config_intr = xway_gphy_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = PHY_ID_PHY11G_1_4, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.4",/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = xway_gphy_config_init, .config_aneg = xway_gphy14_config_aneg, .handle_interrupt = xway_gphy_handle_interrupt, .config_intr = xway_gphy_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = PHY_ID_PHY22F_1_4, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY22F (PEF 7061) v1.4",/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = xway_gphy_config_init, .config_aneg = xway_gphy14_config_aneg, .handle_interrupt = xway_gphy_handle_interrupt, .config_intr = xway_gphy_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = PHY_ID_PHY11G_1_5, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.5 / v1.6",/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = xway_gphy_config_init, .handle_interrupt = xway_gphy_handle_interrupt, .config_intr = xway_gphy_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = PHY_ID_PHY22F_1_5, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY22F (PEF 7061) v1.5 / v1.6",/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = xway_gphy_config_init, .handle_interrupt = xway_gphy_handle_interrupt, .config_intr = xway_gphy_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = PHY_ID_PHY11G_VR9_1_1, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY11G (xRX v1.1 integrated)",/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = xway_gphy_config_init, .handle_interrupt = xway_gphy_handle_interrupt, .config_intr = xway_gphy_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = PHY_ID_PHY22F_VR9_1_1, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY22F (xRX v1.1 integrated)",/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = xway_gphy_config_init, .handle_interrupt = xway_gphy_handle_interrupt, .config_intr = xway_gphy_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = PHY_ID_PHY11G_VR9_1_2, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY11G (xRX v1.2 integrated)",/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = xway_gphy_config_init, .handle_interrupt = xway_gphy_handle_interrupt, .config_intr = xway_gphy_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = PHY_ID_PHY22F_VR9_1_2, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY22F (xRX v1.2 integrated)",/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = xway_gphy_config_init, .handle_interrupt = xway_gphy_handle_interrupt, .config_intr = xway_gphy_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, };module_phy_driver (xway_gphy);
drivers/net/phy/lxt.c +8 -0
@@ -311,39 +311,47 @@ static struct phy_driver lxt97x_driver[] = { .name = "LXT970", .phy_id_mask = 0xfffffff0, /* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops){ .config_init = lxt970_config_init, .config_intr = lxt970_config_intr, .handle_interrupt = lxt970_handle_interrupt, + }, }, { .phy_id = 0x001378e0, .name = "LXT971", .phy_id_mask = 0xfffffff0,/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_intr = lxt971_config_intr, .handle_interrupt = lxt971_handle_interrupt, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = 0x00137a10, .name = "LXT973-A2", .phy_id_mask = 0xffffffff,/* PHY_BASIC_FEATURES */ .flags = 0, + .ops = &(const struct phy_driver_ops ){ .probe = lxt973_probe, .config_aneg = lxt973_config_aneg, .read_status = lxt973a2_read_status, .suspend = genphy_suspend, .resume = genphy_resume, + }, }, { .phy_id = 0x00137a10, .name = "LXT973", .phy_id_mask = 0xfffffff0,/* PHY_BASIC_FEATURES */ .flags = 0, + .ops = &(const struct phy_driver_ops ){ .probe = lxt973_probe, .config_aneg = lxt973_config_aneg, .suspend = genphy_suspend, .resume = genphy_resume, + }, } };module_phy_driver (lxt97x_driver);
drivers/net/phy/marvell-88q2xxx.c +2 -0
@@ -240,6 +240,7 @@ static struct phy_driver mv88q2xxx_driver[] = { .phy_id = MARVELL_PHY_ID_88Q2110, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "mv88q2110", + .ops = &(const struct phy_driver_ops ){ .get_features = mv88q2xxx_get_features, .config_aneg = mv88q2xxx_config_aneg, .config_init = mv88q2xxx_config_init,
@@ -248,6 +249,7 @@ static struct phy_driver mv88q2xxx_driver[] = { .set_loopback = genphy_c45_loopback, .get_sqi = mv88q2xxxx_get_sqi, .get_sqi_max = mv88q2xxxx_get_sqi_max, + }, }, };
drivers/net/phy/marvell-88x2222.c +2 -0
@@ -600,6 +600,7 @@ static struct phy_driver mv2222_drivers[] = { .phy_id = MARVELL_PHY_ID_88X2222, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "Marvell 88X2222", + .ops = &(const struct phy_driver_ops ){ .get_features = mv2222_get_features, .soft_reset = mv2222_soft_reset, .config_init = mv2222_config_init,
@@ -609,6 +610,7 @@ static struct phy_driver mv2222_drivers[] = { .suspend = mv2222_suspend, .resume = mv2222_resume, .read_status = mv2222_read_status, + }, }, };module_phy_driver (mv2222_drivers);
drivers/net/phy/marvell.c +42 -2
287 lines not on this page · raw message
drivers/net/phy/marvell10g.c +12 -4
@@ -1403,9 +1403,10 @@ static struct phy_driver mv3310_drivers[] = { { .phy_id = MARVELL_PHY_ID_88X3310, .phy_id_mask = MARVELL_PHY_ID_MASK, - .match_phy_device = mv3310_match_phy_device, .name = "mv88x3310", .driver_data = &mv3310_type, + .ops = &(const struct phy_driver_ops ){ + .match_phy_device = mv3310_match_phy_device, .get_features = mv3310_get_features, .config_init = mv3310_config_init, .probe = mv3310_probe,
@@ -1420,13 +1421,15 @@ static struct phy_driver mv3310_drivers[] = { .set_loopback = genphy_c45_loopback, .get_wol = mv3110_get_wol, .set_wol = mv3110_set_wol, + }, }, { .phy_id = MARVELL_PHY_ID_88X3310, .phy_id_mask = MARVELL_PHY_ID_MASK, - .match_phy_device = mv3340_match_phy_device, .name = "mv88x3340", .driver_data = &mv3340_type, + .ops = &(const struct phy_driver_ops ){ + .match_phy_device = mv3340_match_phy_device, .get_features = mv3310_get_features, .config_init = mv3310_config_init, .probe = mv3310_probe,
@@ -1439,13 +1442,15 @@ static struct phy_driver mv3310_drivers[] = { .set_tunable = mv3310_set_tunable, .remove = mv3310_remove, .set_loopback = genphy_c45_loopback, + }, }, { .phy_id = MARVELL_PHY_ID_88E2110, .phy_id_mask = MARVELL_PHY_ID_MASK, - .match_phy_device = mv2110_match_phy_device, .name = "mv88e2110", .driver_data = &mv2110_type, + .ops = &(const struct phy_driver_ops ){ + .match_phy_device = mv2110_match_phy_device, .probe = mv3310_probe, .suspend = mv3310_suspend, .resume = mv3310_resume,
@@ -1459,13 +1464,15 @@ static struct phy_driver mv3310_drivers[] = { .set_loopback = genphy_c45_loopback, .get_wol = mv3110_get_wol, .set_wol = mv3110_set_wol, + }, }, { .phy_id = MARVELL_PHY_ID_88E2110, .phy_id_mask = MARVELL_PHY_ID_MASK, - .match_phy_device = mv2111_match_phy_device, .name = "mv88e2111", .driver_data = &mv2111_type, + .ops = &(const struct phy_driver_ops ){ + .match_phy_device = mv2111_match_phy_device, .probe = mv3310_probe, .suspend = mv3310_suspend, .resume = mv3310_resume,
@@ -1477,6 +1484,7 @@ static struct phy_driver mv3310_drivers[] = { .set_tunable = mv3310_set_tunable, .remove = mv3310_remove, .set_loopback = genphy_c45_loopback, + }, }, };
drivers/net/phy/mediatek-ge-soc.c +4 -0
@@ -1497,6 +1497,7 @@ static struct phy_driver mtk_socphy_driver[] = { { PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981), .name = "MediaTek MT7981 PHY", + .ops = &(const struct phy_driver_ops ){ .config_init = mt798x_phy_config_init, .config_intr = genphy_no_config_intr, .handle_interrupt = genphy_handle_interrupt_no_ack,
@@ -1510,10 +1511,12 @@ static struct phy_driver mtk_socphy_driver[] = { .led_hw_is_supported = mt798x_phy_led_hw_is_supported, .led_hw_control_set = mt798x_phy_led_hw_control_set, .led_hw_control_get = mt798x_phy_led_hw_control_get, + }, }, { PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988), .name = "MediaTek MT7988 PHY", + .ops = &(const struct phy_driver_ops ){ .config_init = mt798x_phy_config_init, .config_intr = genphy_no_config_intr, .handle_interrupt = genphy_handle_interrupt_no_ack,
@@ -1527,6 +1530,7 @@ static struct phy_driver mtk_socphy_driver[] = { .led_hw_is_supported = mt798x_phy_led_hw_is_supported, .led_hw_control_set = mt798x_phy_led_hw_control_set, .led_hw_control_get = mt798x_phy_led_hw_control_get, + }, }, };
drivers/net/phy/mediatek-ge.c +4 -0
@@ -72,6 +72,7 @@ static struct phy_driver mtk_gephy_driver[] = { { PHY_ID_MATCH_EXACT(0x03a29412), .name = "MediaTek MT7530 PHY", + .ops = &(const struct phy_driver_ops ){ .config_init = mt7530_phy_config_init,/* Interrupts are handled by the switch, not the PHY * itself.
@@ -82,10 +83,12 @@ static struct phy_driver mtk_gephy_driver[] = { .resume = genphy_resume, .read_page = mtk_gephy_read_page, .write_page = mtk_gephy_write_page, + }, }, { PHY_ID_MATCH_EXACT(0x03a29441), .name = "MediaTek MT7531 PHY", + .ops = &(const struct phy_driver_ops ){ .config_init = mt7531_phy_config_init,/* Interrupts are handled by the switch, not the PHY * itself.
@@ -96,6 +99,7 @@ static struct phy_driver mtk_gephy_driver[] = { .resume = genphy_resume, .read_page = mtk_gephy_read_page, .write_page = mtk_gephy_write_page, + }, }, };
drivers/net/phy/meson-gxl.c +4 -0
@@ -190,6 +190,7 @@ static struct phy_driver meson_gxl_phy[] = { .name = "Meson GXL Internal PHY",/* PHY_BASIC_FEATURES */ .flags = PHY_IS_INTERNAL, + .ops = &(const struct phy_driver_ops ){ .soft_reset = genphy_soft_reset, .config_init = meson_gxl_config_init, .read_status = meson_gxl_read_status,
@@ -199,11 +200,13 @@ static struct phy_driver meson_gxl_phy[] = { .resume = genphy_resume, .read_mmd = genphy_read_mmd_unsupported, .write_mmd = genphy_write_mmd_unsupported, + }, }, { PHY_ID_MATCH_EXACT(0x01803301), .name = "Meson G12A Internal PHY",/* PHY_BASIC_FEATURES */ .flags = PHY_IS_INTERNAL, + .ops = &(const struct phy_driver_ops ){ .probe = smsc_phy_probe, .config_init = smsc_phy_config_init, .soft_reset = genphy_soft_reset,
@@ -218,6 +221,7 @@ static struct phy_driver meson_gxl_phy[] = { .resume = genphy_resume, .read_mmd = genphy_read_mmd_unsupported, .write_mmd = genphy_write_mmd_unsupported, + }, }, };
drivers/net/phy/micrel.c +46 -8
288 lines not on this page · raw message
drivers/net/phy/microchip.c +2 -0
@@ -384,6 +384,7 @@ static struct phy_driver microchip_phy_driver[] = { .name = "Microchip LAN88xx",/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .probe = lan88xx_probe, .remove = lan88xx_remove,
@@ -400,6 +401,7 @@ static struct phy_driver microchip_phy_driver[] = { .set_wol = lan88xx_set_wol, .read_page = lan88xx_read_page, .write_page = lan88xx_write_page, + }, } };module_phy_driver (microchip_phy_driver);
drivers/net/phy/microchip_t1.c +4 -0
@@ -866,6 +866,7 @@ static struct phy_driver microchip_t1_phy_driver[] = { .name = "Microchip LAN87xx T1", .flags = PHY_POLL_CABLE_TEST, .features = PHY_BASIC_T1_FEATURES, + .ops = &(const struct phy_driver_ops ){ .config_init = lan87xx_config_init, .config_intr = lan87xx_phy_config_intr, .handle_interrupt = lan87xx_handle_interrupt,
@@ -877,12 +878,14 @@ static struct phy_driver microchip_t1_phy_driver[] = { .get_sqi_max = lan87xx_get_sqi_max, .cable_test_start = lan87xx_cable_test_start, .cable_test_get_status = lan87xx_cable_test_get_status, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_LAN937X), .name = "Microchip LAN937x T1", .flags = PHY_POLL_CABLE_TEST, .features = PHY_BASIC_T1_FEATURES, + .ops = &(const struct phy_driver_ops ){ .config_init = lan87xx_config_init, .config_intr = lan87xx_phy_config_intr, .handle_interrupt = lan87xx_handle_interrupt,
@@ -894,6 +897,7 @@ static struct phy_driver microchip_t1_phy_driver[] = { .get_sqi_max = lan87xx_get_sqi_max, .cable_test_start = lan87xx_cable_test_start, .cable_test_get_status = lan87xx_cable_test_get_status, + }, } };
drivers/net/phy/microchip_t1s.c +4 -0
@@ -273,21 +273,25 @@ static struct phy_driver microchip_t1s_driver[] = {PHY_ID_MATCH_EXACT (PHY_ID_LAN867X_REVB1 ), .name = "LAN867X Rev.B1", .features = PHY_BASIC_T1S_P2MP_FEATURES, + .ops = &(const struct phy_driver_ops){ .config_init = lan867x_revb1_config_init, .read_status = lan86xx_read_status, .get_plca_cfg = genphy_c45_plca_get_cfg, .set_plca_cfg = genphy_c45_plca_set_cfg, .get_plca_status = genphy_c45_plca_get_status, + }, }, {PHY_ID_MATCH_EXACT (PHY_ID_LAN865X_REVB0 ), .name = "LAN865X Rev.B0 Internal Phy", .features = PHY_BASIC_T1S_P2MP_FEATURES, + .ops = &(const struct phy_driver_ops){ .config_init = lan865x_revb0_config_init, .read_status = lan86xx_read_status, .get_plca_cfg = genphy_c45_plca_get_cfg, .set_plca_cfg = genphy_c45_plca_set_cfg, .get_plca_status = genphy_c45_plca_get_status, + }, }, };
drivers/net/phy/motorcomm.c +8 -0
@@ -2256,15 +2256,18 @@ static struct phy_driver motorcomm_phy_drvs[] = { { PHY_ID_MATCH_EXACT(PHY_ID_YT8511), .name = "YT8511 Gigabit Ethernet", + .ops = &(const struct phy_driver_ops ){ .config_init = yt8511_config_init, .suspend = genphy_suspend, .resume = genphy_resume, .read_page = yt8511_read_page, .write_page = yt8511_write_page, + }, }, {PHY_ID_MATCH_EXACT (PHY_ID_YT8521 ), .name = "YT8521 Gigabit Ethernet", + .ops = &(const struct phy_driver_ops){ .get_features = yt8521_get_features, .probe = yt8521_probe, .read_page = yt8521_read_page,
@@ -2278,10 +2281,12 @@ static struct phy_driver motorcomm_phy_drvs[] = { .soft_reset = yt8521_soft_reset, .suspend = yt8521_suspend, .resume = yt8521_resume, + }, }, { PHY_ID_MATCH_EXACT(PHY_ID_YT8531), .name = "YT8531 Gigabit Ethernet", + .ops = &(const struct phy_driver_ops ){ .probe = yt8531_probe, .config_init = yt8531_config_init, .suspend = genphy_suspend,
@@ -2289,10 +2294,12 @@ static struct phy_driver motorcomm_phy_drvs[] = { .get_wol = ytphy_get_wol, .set_wol = yt8531_set_wol, .link_change_notify = yt8531_link_change_notify, + }, }, { PHY_ID_MATCH_EXACT(PHY_ID_YT8531S), .name = "YT8531S Gigabit Ethernet", + .ops = &(const struct phy_driver_ops ){ .get_features = yt8521_get_features, .probe = yt8521_probe, .read_page = yt8521_read_page,
@@ -2306,6 +2313,7 @@ static struct phy_driver motorcomm_phy_drvs[] = { .soft_reset = yt8521_soft_reset, .suspend = yt8521_suspend, .resume = yt8521_resume, + }, }, };
drivers/net/phy/mscc/mscc_main.c +30 -0
@@ -2342,6 +2342,7 @@ static struct phy_driver vsc85xx_driver[] = { .name = "Microsemi GE VSC8501 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc85xx_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2360,12 +2361,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8502, .name = "Microsemi GE VSC8502 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc85xx_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2384,12 +2387,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8504, .name = "Microsemi GE VSC8504 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2409,11 +2414,13 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8514, .name = "Microsemi GE VSC8514 SyncE", .phy_id_mask = 0xfffffff0, + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc8514_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2432,12 +2439,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8530, .name = "Microsemi FE VSC8530", .phy_id_mask = 0xfffffff0,/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc85xx_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2456,12 +2465,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8531, .name = "Microsemi VSC8531", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc85xx_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2480,12 +2491,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8540, .name = "Microsemi FE VSC8540 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc85xx_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2504,12 +2517,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8541, .name = "Microsemi VSC8541 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc85xx_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2528,12 +2543,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8552, .name = "Microsemi GE VSC8552 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2552,12 +2569,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC856X, .name = "Microsemi GE VSC856X SyncE", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2574,12 +2593,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8572, .name = "Microsemi GE VSC8572 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2599,12 +2620,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8574, .name = "Microsemi GE VSC8574 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2624,12 +2647,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8575, .name = "Microsemi GE VSC8575 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2647,12 +2672,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8582, .name = "Microsemi GE VSC8582 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2670,12 +2697,14 @@ static struct phy_driver vsc85xx_driver[] = { .get_sset_count = &vsc85xx_get_sset_count, .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, + }, }, { .phy_id = PHY_ID_VSC8584, .name = "Microsemi GE VSC8584 SyncE", .phy_id_mask = 0xfffffff0,/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = &genphy_soft_reset, .config_init = &vsc8584_config_init, .config_aneg = &vsc85xx_config_aneg,
@@ -2694,6 +2723,7 @@ static struct phy_driver vsc85xx_driver[] = { .get_strings = &vsc85xx_get_strings, .get_stats = &vsc85xx_get_stats, .link_change_notify = &vsc85xx_link_change_notify, + }, } };
drivers/net/phy/mxl-gpy.c +24 -0
@@ -813,6 +813,7 @@ static struct phy_driver gpy_drivers[] = { { PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx), .name = "Maxlinear Ethernet GPY2xx", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -826,11 +827,13 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy_loopback, + }, }, { .phy_id = PHY_ID_GPY115B, .phy_id_mask = PHY_ID_GPYx15B_MASK, .name = "Maxlinear Ethernet GPY115B", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -844,10 +847,12 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy115_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY115C), .name = "Maxlinear Ethernet GPY115C", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -861,11 +866,13 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy115_loopback, + }, }, { .phy_id = PHY_ID_GPY211B, .phy_id_mask = PHY_ID_GPY21xB_MASK, .name = "Maxlinear Ethernet GPY211B", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -879,10 +886,12 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY211C), .name = "Maxlinear Ethernet GPY211C", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -896,11 +905,13 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy_loopback, + }, }, { .phy_id = PHY_ID_GPY212B, .phy_id_mask = PHY_ID_GPY21xB_MASK, .name = "Maxlinear Ethernet GPY212B", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -914,10 +925,12 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY212C), .name = "Maxlinear Ethernet GPY212C", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -931,11 +944,13 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy_loopback, + }, }, { .phy_id = PHY_ID_GPY215B, .phy_id_mask = PHY_ID_GPYx15B_MASK, .name = "Maxlinear Ethernet GPY215B", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -949,10 +964,12 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY215C), .name = "Maxlinear Ethernet GPY215C", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -966,10 +983,12 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY241B), .name = "Maxlinear Ethernet GPY241B", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -983,10 +1002,12 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY241BM), .name = "Maxlinear Ethernet GPY241BM", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -1000,10 +1021,12 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy_loopback, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_GPY245B), .name = "Maxlinear Ethernet GPY245B", + .ops = &(const struct phy_driver_ops ){ .get_features = genphy_c45_pma_read_abilities, .config_init = gpy_config_init, .probe = gpy_probe,
@@ -1017,6 +1040,7 @@ static struct phy_driver gpy_drivers[] = { .set_wol = gpy_set_wol, .get_wol = gpy_get_wol, .set_loopback = gpy_loopback, + }, }, };module_phy_driver (gpy_drivers);
drivers/net/phy/national.c +2 -0
@@ -162,9 +162,11 @@ static struct phy_driver dp83865_driver[] = { { .phy_id_mask = 0xfffffff0, .name = "NatSemi DP83865",/* PHY_GBIT_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .config_init = ns_config_init, .config_intr = ns_config_intr, .handle_interrupt = ns_handle_interrupt, + }, } };module_phy_driver (dp83865_driver);
drivers/net/phy/ncn26000.c +2 -0
@@ -145,6 +145,7 @@ static struct phy_driver ncn26000_driver[] = { PHY_ID_MATCH_MODEL(PHY_ID_NCN26000), .name = "NCN26000", .features = PHY_BASIC_T1S_P2MP_FEATURES, + .ops = &(const struct phy_driver_ops ){ .config_init = ncn26000_config_init, .config_intr = ncn26000_config_intr, .config_aneg = ncn26000_config_aneg,
@@ -154,6 +155,7 @@ static struct phy_driver ncn26000_driver[] = { .set_plca_cfg = genphy_c45_plca_set_cfg, .get_plca_status = genphy_c45_plca_get_status, .soft_reset = genphy_soft_reset, + }, }, };
drivers/net/phy/nxp-c45-tja11xx.c +6 -2
@@ -1929,8 +1929,9 @@ static struct phy_driver nxp_c45_driver[] = { { PHY_ID_MATCH_MODEL(PHY_ID_TJA_1103), .name = "NXP C45 TJA1103", - .get_features = nxp_c45_get_features, .driver_data = &tja1103_phy_data, + .ops = &(const struct phy_driver_ops ){ + .get_features = nxp_c45_get_features, .probe = nxp_c45_probe, .soft_reset = nxp_c45_soft_reset, .config_aneg = genphy_c45_config_aneg,
@@ -1949,12 +1950,14 @@ static struct phy_driver nxp_c45_driver[] = { .get_sqi = nxp_c45_get_sqi, .get_sqi_max = nxp_c45_get_sqi_max, .remove = nxp_c45_remove, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_TJA_1120), .name = "NXP C45 TJA1120", - .get_features = nxp_c45_get_features, .driver_data = &tja1120_phy_data, + .ops = &(const struct phy_driver_ops ){ + .get_features = nxp_c45_get_features, .probe = nxp_c45_probe, .soft_reset = nxp_c45_soft_reset, .config_aneg = genphy_c45_config_aneg,
@@ -1974,6 +1977,7 @@ static struct phy_driver nxp_c45_driver[] = { .get_sqi = nxp_c45_get_sqi, .get_sqi_max = nxp_c45_get_sqi_max, .remove = nxp_c45_remove, + }, }, };
drivers/net/phy/nxp-cbtx.c +2 -0
@@ -199,6 +199,7 @@ static struct phy_driver cbtx_driver[] = { PHY_ID_MATCH_MODEL(PHY_ID_CBTX_SJA1110), .name = "NXP CBTX (SJA1110)",/* PHY_BASIC_FEATURES */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = cbtx_soft_reset, .config_init = cbtx_config_init, .suspend = genphy_suspend,
@@ -210,6 +211,7 @@ static struct phy_driver cbtx_driver[] = { .get_sset_count = cbtx_get_sset_count, .get_strings = cbtx_get_strings, .get_stats = cbtx_get_stats, + }, }, };
drivers/net/phy/nxp-tja11xx.c +12 -4
@@ -205,22 +205,22 @@ static int tja11xx_config_aneg_cable_test(struct phy_device *phydev)if (phydev->link)return 0 ; -if (!phydev->drv->cable_test_start || - !phydev->drv->cable_test_get_status) +if (!phydev->drv->ops->cable_test_start || + !phydev->drv->ops->cable_test_get_status)return 0 ; ret =ethnl_cable_test_alloc (phydev,ETHTOOL_MSG_CABLE_TEST_NTF );if (ret)return ret; - ret = phydev->drv->cable_test_start (phydev); + ret = phydev->drv->ops->cable_test_start (phydev);if (ret)return ret;/* According to the documentation this test takes 100 usec */ usleep_range (100 ,200 ); - ret = phydev->drv->cable_test_get_status (phydev, &finished); + ret = phydev->drv->ops->cable_test_get_status (phydev, &finished);if (ret)return ret;
@@ -805,6 +805,7 @@ static struct phy_driver tja11xx_driver[] = { PHY_ID_MATCH_MODEL(PHY_ID_TJA1100), .name = "NXP TJA1100", .features = PHY_BASIC_T1_FEATURES, + .ops = &(const struct phy_driver_ops ){ .probe = tja11xx_probe, .soft_reset = tja11xx_soft_reset, .config_aneg = tja11xx_config_aneg,
@@ -819,10 +820,12 @@ static struct phy_driver tja11xx_driver[] = { .get_sset_count = tja11xx_get_sset_count, .get_strings = tja11xx_get_strings, .get_stats = tja11xx_get_stats, + }, }, { PHY_ID_MATCH_MODEL(PHY_ID_TJA1101), .name = "NXP TJA1101", .features = PHY_BASIC_T1_FEATURES, + .ops = &(const struct phy_driver_ops ){ .probe = tja11xx_probe, .soft_reset = tja11xx_soft_reset, .config_aneg = tja11xx_config_aneg,
@@ -837,10 +840,12 @@ static struct phy_driver tja11xx_driver[] = { .get_sset_count = tja11xx_get_sset_count, .get_strings = tja11xx_get_strings, .get_stats = tja11xx_get_stats, + }, }, { .name = "NXP TJA1102 Port 0", .features = PHY_BASIC_T1_FEATURES, .flags = PHY_POLL_CABLE_TEST, + .ops = &(const struct phy_driver_ops ){ .probe = tja1102_p0_probe, .soft_reset = tja11xx_soft_reset, .config_aneg = tja11xx_config_aneg,
@@ -860,11 +865,13 @@ static struct phy_driver tja11xx_driver[] = { .handle_interrupt = tja11xx_handle_interrupt, .cable_test_start = tja11xx_cable_test_start, .cable_test_get_status = tja11xx_cable_test_get_status, + }, }, { .name = "NXP TJA1102 Port 1", .features = PHY_BASIC_T1_FEATURES, .flags = PHY_POLL_CABLE_TEST,/* currently no probe for Port 1 is need */ + .ops = &(const struct phy_driver_ops ){ .soft_reset = tja11xx_soft_reset, .config_aneg = tja11xx_config_aneg, .config_init = tja11xx_config_init,
@@ -883,6 +890,7 @@ static struct phy_driver tja11xx_driver[] = { .handle_interrupt = tja11xx_handle_interrupt, .cable_test_start = tja11xx_cable_test_start, .cable_test_get_status = tja11xx_cable_test_get_status, + }, } };
drivers/net/phy/phy-c45.c +2 -0
@@ -1522,5 +1522,7 @@ struct phy_driver genphy_c45_driver = { .phy_id = 0xffffffff, .phy_id_mask = 0xffffffff, .name = "Generic Clause 45 PHY", + .ops = &(const struct phy_driver_ops ){ .read_status = genphy_c45_read_status, + }, };
drivers/net/phy/phy-core.c +10 -8
@@ -576,8 +576,8 @@ int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)if (regnum > (u16 )~0 || devad >32 )return -EINVAL ; -if (phydev->drv && phydev->drv->read_mmd) -return phydev->drv->read_mmd (phydev, devad, regnum); +if (phydev->drv && phydev->drv->ops && phydev->drv->ops->read_mmd) +return phydev->drv->ops->read_mmd (phydev, devad, regnum);return mmd_phy_read (phydev->mdio.bus, phydev->mdio.addr, phydev->is_c45, devad, regnum);
@@ -620,8 +620,8 @@ int __phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val)if (regnum > (u16 )~0 || devad >32 )return -EINVAL ; -if (phydev->drv && phydev->drv->write_mmd) -return phydev->drv->write_mmd (phydev, devad, regnum, val); +if (phydev->drv && phydev->drv->ops && phydev->drv->ops->write_mmd) +return phydev->drv->ops->write_mmd (phydev, devad, regnum, val);return mmd_phy_write (phydev->mdio.bus, phydev->mdio.addr, phydev->is_c45, devad, regnum, val);
@@ -968,18 +968,20 @@ EXPORT_SYMBOL_GPL(phy_modify_mmd);static int __phy_read_page (struct phy_device *phydev) { -if (WARN_ONCE (!phydev->drv->read_page,"read_page callback not available, PHY driver not loaded?\n" )) +if (WARN_ONCE (!phydev->drv->ops || !phydev->drv->ops->read_page, +"read_page callback not available, PHY driver not loaded?\n" ))return -EOPNOTSUPP ; -return phydev->drv->read_page (phydev); +return phydev->drv->ops->read_page (phydev); }static int __phy_write_page (struct phy_device *phydev,int page) { -if (WARN_ONCE (!phydev->drv->write_page,"write_page callback not available, PHY driver not loaded?\n" )) +if (WARN_ONCE (!phydev->drv->ops || !phydev->drv->ops->write_page, +"write_page callback not available, PHY driver not loaded?\n" ))return -EOPNOTSUPP ; -return phydev->drv->write_page (phydev, page); +return phydev->drv->ops->write_page (phydev, page); }/**
drivers/net/phy/phy.c +44 -41
233 lines not on this page · raw message
drivers/net/phy/phy_device.c +41 -38
218 lines not on this page · raw message
drivers/net/phy/qcom/at803x.c +15 -3
@@ -988,6 +988,7 @@ static struct phy_driver at803x_driver[] = {PHY_ID_MATCH_EXACT (ATH8035_PHY_ID ), .name = "Qualcomm Atheros AR8035", .flags = PHY_POLL_CABLE_TEST,
Lines of this file are not shown. View the raw message.
drivers/net/phy/realtek.c +44 -2
46 lines not on this page · raw message
include/linux/phy.h +32 -25
57 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Christian,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/net-phy-detach-PHY-driver-OPs-from-phy_driver-struct/20240218-034406 base: net-next/main patch link: https://lore.kernel.org/r/20240217194116.8565-2-ansuelsmth%40gmail.com patch subject: [net-next RFC PATCH 1/3] net: phy: detach PHY driver OPs from phy_driver struct config: i386-buildonly-randconfig-002-20240219 (https://download.01.org/0day-ci/archive/20240219/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240219/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
net/ethtool/ioctl.c: In function 'ethtool_get_module_info_call':
>> net/ethtool/ioctl.c:2481:49: error: 'const struct phy_driver' has no member named 'module_info'
2481 | if (phydev && phydev->drv && phydev->drv->module_info)
| ^~
net/ethtool/ioctl.c:2482:35: error: 'const struct phy_driver' has no member named 'module_info'
2482 | return phydev->drv->module_info(phydev, modinfo);
| ^~
net/ethtool/ioctl.c: In function 'ethtool_get_module_eeprom_call':
>> net/ethtool/ioctl.c:2518:49: error: 'const struct phy_driver' has no member named 'module_eeprom'
2518 | if (phydev && phydev->drv && phydev->drv->module_eeprom)
| ^~
net/ethtool/ioctl.c:2519:35: error: 'const struct phy_driver' has no member named 'module_eeprom'
2519 | return phydev->drv->module_eeprom(phydev, ee, data);
| ^~
net/ethtool/ioctl.c: In function 'get_phy_tunable':
>> net/ethtool/ioctl.c:2762:63: error: 'const struct phy_driver' has no member named 'get_tunable'
2762 | phy_drv_tunable = phydev && phydev->drv && phydev->drv->get_tunable;
| ^~
net/ethtool/ioctl.c:2775:34: error: 'const struct phy_driver' has no member named 'get_tunable'
2775 | ret = phydev->drv->get_tunable(phydev, &tuna, data);
| ^~
net/ethtool/ioctl.c: In function 'set_phy_tunable':
net/ethtool/ioctl.c:2801:63: error: 'const struct phy_driver' has no member named 'get_tunable'
2801 | phy_drv_tunable = phydev && phydev->drv && phydev->drv->get_tunable;
| ^~
>> net/ethtool/ioctl.c:2815:34: error: 'const struct phy_driver' has no member named 'set_tunable'
2815 | ret = phydev->drv->set_tunable(phydev, &tuna, data);
| ^~
--
net/ethtool/linkstate.c: In function 'linkstate_get_sqi':
>> net/ethtool/linkstate.c:38:41: error: 'const struct phy_driver' has no member named 'get_sqi'
38 | if (!phydev->drv || !phydev->drv->get_sqi)
| ^~
net/ethtool/linkstate.c:41:34: error: 'const struct phy_driver' has no member named 'get_sqi'
41 | ret = phydev->drv->get_sqi(phydev);
| ^~
net/ethtool/linkstate.c: In function 'linkstate_get_sqi_max':
>> net/ethtool/linkstate.c:56:41: error: 'const struct phy_driver' has no member named 'get_sqi_max'
56 | if (!phydev->drv || !phydev->drv->get_sqi_max)
| ^~
net/ethtool/linkstate.c:59:34: error: 'const struct phy_driver' has no member named 'get_sqi_max'
59 | ret = phydev->drv->get_sqi_max(phydev);
| ^~vim +2481 net/ethtool/ioctl.c
c8f3a8c3106913 net/core/ethtool.c Richard Cochran 2012-04-03 2471
95dfc7effd88b4 net/ethtool/ioctl.c Andrew Lunn 2021-04-09 2472 int ethtool_get_module_info_call(struct net_device *dev,
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2473 struct ethtool_modinfo *modinfo)
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2474 {
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2475 const struct ethtool_ops *ops = dev->ethtool_ops;
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2476 struct phy_device *phydev = dev->phydev;
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2477
e679c9c1dbfdba net/core/ethtool.c Russell King 2018-03-28 2478 if (dev->sfp_bus)
e679c9c1dbfdba net/core/ethtool.c Russell King 2018-03-28 2479 return sfp_get_module_info(dev->sfp_bus, modinfo);
e679c9c1dbfdba net/core/ethtool.c Russell King 2018-03-28 2480
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 @2481 if (phydev && phydev->drv && phydev->drv->module_info)
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2482 return phydev->drv->module_info(phydev, modinfo);
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2483
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2484 if (ops->get_module_info)
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2485 return ops->get_module_info(dev, modinfo);
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2486
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2487 return -EOPNOTSUPP;
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2488 }
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2489
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2490 static int ethtool_get_module_info(struct net_device *dev,
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2491 void __user *useraddr)
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2492 {
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2493 int ret;
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2494 struct ethtool_modinfo modinfo;
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2495
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2496 if (copy_from_user(&modinfo, useraddr, sizeof(modinfo)))
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2497 return -EFAULT;
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2498
95dfc7effd88b4 net/ethtool/ioctl.c Andrew Lunn 2021-04-09 2499 ret = ethtool_get_module_info_call(dev, &modinfo);
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2500 if (ret)
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2501 return ret;
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2502
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2503 if (copy_to_user(useraddr, &modinfo, sizeof(modinfo)))
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2504 return -EFAULT;
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2505
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2506 return 0;
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2507 }
41c3cb6d20f025 net/core/ethtool.c Stuart Hodgson 2012-04-19 2508
95dfc7effd88b4 net/ethtool/ioctl.c Andrew Lunn 2021-04-09 2509 int ethtool_get_module_eeprom_call(struct net_device *dev,
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2510 struct ethtool_eeprom *ee, u8 *data)
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2511 {
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2512 const struct ethtool_ops *ops = dev->ethtool_ops;
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2513 struct phy_device *phydev = dev->phydev;
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2514
e679c9c1dbfdba net/core/ethtool.c Russell King 2018-03-28 2515 if (dev->sfp_bus)
e679c9c1dbfdba net/core/ethtool.c Russell King 2018-03-28 2516 return sfp_get_module_eeprom(dev->sfp_bus, ee, data);
e679c9c1dbfdba net/core/ethtool.c Russell King 2018-03-28 2517
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 @2518 if (phydev && phydev->drv && phydev->drv->module_eeprom)
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2519 return phydev->drv->module_eeprom(phydev, ee, data);
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2520
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2521 if (ops->get_module_eeprom)
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2522 return ops->get_module_eeprom(dev, ee, data);
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2523
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2524 return -EOPNOTSUPP;
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2525 }
2f4383667d57d1 net/core/ethtool.c Ed Swierk 2015-01-02 2526 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Christian,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/net-phy-detach-PHY-driver-OPs-from-phy_driver-struct/20240218-034406 base: net-next/main patch link: https://lore.kernel.org/r/20240217194116.8565-2-ansuelsmth%40gmail.com patch subject: [net-next RFC PATCH 1/3] net: phy: detach PHY driver OPs from phy_driver struct config: i386-buildonly-randconfig-003-20240219 (https://download.01.org/0day-ci/archive/20240219/[email protected]/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240219/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> net/ethtool/linkstate.c:38:36: error: no member named 'get_sqi' in 'struct phy_driver'
38 | if (!phydev->drv || !phydev->drv->get_sqi)
| ~~~~~~~~~~~ ^
net/ethtool/linkstate.c:41:22: error: no member named 'get_sqi' in 'struct phy_driver'
41 | ret = phydev->drv->get_sqi(phydev);
| ~~~~~~~~~~~ ^
>> net/ethtool/linkstate.c:56:36: error: no member named 'get_sqi_max' in 'struct phy_driver'
56 | if (!phydev->drv || !phydev->drv->get_sqi_max)
| ~~~~~~~~~~~ ^
net/ethtool/linkstate.c:59:22: error: no member named 'get_sqi_max' in 'struct phy_driver'
59 | ret = phydev->drv->get_sqi_max(phydev);
| ~~~~~~~~~~~ ^
4 errors generated.
--
>> net/ethtool/ioctl.c:2481:44: error: no member named 'module_info' in 'struct phy_driver'
2481 | if (phydev && phydev->drv && phydev->drv->module_info)
| ~~~~~~~~~~~ ^
net/ethtool/ioctl.c:2482:23: error: no member named 'module_info' in 'struct phy_driver'
2482 | return phydev->drv->module_info(phydev, modinfo);
| ~~~~~~~~~~~ ^
>> net/ethtool/ioctl.c:2518:44: error: no member named 'module_eeprom' in 'struct phy_driver'
2518 | if (phydev && phydev->drv && phydev->drv->module_eeprom)
| ~~~~~~~~~~~ ^
net/ethtool/ioctl.c:2519:23: error: no member named 'module_eeprom' in 'struct phy_driver'
2519 | return phydev->drv->module_eeprom(phydev, ee, data);
| ~~~~~~~~~~~ ^
>> net/ethtool/ioctl.c:2762:58: error: no member named 'get_tunable' in 'struct phy_driver'
2762 | phy_drv_tunable = phydev && phydev->drv && phydev->drv->get_tunable;
| ~~~~~~~~~~~ ^
net/ethtool/ioctl.c:2775:22: error: no member named 'get_tunable' in 'struct phy_driver'
2775 | ret = phydev->drv->get_tunable(phydev, &tuna, data);
| ~~~~~~~~~~~ ^
net/ethtool/ioctl.c:2801:58: error: no member named 'get_tunable' in 'struct phy_driver'
2801 | phy_drv_tunable = phydev && phydev->drv && phydev->drv->get_tunable;
| ~~~~~~~~~~~ ^
>> net/ethtool/ioctl.c:2815:22: error: no member named 'set_tunable' in 'struct phy_driver'
2815 | ret = phydev->drv->set_tunable(phydev, &tuna, data);
| ~~~~~~~~~~~ ^8 errors generated.
vim +38 net/ethtool/linkstate.c
3d2b847fb99cf2 Michal Kubecek 2019-12-27 28
8066021915924f Oleksij Rempel 2020-05-20 29 static int linkstate_get_sqi(struct net_device *dev)
8066021915924f Oleksij Rempel 2020-05-20 30 {
8066021915924f Oleksij Rempel 2020-05-20 31 struct phy_device *phydev = dev->phydev;
8066021915924f Oleksij Rempel 2020-05-20 32 int ret;
8066021915924f Oleksij Rempel 2020-05-20 33
8066021915924f Oleksij Rempel 2020-05-20 34 if (!phydev)
8066021915924f Oleksij Rempel 2020-05-20 35 return -EOPNOTSUPP;
8066021915924f Oleksij Rempel 2020-05-20 36
8066021915924f Oleksij Rempel 2020-05-20 37 mutex_lock(&phydev->lock);
8066021915924f Oleksij Rempel 2020-05-20 @38 if (!phydev->drv || !phydev->drv->get_sqi)
8066021915924f Oleksij Rempel 2020-05-20 39 ret = -EOPNOTSUPP;
8066021915924f Oleksij Rempel 2020-05-20 40 else
8066021915924f Oleksij Rempel 2020-05-20 41 ret = phydev->drv->get_sqi(phydev);
8066021915924f Oleksij Rempel 2020-05-20 42 mutex_unlock(&phydev->lock);
8066021915924f Oleksij Rempel 2020-05-20 43
8066021915924f Oleksij Rempel 2020-05-20 44 return ret;
8066021915924f Oleksij Rempel 2020-05-20 45 }
8066021915924f Oleksij Rempel 2020-05-20 46
8066021915924f Oleksij Rempel 2020-05-20 47 static int linkstate_get_sqi_max(struct net_device *dev)
8066021915924f Oleksij Rempel 2020-05-20 48 {
8066021915924f Oleksij Rempel 2020-05-20 49 struct phy_device *phydev = dev->phydev;
8066021915924f Oleksij Rempel 2020-05-20 50 int ret;
8066021915924f Oleksij Rempel 2020-05-20 51
8066021915924f Oleksij Rempel 2020-05-20 52 if (!phydev)
8066021915924f Oleksij Rempel 2020-05-20 53 return -EOPNOTSUPP;
8066021915924f Oleksij Rempel 2020-05-20 54
8066021915924f Oleksij Rempel 2020-05-20 55 mutex_lock(&phydev->lock);
8066021915924f Oleksij Rempel 2020-05-20 @56 if (!phydev->drv || !phydev->drv->get_sqi_max)
8066021915924f Oleksij Rempel 2020-05-20 57 ret = -EOPNOTSUPP;
8066021915924f Oleksij Rempel 2020-05-20 58 else
8066021915924f Oleksij Rempel 2020-05-20 59 ret = phydev->drv->get_sqi_max(phydev);
8066021915924f Oleksij Rempel 2020-05-20 60 mutex_unlock(&phydev->lock);
8066021915924f Oleksij Rempel 2020-05-20 61
8066021915924f Oleksij Rempel 2020-05-20 62 return ret;
ecc31c60240b98 Amit Cohen 2020-06-29 63 };
ecc31c60240b98 Amit Cohen 2020-06-29 64 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
RFC PATCH 2/3 net: phy: aquantia: use common OPs for PHYs where possible
In reply to Christian MarangiGroup common OPs for PHY, make them static and reference these statically link OPs table instead of duplicating them for each PHY.
--- drivers/net/phy/aquantia/aquantia_main.c | 207 ++++++++--------------- 1 file changed, 69 insertions(+), 138 deletions(-)
drivers/net/phy/aquantia/aquantia_main.c +69 -138
@@ -768,53 +768,14 @@ static int aqr111_config_init(struct phy_device *phydev)return aqr107_config_init (phydev); } -static struct phy_driver aqr_driver[] = { -{ -PHY_ID_MATCH_MODEL (PHY_ID_AQ1202 ), - .name ="Aquantia AQ1202" , - .ops = &(const struct phy_driver_ops ){ - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr_read_status, - }, -}, -{ -PHY_ID_MATCH_MODEL (PHY_ID_AQ2104 ), - .name ="Aquantia AQ2104" , - .ops = &(const struct phy_driver_ops ){ - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr_read_status, - }, -}, -{ -PHY_ID_MATCH_MODEL (PHY_ID_AQR105 ), - .name ="Aquantia AQR105" , - .ops = &(const struct phy_driver_ops ){ - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr_read_status, - .suspend = aqr107_suspend, - .resume = aqr107_resume, - }, -}, -{ -PHY_ID_MATCH_MODEL (PHY_ID_AQR106 ), - .name ="Aquantia AQR106" , - .ops = &(const struct phy_driver_ops ){ +static const struct phy_driver_ops aqr106_ops = { .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, - }, -}, -{ -PHY_ID_MATCH_MODEL (PHY_ID_AQR107 ), - .name ="Aquantia AQR107" , - .ops = &(const struct phy_driver_ops ){ +}; + +static const struct phy_driver_ops aqr107_ops = { .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, .config_init = aqr107_config_init,
@@ -830,15 +791,12 @@ static struct phy_driver aqr_driver[] = { .get_strings = aqr107_get_strings, .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, - }, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), - .name = "Aquantia AQCS109", - .ops = &(const struct phy_driver_ops ){ +}; + +static const struct phy_driver_ops aqr111_ops = { .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, - .config_init = aqcs109_config_init, + .config_init = aqr111_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt,
@@ -851,36 +809,66 @@ static struct phy_driver aqr_driver[] = { .get_strings = aqr107_get_strings, .get_stats = aqr107_get_stats, .link_change_notify = aqr107_link_change_notify, - }, +}; + +static const struct phy_driver_ops aqr113_ops = { + .probe = aqr107_probe, + .get_rate_matching = aqr107_get_rate_matching, + .config_init = aqr113c_config_init, + .config_aneg = aqr_config_aneg, + .config_intr = aqr_config_intr, + .handle_interrupt = aqr_handle_interrupt, + .read_status = aqr107_read_status, + .get_tunable = aqr107_get_tunable, + .set_tunable = aqr107_set_tunable, + .suspend = aqr107_suspend, + .resume = aqr107_resume, + .get_sset_count = aqr107_get_sset_count, + .get_strings = aqr107_get_strings, + .get_stats = aqr107_get_stats, + .link_change_notify = aqr107_link_change_notify, +}; + +static struct phy_driver aqr_driver[] = { +{ +PHY_ID_MATCH_MODEL (PHY_ID_AQ1202 ), + .name ="Aquantia AQ1202" , + .ops = &aqr106_ops, }, { - PHY_ID_MATCH_MODEL(PHY_ID_AQR111), - .name = "Aquantia AQR111", +PHY_ID_MATCH_MODEL (PHY_ID_AQ2104 ), + .name ="Aquantia AQ2104" , + .ops = &aqr106_ops, +}, +{ +PHY_ID_MATCH_MODEL (PHY_ID_AQR105 ), + .name ="Aquantia AQR105" , .ops = &(const struct phy_driver_ops ){ - .probe = aqr107_probe, - .get_rate_matching = aqr107_get_rate_matching, - .config_init = aqr111_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr107_read_status, - .get_tunable = aqr107_get_tunable, - .set_tunable = aqr107_set_tunable, + .read_status = aqr_read_status, .suspend = aqr107_suspend, .resume = aqr107_resume, - .get_sset_count = aqr107_get_sset_count, - .get_strings = aqr107_get_strings, - .get_stats = aqr107_get_stats, - .link_change_notify = aqr107_link_change_notify, }, }, { -PHY_ID_MATCH_MODEL (PHY_ID_AQR111B0 ), - .name = "Aquantia AQR111B0", +PHY_ID_MATCH_MODEL (PHY_ID_AQR106 ), + .name ="Aquantia AQR106" , + .ops = &aqr106_ops, +}, +{ +PHY_ID_MATCH_MODEL (PHY_ID_AQR107 ), + .name ="Aquantia AQR107" , + .ops = &aqr107_ops, +}, +{ +PHY_ID_MATCH_MODEL (PHY_ID_AQCS109 ), + .name ="Aquantia AQCS109" , .ops = &(const struct phy_driver_ops ){ .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, - .config_init = aqr111_config_init, + .config_init = aqcs109_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt,
@@ -895,97 +883,40 @@ static struct phy_driver aqr_driver[] = { .link_change_notify = aqr107_link_change_notify, }, }, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR111), + .name = "Aquantia AQR111", + .ops = &aqr111_ops, +}, +{ +PHY_ID_MATCH_MODEL (PHY_ID_AQR111B0 ), + .name = "Aquantia AQR111B0", + .ops = &aqr111_ops, +}, {PHY_ID_MATCH_MODEL (PHY_ID_AQR405 ), .name = "Aquantia AQR405", - .ops = &(const struct phy_driver_ops ){ - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr_read_status, - }, + .ops = &aqr106_ops, }, {PHY_ID_MATCH_MODEL (PHY_ID_AQR112 ), .name = "Aquantia AQR112", - .ops = &(const struct phy_driver_ops){ - .probe = aqr107_probe, - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .get_tunable = aqr107_get_tunable, - .set_tunable = aqr107_set_tunable, - .suspend = aqr107_suspend, - .resume = aqr107_resume, - .read_status = aqr107_read_status, - .get_rate_matching = aqr107_get_rate_matching, - .get_sset_count = aqr107_get_sset_count, - .get_strings = aqr107_get_strings, - .get_stats = aqr107_get_stats, - .link_change_notify = aqr107_link_change_notify, - }, + .ops = &aqr107_ops, }, {PHY_ID_MATCH_MODEL (PHY_ID_AQR412 ), .name = "Aquantia AQR412", - .ops = &(const struct phy_driver_ops){ - .probe = aqr107_probe, - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .get_tunable = aqr107_get_tunable, - .set_tunable = aqr107_set_tunable, - .suspend = aqr107_suspend, - .resume = aqr107_resume, - .read_status = aqr107_read_status, - .get_rate_matching = aqr107_get_rate_matching, - .get_sset_count = aqr107_get_sset_count, - .get_strings = aqr107_get_strings, - .get_stats = aqr107_get_stats, - .link_change_notify = aqr107_link_change_notify, - }, + .ops = &aqr107_ops, }, {PHY_ID_MATCH_MODEL (PHY_ID_AQR113 ), .name = "Aquantia AQR113", - .ops = &(const struct phy_driver_ops){ - .probe = aqr107_probe, - .get_rate_matching = aqr107_get_rate_matching, - .config_init = aqr113c_config_init, - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr107_read_status, - .get_tunable = aqr107_get_tunable, - .set_tunable = aqr107_set_tunable, - .suspend = aqr107_suspend, - .resume = aqr107_resume, - .get_sset_count = aqr107_get_sset_count, - .get_strings = aqr107_get_strings, - .get_stats = aqr107_get_stats, - .link_change_notify = aqr107_link_change_notify, - }, + .ops = &aqr113_ops, }, {PHY_ID_MATCH_MODEL (PHY_ID_AQR113C ), .name = "Aquantia AQR113C", - .ops = &(const struct phy_driver_ops){ - .probe = aqr107_probe, - .get_rate_matching = aqr107_get_rate_matching, - .config_init = aqr113c_config_init, - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr107_read_status, - .get_tunable = aqr107_get_tunable, - .set_tunable = aqr107_set_tunable, - .suspend = aqr107_suspend, - .resume = aqr107_resume, - .get_sset_count = aqr107_get_sset_count, - .get_strings = aqr107_get_strings, - .get_stats = aqr107_get_stats, - .link_change_notify = aqr107_link_change_notify, - }, + .ops = &aqr113_ops, }, };
Signature · 1 line
2.43.0
RFC PATCH 3/3 net: phy: bcm7xxx: use common OPs for PHYs where possible
In reply to Christian MarangiGroup common OPs for PHY, make them static and reference these statically link OPs table instead of duplicating them for each PHY.
--- drivers/net/phy/bcm7xxx.c | 80 +++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 36 deletions(-)
drivers/net/phy/bcm7xxx.c +44 -36
@@ -840,6 +840,17 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev)return ret; } +static const struct phy_driver_ops bcm7xxx_28nm_gpy_ops = { + .config_init = bcm7xxx_28nm_config_init, + .resume = bcm7xxx_28nm_resume, + .get_tunable = bcm7xxx_28nm_get_tunable, + .set_tunable = bcm7xxx_28nm_set_tunable, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm7xxx_28nm_get_phy_stats, + .probe = bcm7xxx_28nm_probe, +}; +#define BCM7XXX_28NM_GPHY (_oui, _name) \ { \ .phy_id = (_oui), \
@@ -847,18 +858,20 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name = _name, \ /* PHY_GBIT_FEATURES */ \ .flags = PHY_IS_INTERNAL, \ - .ops = &(const struct phy_driver_ops ){ \ - .config_init = bcm7xxx_28nm_config_init, \ - .resume = bcm7xxx_28nm_resume, \ - .get_tunable = bcm7xxx_28nm_get_tunable, \ - .set_tunable = bcm7xxx_28nm_set_tunable, \ - .get_sset_count = bcm_phy_get_sset_count, \ - .get_strings = bcm_phy_get_strings, \ - .get_stats = bcm7xxx_28nm_get_phy_stats, \ - .probe = bcm7xxx_28nm_probe, \ - }, \ + .ops = &bcm7xxx_28nm_gpy_ops, \ } +static const struct phy_driver_ops bcm7xxx_28nm_ephy_ops = { + .config_init = bcm7xxx_28nm_ephy_config_init, + .resume = bcm7xxx_28nm_ephy_resume, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm7xxx_28nm_get_phy_stats, + .probe = bcm7xxx_28nm_probe, + .read_mmd = bcm7xxx_28nm_ephy_read_mmd, + .write_mmd = bcm7xxx_28nm_ephy_write_mmd, +}; +#define BCM7XXX_28NM_EPHY (_oui, _name) \ { \ .phy_id = (_oui), \
@@ -866,18 +879,16 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name = _name, \ /* PHY_BASIC_FEATURES */ \ .flags = PHY_IS_INTERNAL, \ - .ops = &(const struct phy_driver_ops ){ \ - .config_init = bcm7xxx_28nm_ephy_config_init, \ - .resume = bcm7xxx_28nm_ephy_resume, \ - .get_sset_count = bcm_phy_get_sset_count, \ - .get_strings = bcm_phy_get_strings, \ - .get_stats = bcm7xxx_28nm_get_phy_stats, \ - .probe = bcm7xxx_28nm_probe, \ - .read_mmd = bcm7xxx_28nm_ephy_read_mmd, \ - .write_mmd = bcm7xxx_28nm_ephy_write_mmd, \ - }, \ + .ops = &bcm7xxx_28nm_ephy_ops, \ } +static const struct phy_driver_ops bcm7xxx_40nm_ephy_ops = { + .soft_reset = genphy_soft_reset, + .config_init = bcm7xxx_config_init, + .suspend = bcm7xxx_suspend, + .resume = bcm7xxx_config_init, +}; +#define BCM7XXX_40NM_EPHY (_oui, _name) \ { \ .phy_id = (_oui), \
@@ -885,14 +896,20 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name = _name, \ /* PHY_BASIC_FEATURES */ \ .flags = PHY_IS_INTERNAL, \ - .ops = &(const struct phy_driver_ops){ \ - .soft_reset = genphy_soft_reset, \ - .config_init = bcm7xxx_config_init, \ - .suspend = bcm7xxx_suspend, \ - .resume = bcm7xxx_config_init, \ - }, \ + .ops = &bcm7xxx_40nm_ephy_ops, \ } +static const struct phy_driver_ops bcm7xxx_16nm_ephy_ops = { + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm7xxx_28nm_get_phy_stats, + .probe = bcm7xxx_28nm_probe, + .config_init = bcm7xxx_16nm_ephy_config_init, + .config_aneg = genphy_config_aneg, + .read_status = genphy_read_status, + .resume = bcm7xxx_16nm_ephy_resume, +}; +#define BCM7XXX_16NM_EPHY (_oui, _name) \ { \ .phy_id = (_oui), \
@@ -900,16 +917,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .name = _name, \ /* PHY_BASIC_FEATURES */ \ .flags = PHY_IS_INTERNAL, \ - .ops = &(const struct phy_driver_ops){ \ - .get_sset_count = bcm_phy_get_sset_count, \ - .get_strings = bcm_phy_get_strings, \ - .get_stats = bcm7xxx_28nm_get_phy_stats, \ - .probe = bcm7xxx_28nm_probe, \ - .config_init = bcm7xxx_16nm_ephy_config_init, \ - .config_aneg = genphy_config_aneg, \ - .read_status = genphy_read_status, \ - .resume = bcm7xxx_16nm_ephy_resume, \ - }, \ + .ops = &bcm7xxx_16nm_ephy_ops, \ }static struct phy_driver bcm7xxx_driver[] = {
Signature · 1 line
2.43.0
Russell King (Oracle)
maintainerQuoted 23 lines · Christian Marangi
Posting as RFC due to the massive change to a fundamental struct.
While adding some PHY ID for Aquantia, I notice that there is a big problem with duplicating OPs with each PHY.
The original idea to prevent this was to use mask on the PHY ID and identify PHY Family. Problem is that OEM started to use all kind of PHY ID and this is not doable, hence for PHY that have the same OPs, we have to duplicate all of them.
This is present in Aquantia PHY, but is much more present in other PHY, especially in the BCM7XXX where they use a big macro for common PHYs.
To reduce patch delta, I added the additional variable without adding tabs as this would have resulted in a massive patch. Also to have patch bisectable, this change has to be in one go hence I had to use this trick to reduce patch delta.
Other solution to this problem were to introduce additional variables to
phy_driverstruct but that would have resulted in having 2 different way to do the same thing and that is not O.K.
Quoted 7 lines
I took care to compile-test all the PHY, only exception is the unique RUST driver, where I still have to learn that funny language and I didn't had time to update it, so that is the only driver that I think require some fixup.
I posted 2 example that would benefits from this change, but I can find much more in other PHY driver.
Would it make more sense instead of this big churn, to instead introduce into struct phy_driver:
struct mdio_device_id *ids;
which would then allow a phy_driver structure to be matched by several device IDs?
We then would not need to touch any of the existing drivers initially, and a later cleanup could be to identify those where all the ops are the same for several phy_driver structures, and convert them over.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Quoted 32 lines · Russell King (Oracle)
Quoted 23 lines · Christian Marangi
Posting as RFC due to the massive change to a fundamental struct.
While adding some PHY ID for Aquantia, I notice that there is a big problem with duplicating OPs with each PHY.
The original idea to prevent this was to use mask on the PHY ID and identify PHY Family. Problem is that OEM started to use all kind of PHY ID and this is not doable, hence for PHY that have the same OPs, we have to duplicate all of them.
This is present in Aquantia PHY, but is much more present in other PHY, especially in the BCM7XXX where they use a big macro for common PHYs.
To reduce patch delta, I added the additional variable without adding tabs as this would have resulted in a massive patch. Also to have patch bisectable, this change has to be in one go hence I had to use this trick to reduce patch delta.
Other solution to this problem were to introduce additional variables to
phy_driverstruct but that would have resulted in having 2 different way to do the same thing and that is not O.K.Quoted 7 lines
I took care to compile-test all the PHY, only exception is the unique RUST driver, where I still have to learn that funny language and I didn't had time to update it, so that is the only driver that I think require some fixup.
I posted 2 example that would benefits from this change, but I can find much more in other PHY driver.
Quoted 7 lines
Would it make more sense instead of this big churn, to instead introduce into struct
phy_driver:struct mdio_device_id *ids;which would then allow a
phy_driverstructure to be matched by several device IDs?
Yes that was an alternative idea, but is it good to then have 2 way to declare PHY ID?
Also the name should be changed... Maybe an array of a struct PHY_ID, name that ends with a sentinel?
Quoted 4 lines
We then would not need to touch any of the existing drivers initially, and a later cleanup could be to identify those where all the ops are the same for several
phy_driverstructures, and convert them over.
We have many PHY that already have macro to define the same OPs and change only name PHY ID and mask.
Signature · 1 line
Ansuel
Russell King (Oracle)
maintainerQuoted 6 lines · Christian Marangi
Quoted 5 lines · Russell King (Oracle)
Would it make more sense instead of this big churn, to instead introduce into struct
phy_driver:struct mdio_device_id *ids;
Quoted 8 lines
Quoted 2 lines
which would then allow a
phy_driverstructure to be matched by several device IDs?Yes that was an alternative idea, but is it good to then have 2 way to declare PHY ID?
Also the name should be changed... Maybe an array of a struct
PHY_ID, name that ends with a sentinel?
We already have arrays of mdio_device_id in every driver, whether they can be re-used or not is a separate issue. In any case, merely adding support for this (only build tested patch below) is a much smaller change.
drivers/net/phy/phy_device.c | 64 +++++++++++++++++++++++++++++++++----------- include/linux/phy.h | 16 ++++++++++- 2 files changed, 63 insertions(+), 17 deletions(-)
drivers/net/phy/phy_device.c +48 -16
@@ -522,12 +522,51 @@ static int phy_scan_fixups(struct phy_device *phydev)return 0 ; } +static const struct mdio_device_id * +phy_driver_match_id (struct phy_driver *phydrv,u32 id) +{ +const struct mdio_device_id *ids = phydrv->ids; + +if (ids) { +while (ids->phy_id) { +if (phy_id_compare (id, ids->phy_id, ids->phy_id_mask)) +return ids; + ids++; + } + } + +if (phy_id_compare (id, phydrv->id.phy_id, phydrv->id.phy_id_mask)) +return &phydrv->id; + +return NULL ; +} + +static const struct mdio_device_id * +phy_driver_match (struct phy_driver *phydrv,struct phy_device *phydev) +{ +const int num_ids =ARRAY_SIZE (phydev->c45_ids.device_ids); +const struct mdio_device_id *id; +int i; + +if (!phydev->is_c45) +return phy_driver_match_id (phydrv, phydev->phy_id); + +for (i =1 ; i < num_ids; i++) { +if (phydev->c45_ids.device_ids[i] ==0xffffffff ) +continue ; + + id =phy_driver_match_id (phydrv, phydev->c45_ids.device_ids[i]); +if (id) +return id; + } + +return NULL ; +} +static int phy_bus_match (struct device *dev,struct device_driver *drv) {struct phy_device *phydev =to_phy_device (dev);struct phy_driver *phydrv =to_phy_driver (drv); -const int num_ids =ARRAY_SIZE (phydev->c45_ids.device_ids); -int i;if (!(phydrv->mdiodrv.flags &MDIO_DEVICE_IS_PHY ))return 0 ;
@@ -535,20 +574,7 @@ static int phy_bus_match(struct device *dev, struct device_driver *drv)if (phydrv->match_phy_device)return phydrv->match_phy_device (phydev); -if (phydev->is_c45) { -for (i =1 ; i < num_ids; i++) { -if (phydev->c45_ids.device_ids[i] ==0xffffffff ) -continue ; - -if (phy_id_compare (phydev->c45_ids.device_ids[i], - phydrv->phy_id, phydrv->phy_id_mask)) -return 1 ; - } -return 0 ; - }else { -return phy_id_compare (phydev->phy_id, phydrv->phy_id, - phydrv->phy_id_mask); - } +return !!phy_driver_match (phydrv, phydev); } static ssize_t
@@ -3311,6 +3337,7 @@ static int phy_probe(struct device *dev)int err =0 ; phydev->drv = phydrv; + phydev->drv_id =phy_driver_match (phydrv, phydev);/* Disable the interrupt if the PHY doesn't support it * but the interrupt is still a valid one
@@ -3485,6 +3512,11 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner) new_driver->mdiodrv.driver.owner = owner; new_driver->mdiodrv.driver.probe_type =PROBE_FORCE_SYNCHRONOUS ; +if (!new_driver->id.phy_id) { + new_driver->id.phy_id = new_driver->phy_id; + new_driver->id.phy_id_mask = new_driver->phy_id_mask; + } + retval =driver_register (&new_driver->mdiodrv.driver);if (retval) { pr_err("%s: Error %d in registering driver\n",
include/linux/phy.h +15 -1
@@ -542,6 +542,7 @@ struct macsec_ops;* * @mdio: MDIO bus this PHY is on * @drv: Pointer to the driver for this PHY instance +* @drv_id: The matched driver ID for this PHY instance * @devlink: Create a link between phy dev and mac dev, if the external phy * used by current mac interface is managed by another mac interface. * @phy_id: UID for this device found during discovery
@@ -639,6 +640,7 @@ struct phy_device {/* Information about the PHY type */ /* And management functions */ const struct phy_driver *drv; +const struct mdio_device_id *drv_id;struct device_link *devlink;
@@ -882,6 +884,9 @@ struct phy_led {* struct phy_driver - Driver structure for a particular PHY type * * @mdiodrv: Data common to all MDIO devices +* @ids: array of mdio device IDs to match this driver (terminated with +* zero phy_id) +* @id: mdio device ID to match * @phy_id: The result of reading the UID registers of this PHY * type, and ANDing them with the phy_id_mask. This driver * only works for PHYs with IDs which match this field
@@ -903,6 +908,8 @@ struct phy_led {*/ struct phy_driver {struct mdio_driver_common mdiodrv; +const struct mdio_device_id *ids; +struct mdio_device_id id;u32 phy_id;char *name;u32 phy_id_mask;
@@ -1203,7 +1210,14 @@ static inline bool phy_id_compare(u32 id1, u32 id2, u32 mask)*/ static inline bool phydev_id_compare (struct phy_device *phydev,u32 id) { -return phy_id_compare (id, phydev->phy_id, phydev->drv->phy_id_mask); +u32 mask; + +if (phydev->drv_id) + mask = phydev->drv_id->phy_id_mask; +else + mask = phydev->drv->phy_id_mask; + +return phy_id_compare (id, phydev->phy_id, mask); }/* A Structure for boards to register fixups with the PHY Lib */
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Andrew Lunn
maintainerQuoted 10 lines · Christian Marangi
Posting as RFC due to the massive change to a fundamental struct.
While adding some PHY ID for Aquantia, I notice that there is a big problem with duplicating OPs with each PHY.
The original idea to prevent this was to use mask on the PHY ID and identify PHY Family. Problem is that OEM started to use all kind of PHY ID and this is not doable, hence for PHY that have the same OPs, we have to duplicate all of them.
Quoted 8 lines
This is present in Aquantia PHY, but is much more present in other PHY, especially in the BCM7XXX where they use a big macro for common PHYs.
To reduce patch delta, I added the additional variable without adding tabs as this would have resulted in a massive patch. Also to have patch bisectable, this change has to be in one go hence I had to use this trick to reduce patch delta.
To me, this makes the code look ugly. I also expect many text editors which understand indentation will be unhappy, saying the indentation is wrong.
Quoted 1 line
64 files changed, 737 insertions(+), 291 deletions(-)
These statistics are not good. If you had deleted more lines than you added, then maybe it might be an O.K. idea.
Sometimes KISS is best.
Andrew
Quoted 15 lines · Andrew Lunn
Quoted 14 lines · Christian Marangi
Posting as RFC due to the massive change to a fundamental struct.
While adding some PHY ID for Aquantia, I notice that there is a big problem with duplicating OPs with each PHY.
The original idea to prevent this was to use mask on the PHY ID and identify PHY Family. Problem is that OEM started to use all kind of PHY ID and this is not doable, hence for PHY that have the same OPs, we have to duplicate all of them.
This is present in Aquantia PHY, but is much more present in other PHY, especially in the BCM7XXX where they use a big macro for common PHYs.
Quoted 9 lines
Quoted 4 lines
To reduce patch delta, I added the additional variable without adding tabs as this would have resulted in a massive patch. Also to have patch bisectable, this change has to be in one go hence I had to use this trick to reduce patch delta.
To me, this makes the code look ugly. I also expect many text editors which understand indentation will be unhappy, saying the indentation is wrong.
Yes, it was done to limit the patch delta, if I had to account for the tab for each new section we would be in the order of 2000+ changes I think.
Quoted 7 lines
Quoted 1 line
64 files changed, 737 insertions(+), 291 deletions(-)These statistics are not good. If you had deleted more lines than you added, then maybe it might be an O.K. idea.
Sometimes KISS is best.
Well IMHO these stats are a bit flawed, the additional code is really just extra check if ops is defined and the new .ops variable in each phy_driver.
If you check patch 2 and 3 you can already see some code is removed. Also while minimal the final .o produced results in bcm7xxx going from 53kb to 45kb and the aquantia driver from 48kb to 45kb.
I understand that this major rework might be too much, so I think the only way to handle this is with introducing support for declaring multiple PHY ID for one phy_driver struct.
Signature · 1 line
Ansuel
Andrew Lunn
maintainerQuoted 9 lines
Yes, it was done to limit the patch delta, if I had to account for the tab for each new section we would be in the order of 2000+ changes I think.
Quoted 5 lines
Quoted 1 line
64 files changed, 737 insertions(+), 291 deletions(-)These statistics are not good. If you had deleted more lines than you added, then maybe it might be an O.K. idea.
Quoted 8 lines
Quoted 2 lines
Sometimes KISS is best.
Well IMHO these stats are a bit flawed, the additional code is really just extra check if ops is defined and the new .ops variable in each
phy_driver.If you check patch 2 and 3 you can already see some code is removed.
Yes, the problem is, it probably needs another 50 patches to remove all the duplication. I have to question, is that really going to happen? Are you going to keep working on this until every driver has its duplicates removed?
It probably needs some tooling to help. Something which can decode the object file, and tell you which ops structures are identical. That can then guide you when editing all the PHY drivers.
Andrew
Trevor Gross
reviewerQuoted 5 lines · Christian Marangi
I took care to compile-test all the PHY, only exception is the unique RUST driver, where I still have to learn that funny language and I didn't had time to update it, so that is the only driver that I think require some fixup.
This will only need an update in the abstraction at rust/kernel/net/phy.rs, roughly (untested)
@@ -5,15 +5,22 @@ pub const fn create_phy_driver<T: Driver>() -> DriverV
flags: T::FLAGS,
phy_id: T::PHY_DEVICE_ID.id,
phy_id_mask: T::PHY_DEVICE_ID.mask_as_int(),- soft_reset: if T::HAS_SOFT_RESET {
- Some(Adapter::<T>::soft_reset_callback)
- } else {
- None
+ phy_driver_ops: &bindings::phy_driver_ops {
+ soft_reset: if T::HAS_SOFT_RESET {
+ Some(Adapter::<T>::soft_reset_callback)
+ } else {
+ None
+ },
+ get_features: if T::HAS_GET_FEATURES {
+ Some(Adapter::<T>::get_features_callback)
+ } else {
+ None
+ },
+ // ... Other fields now in phy_driver_ops
+
+ // SAFETY: The rest is zeroed out to finalize `struct
phy_driver_ops`,
+ // which expects null function pointers for unused fields
+ ..unsafe {
core::mem::MaybeUninit::<bindings::phy_driver_ops>::zeroed().assume_init() }
},
- get_features: if T::HAS_GET_FEATURES {
- Some(Adapter::<T>::get_features_callback)
- } else {
- None
- },
}))
}
We can send a patch if needed once this series moves out of RFC.
- Trevor