720-Revert-net-phy-simplify-phy_link_change-arguments.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. From ffbb1b37a3e1ce1a5c574a6bd4f5aede8bc468ac Mon Sep 17 00:00:00 2001
  2. From: Ilya Lipnitskiy <[email protected]>
  3. Date: Sat, 27 Feb 2021 20:20:07 -0800
  4. Subject: [PATCH] Revert "net: phy: simplify phy_link_change arguments"
  5. This reverts commit a307593a644443db12888f45eed0dafb5869e2cc.
  6. This brings back the do_carrier flags used by the (hacky) next patch,
  7. still required by target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c
  8. ---
  9. drivers/net/phy/phy.c | 12 ++++++------
  10. drivers/net/phy/phy_device.c | 12 +++++++-----
  11. drivers/net/phy/phylink.c | 3 ++-
  12. include/linux/phy.h | 2 +-
  13. 4 files changed, 16 insertions(+), 13 deletions(-)
  14. --- a/drivers/net/phy/phy.c
  15. +++ b/drivers/net/phy/phy.c
  16. @@ -71,13 +71,13 @@ static void phy_process_state_change(str
  17. static void phy_link_up(struct phy_device *phydev)
  18. {
  19. - phydev->phy_link_change(phydev, true);
  20. + phydev->phy_link_change(phydev, true, true);
  21. phy_led_trigger_change_speed(phydev);
  22. }
  23. -static void phy_link_down(struct phy_device *phydev)
  24. +static void phy_link_down(struct phy_device *phydev, bool do_carrier)
  25. {
  26. - phydev->phy_link_change(phydev, false);
  27. + phydev->phy_link_change(phydev, false, do_carrier);
  28. phy_led_trigger_change_speed(phydev);
  29. }
  30. @@ -595,7 +595,7 @@ int phy_start_cable_test(struct phy_devi
  31. goto out;
  32. /* Mark the carrier down until the test is complete */
  33. - phy_link_down(phydev);
  34. + phy_link_down(phydev, true);
  35. netif_testing_on(dev);
  36. err = phydev->drv->cable_test_start(phydev);
  37. @@ -666,7 +666,7 @@ int phy_start_cable_test_tdr(struct phy_
  38. goto out;
  39. /* Mark the carrier down until the test is complete */
  40. - phy_link_down(phydev);
  41. + phy_link_down(phydev, true);
  42. netif_testing_on(dev);
  43. err = phydev->drv->cable_test_tdr_start(phydev, config);
  44. @@ -738,7 +738,7 @@ static int phy_check_link_status(struct
  45. phy_link_up(phydev);
  46. } else if (!phydev->link && phydev->state != PHY_NOLINK) {
  47. phydev->state = PHY_NOLINK;
  48. - phy_link_down(phydev);
  49. + phy_link_down(phydev, true);
  50. }
  51. return 0;
  52. @@ -1224,7 +1224,7 @@ void phy_state_machine(struct work_struc
  53. case PHY_HALTED:
  54. if (phydev->link) {
  55. phydev->link = 0;
  56. - phy_link_down(phydev);
  57. + phy_link_down(phydev, true);
  58. }
  59. do_suspend = true;
  60. break;
  61. --- a/drivers/net/phy/phy_device.c
  62. +++ b/drivers/net/phy/phy_device.c
  63. @@ -1039,14 +1039,16 @@ struct phy_device *phy_find_first(struct
  64. }
  65. EXPORT_SYMBOL(phy_find_first);
  66. -static void phy_link_change(struct phy_device *phydev, bool up)
  67. +static void phy_link_change(struct phy_device *phydev, bool up, bool do_carrier)
  68. {
  69. struct net_device *netdev = phydev->attached_dev;
  70. - if (up)
  71. - netif_carrier_on(netdev);
  72. - else
  73. - netif_carrier_off(netdev);
  74. + if (do_carrier) {
  75. + if (up)
  76. + netif_carrier_on(netdev);
  77. + else
  78. + netif_carrier_off(netdev);
  79. + }
  80. phydev->adjust_link(netdev);
  81. if (phydev->mii_ts && phydev->mii_ts->link_state)
  82. phydev->mii_ts->link_state(phydev->mii_ts, phydev);
  83. --- a/drivers/net/phy/phylink.c
  84. +++ b/drivers/net/phy/phylink.c
  85. @@ -1602,7 +1602,8 @@ bool phylink_expects_phy(struct phylink
  86. }
  87. EXPORT_SYMBOL_GPL(phylink_expects_phy);
  88. -static void phylink_phy_change(struct phy_device *phydev, bool up)
  89. +static void phylink_phy_change(struct phy_device *phydev, bool up,
  90. + bool do_carrier)
  91. {
  92. struct phylink *pl = phydev->phylink;
  93. bool tx_pause, rx_pause;
  94. --- a/include/linux/phy.h
  95. +++ b/include/linux/phy.h
  96. @@ -739,7 +739,7 @@ struct phy_device {
  97. int pma_extable;
  98. - void (*phy_link_change)(struct phy_device *phydev, bool up);
  99. + void (*phy_link_change)(struct phy_device *, bool up, bool do_carrier);
  100. void (*adjust_link)(struct net_device *dev);
  101. #if IS_ENABLED(CONFIG_MACSEC)