From d7bed825ba1264ab2244be5b547d7feedfacf811 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Sat, 2 Mar 2019 17:10:00 +0100 Subject: net: phy: use genphy_c45_aneg_done in genphy_aneg_done Now that we have it let's use genphy_c45_aneg_done() in phy_aneg_done(). Signed-off-by: Heiner Kallweit Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller --- drivers/net/phy/phy.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 69dc64a4dbf8..3745220c5c98 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -144,14 +144,10 @@ int phy_aneg_done(struct phy_device *phydev) { if (phydev->drv && phydev->drv->aneg_done) return phydev->drv->aneg_done(phydev); - - /* Avoid genphy_aneg_done() if the Clause 45 PHY does not - * implement Clause 22 registers - */ - if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0))) - return -EINVAL; - - return genphy_aneg_done(phydev); + else if (phydev->is_c45) + return genphy_c45_aneg_done(phydev); + else + return genphy_aneg_done(phydev); } EXPORT_SYMBOL(phy_aneg_done); -- cgit v1.2.3-59-g8ed1b From a6d0aa97f453cc1a13ba93428590ef4fd29d005a Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Sat, 2 Mar 2019 17:10:36 +0100 Subject: net: phy: remove gen10g_suspend and gen10g_resume phy_suspend() and phy_resume() are no-ops anyway if no callback is defined. Therefore we don't need these stubs. Signed-off-by: Heiner Kallweit Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller --- drivers/net/phy/phy-c45.c | 14 -------------- include/linux/phy.h | 2 -- 2 files changed, 16 deletions(-) diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index 49e7cd08b05f..3ddbb9c32dda 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -529,18 +529,6 @@ int gen10g_config_init(struct phy_device *phydev) } EXPORT_SYMBOL_GPL(gen10g_config_init); -int gen10g_suspend(struct phy_device *phydev) -{ - return 0; -} -EXPORT_SYMBOL_GPL(gen10g_suspend); - -int gen10g_resume(struct phy_device *phydev) -{ - return 0; -} -EXPORT_SYMBOL_GPL(gen10g_resume); - struct phy_driver genphy_10g_driver = { .phy_id = 0xffffffff, .phy_id_mask = 0xffffffff, @@ -550,6 +538,4 @@ struct phy_driver genphy_10g_driver = { .features = PHY_10GBIT_FEATURES, .config_aneg = gen10g_config_aneg, .read_status = gen10g_read_status, - .suspend = gen10g_suspend, - .resume = gen10g_resume, }; diff --git a/include/linux/phy.h b/include/linux/phy.h index bfe60e2a5174..c69de3b87e87 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1122,8 +1122,6 @@ int gen10g_config_aneg(struct phy_device *phydev); int gen10g_read_status(struct phy_device *phydev); int gen10g_no_soft_reset(struct phy_device *phydev); int gen10g_config_init(struct phy_device *phydev); -int gen10g_suspend(struct phy_device *phydev); -int gen10g_resume(struct phy_device *phydev); static inline int phy_read_status(struct phy_device *phydev) { -- cgit v1.2.3-59-g8ed1b From c5e91d39427d1759d6205599e145553b5b2bc19e Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Sat, 2 Mar 2019 17:11:40 +0100 Subject: net: phy: remove gen10g_config_init ETHTOOL_LINK_MODE_10000baseT_Full_BIT is set anyway in the supported and advertising bitmap because it's part of PHY_10GBIT_FEATURES. And all users of gen10g_config_init use PHY_10GBIT_FEATURES. Signed-off-by: Heiner Kallweit Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller --- drivers/net/phy/cortina.c | 1 - drivers/net/phy/phy-c45.c | 14 -------------- drivers/net/phy/teranetics.c | 1 - include/linux/phy.h | 1 - 4 files changed, 17 deletions(-) diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c index c291dc014769..a64eb211cc56 100644 --- a/drivers/net/phy/cortina.c +++ b/drivers/net/phy/cortina.c @@ -80,7 +80,6 @@ static struct phy_driver cortina_driver[] = { .phy_id_mask = 0xffffffff, .name = "Cortina CS4340", .features = PHY_10GBIT_FEATURES, - .config_init = gen10g_config_init, .config_aneg = gen10g_config_aneg, .read_status = cortina_read_status, .soft_reset = gen10g_no_soft_reset, diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index 3ddbb9c32dda..cdbcea8609df 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -516,25 +516,11 @@ int gen10g_no_soft_reset(struct phy_device *phydev) } EXPORT_SYMBOL_GPL(gen10g_no_soft_reset); -int gen10g_config_init(struct phy_device *phydev) -{ - /* Temporarily just say we support everything */ - linkmode_zero(phydev->supported); - - linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, - phydev->supported); - linkmode_copy(phydev->advertising, phydev->supported); - - return 0; -} -EXPORT_SYMBOL_GPL(gen10g_config_init); - struct phy_driver genphy_10g_driver = { .phy_id = 0xffffffff, .phy_id_mask = 0xffffffff, .name = "Generic 10G PHY", .soft_reset = gen10g_no_soft_reset, - .config_init = gen10g_config_init, .features = PHY_10GBIT_FEATURES, .config_aneg = gen10g_config_aneg, .read_status = gen10g_read_status, diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c index 145c328b00fa..95280212d5d5 100644 --- a/drivers/net/phy/teranetics.c +++ b/drivers/net/phy/teranetics.c @@ -80,7 +80,6 @@ static struct phy_driver teranetics_driver[] = { .features = PHY_10GBIT_FEATURES, .soft_reset = gen10g_no_soft_reset, .aneg_done = teranetics_aneg_done, - .config_init = gen10g_config_init, .config_aneg = gen10g_config_aneg, .read_status = teranetics_read_status, .match_phy_device = teranetics_match_phy_device, diff --git a/include/linux/phy.h b/include/linux/phy.h index c69de3b87e87..817c8453aeb5 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1121,7 +1121,6 @@ int genphy_c45_read_status(struct phy_device *phydev); int gen10g_config_aneg(struct phy_device *phydev); int gen10g_read_status(struct phy_device *phydev); int gen10g_no_soft_reset(struct phy_device *phydev); -int gen10g_config_init(struct phy_device *phydev); static inline int phy_read_status(struct phy_device *phydev) { -- cgit v1.2.3-59-g8ed1b From d81210c25e17b5cca71138f3990ed8071d510ba9 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Sat, 2 Mar 2019 17:15:56 +0100 Subject: net: phy: don't export gen10g_read_status gen10g_read_status is deprecated, therefore stop exporting it. We don't want to encourage anybody to use it. Signed-off-by: Heiner Kallweit Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller --- drivers/net/phy/phy-c45.c | 3 +-- include/linux/phy.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index cdbcea8609df..6cd4bd5e9e43 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -499,7 +499,7 @@ int gen10g_config_aneg(struct phy_device *phydev) } EXPORT_SYMBOL_GPL(gen10g_config_aneg); -int gen10g_read_status(struct phy_device *phydev) +static int gen10g_read_status(struct phy_device *phydev) { /* For now just lie and say it's 10G all the time */ phydev->speed = SPEED_10000; @@ -507,7 +507,6 @@ int gen10g_read_status(struct phy_device *phydev) return genphy_c45_read_link(phydev); } -EXPORT_SYMBOL_GPL(gen10g_read_status); int gen10g_no_soft_reset(struct phy_device *phydev) { diff --git a/include/linux/phy.h b/include/linux/phy.h index 817c8453aeb5..60794240141f 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1119,7 +1119,6 @@ int genphy_c45_read_status(struct phy_device *phydev); /* The gen10g_* functions are the old Clause 45 stub */ int gen10g_config_aneg(struct phy_device *phydev); -int gen10g_read_status(struct phy_device *phydev); int gen10g_no_soft_reset(struct phy_device *phydev); static inline int phy_read_status(struct phy_device *phydev) -- cgit v1.2.3-59-g8ed1b From 7be3ad848f77eba893bd08b97e7383e8d5e873ac Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Sat, 2 Mar 2019 17:13:11 +0100 Subject: net: phy: remove gen10g_no_soft_reset genphy_no_soft_reset and gen10g_no_soft_reset are both the same no-ops, one is enough. Signed-off-by: Heiner Kallweit Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller --- drivers/net/phy/cortina.c | 2 +- drivers/net/phy/marvell10g.c | 4 ++-- drivers/net/phy/phy-c45.c | 9 +-------- drivers/net/phy/teranetics.c | 2 +- include/linux/phy.h | 1 - 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c index a64eb211cc56..856cdc36aacd 100644 --- a/drivers/net/phy/cortina.c +++ b/drivers/net/phy/cortina.c @@ -82,7 +82,7 @@ static struct phy_driver cortina_driver[] = { .features = PHY_10GBIT_FEATURES, .config_aneg = gen10g_config_aneg, .read_status = cortina_read_status, - .soft_reset = gen10g_no_soft_reset, + .soft_reset = genphy_no_soft_reset, .probe = cortina_probe, }, }; diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 79106e70010f..100b401b1f4a 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -459,7 +459,7 @@ static struct phy_driver mv3310_drivers[] = { .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "mv88x3310", .get_features = mv3310_get_features, - .soft_reset = gen10g_no_soft_reset, + .soft_reset = genphy_no_soft_reset, .config_init = mv3310_config_init, .probe = mv3310_probe, .suspend = mv3310_suspend, @@ -474,7 +474,7 @@ static struct phy_driver mv3310_drivers[] = { .name = "mv88x2110", .get_features = genphy_c45_pma_read_abilities, .probe = mv3310_probe, - .soft_reset = gen10g_no_soft_reset, + .soft_reset = genphy_no_soft_reset, .config_init = mv3310_config_init, .config_aneg = mv3310_config_aneg, .aneg_done = mv3310_aneg_done, diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index 6cd4bd5e9e43..c596eb54e4ac 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -508,18 +508,11 @@ static int gen10g_read_status(struct phy_device *phydev) return genphy_c45_read_link(phydev); } -int gen10g_no_soft_reset(struct phy_device *phydev) -{ - /* Do nothing for now */ - return 0; -} -EXPORT_SYMBOL_GPL(gen10g_no_soft_reset); - struct phy_driver genphy_10g_driver = { .phy_id = 0xffffffff, .phy_id_mask = 0xffffffff, .name = "Generic 10G PHY", - .soft_reset = gen10g_no_soft_reset, + .soft_reset = genphy_no_soft_reset, .features = PHY_10GBIT_FEATURES, .config_aneg = gen10g_config_aneg, .read_status = gen10g_read_status, diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c index 95280212d5d5..beb054b931ee 100644 --- a/drivers/net/phy/teranetics.c +++ b/drivers/net/phy/teranetics.c @@ -78,7 +78,7 @@ static struct phy_driver teranetics_driver[] = { .phy_id_mask = 0xffffffff, .name = "Teranetics TN2020", .features = PHY_10GBIT_FEATURES, - .soft_reset = gen10g_no_soft_reset, + .soft_reset = genphy_no_soft_reset, .aneg_done = teranetics_aneg_done, .config_aneg = gen10g_config_aneg, .read_status = teranetics_read_status, diff --git a/include/linux/phy.h b/include/linux/phy.h index 60794240141f..34084892a466 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1119,7 +1119,6 @@ int genphy_c45_read_status(struct phy_device *phydev); /* The gen10g_* functions are the old Clause 45 stub */ int gen10g_config_aneg(struct phy_device *phydev); -int gen10g_no_soft_reset(struct phy_device *phydev); static inline int phy_read_status(struct phy_device *phydev) { -- cgit v1.2.3-59-g8ed1b