715-07-v6.2-net-remove-explicit-phylink_generic_validate-referen.patch 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. From b45b773a96b0e9e8d51e5d005485f4e376d6ce9a Mon Sep 17 00:00:00 2001
  2. From: "Russell King (Oracle)" <[email protected]>
  3. Date: Fri, 4 Nov 2022 17:13:01 +0000
  4. Subject: [PATCH 07/21] net: remove explicit phylink_generic_validate()
  5. references
  6. Virtually all conventional network drivers are now converted to use
  7. phylink_generic_validate() - only DSA drivers and fman_memac remain,
  8. so lets remove the necessity for network drivers to explicitly set
  9. this member, and default to phylink_generic_validate() when unset.
  10. This is possible as .validate must currently be set.
  11. Any remaining instances that have not been addressed by this patch can
  12. be fixed up later.
  13. Signed-off-by: Russell King (Oracle) <[email protected]>
  14. Reviewed-by: Vladimir Oltean <[email protected]>
  15. Link: https://lore.kernel.org/r/[email protected]
  16. Signed-off-by: Jakub Kicinski <[email protected]>
  17. ---
  18. drivers/net/ethernet/altera/altera_tse_main.c | 1 -
  19. drivers/net/ethernet/atheros/ag71xx.c | 1 -
  20. drivers/net/ethernet/cadence/macb_main.c | 1 -
  21. drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 1 -
  22. drivers/net/ethernet/freescale/enetc/enetc_pf.c | 1 -
  23. drivers/net/ethernet/freescale/fman/fman_dtsec.c | 1 -
  24. drivers/net/ethernet/freescale/fman/fman_tgec.c | 1 -
  25. drivers/net/ethernet/marvell/mvneta.c | 1 -
  26. drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 1 -
  27. drivers/net/ethernet/marvell/prestera/prestera_main.c | 1 -
  28. drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 -
  29. drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c | 1 -
  30. drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c | 1 -
  31. drivers/net/ethernet/mscc/ocelot_net.c | 1 -
  32. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 -
  33. drivers/net/ethernet/ti/am65-cpsw-nuss.c | 1 -
  34. drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 1 -
  35. drivers/net/phy/phylink.c | 5 ++++-
  36. drivers/net/usb/asix_devices.c | 1 -
  37. include/linux/phylink.h | 5 +++++
  38. 20 files changed, 9 insertions(+), 19 deletions(-)
  39. --- a/drivers/net/ethernet/altera/altera_tse_main.c
  40. +++ b/drivers/net/ethernet/altera/altera_tse_main.c
  41. @@ -1096,7 +1096,6 @@ static struct phylink_pcs *alt_tse_selec
  42. }
  43. static const struct phylink_mac_ops alt_tse_phylink_ops = {
  44. - .validate = phylink_generic_validate,
  45. .mac_an_restart = alt_tse_mac_an_restart,
  46. .mac_config = alt_tse_mac_config,
  47. .mac_link_down = alt_tse_mac_link_down,
  48. --- a/drivers/net/ethernet/atheros/ag71xx.c
  49. +++ b/drivers/net/ethernet/atheros/ag71xx.c
  50. @@ -1086,7 +1086,6 @@ static void ag71xx_mac_link_up(struct ph
  51. }
  52. static const struct phylink_mac_ops ag71xx_phylink_mac_ops = {
  53. - .validate = phylink_generic_validate,
  54. .mac_config = ag71xx_mac_config,
  55. .mac_link_down = ag71xx_mac_link_down,
  56. .mac_link_up = ag71xx_mac_link_up,
  57. --- a/drivers/net/ethernet/cadence/macb_main.c
  58. +++ b/drivers/net/ethernet/cadence/macb_main.c
  59. @@ -752,7 +752,6 @@ static struct phylink_pcs *macb_mac_sele
  60. }
  61. static const struct phylink_mac_ops macb_phylink_ops = {
  62. - .validate = phylink_generic_validate,
  63. .mac_select_pcs = macb_mac_select_pcs,
  64. .mac_config = macb_mac_config,
  65. .mac_link_down = macb_mac_link_down,
  66. --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
  67. +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
  68. @@ -235,7 +235,6 @@ static void dpaa2_mac_link_down(struct p
  69. }
  70. static const struct phylink_mac_ops dpaa2_mac_phylink_ops = {
  71. - .validate = phylink_generic_validate,
  72. .mac_select_pcs = dpaa2_mac_select_pcs,
  73. .mac_config = dpaa2_mac_config,
  74. .mac_link_up = dpaa2_mac_link_up,
  75. --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
  76. +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
  77. @@ -1111,7 +1111,6 @@ static void enetc_pl_mac_link_down(struc
  78. }
  79. static const struct phylink_mac_ops enetc_mac_phylink_ops = {
  80. - .validate = phylink_generic_validate,
  81. .mac_select_pcs = enetc_pl_mac_select_pcs,
  82. .mac_config = enetc_pl_mac_config,
  83. .mac_link_up = enetc_pl_mac_link_up,
  84. --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
  85. +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
  86. @@ -986,7 +986,6 @@ static void dtsec_link_down(struct phyli
  87. }
  88. static const struct phylink_mac_ops dtsec_mac_ops = {
  89. - .validate = phylink_generic_validate,
  90. .mac_select_pcs = dtsec_select_pcs,
  91. .mac_config = dtsec_mac_config,
  92. .mac_link_up = dtsec_link_up,
  93. --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c
  94. +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c
  95. @@ -469,7 +469,6 @@ static void tgec_link_down(struct phylin
  96. }
  97. static const struct phylink_mac_ops tgec_mac_ops = {
  98. - .validate = phylink_generic_validate,
  99. .mac_config = tgec_mac_config,
  100. .mac_link_up = tgec_link_up,
  101. .mac_link_down = tgec_link_down,
  102. --- a/drivers/net/ethernet/marvell/mvneta.c
  103. +++ b/drivers/net/ethernet/marvell/mvneta.c
  104. @@ -4228,7 +4228,6 @@ static void mvneta_mac_link_up(struct ph
  105. }
  106. static const struct phylink_mac_ops mvneta_phylink_ops = {
  107. - .validate = phylink_generic_validate,
  108. .mac_select_pcs = mvneta_mac_select_pcs,
  109. .mac_prepare = mvneta_mac_prepare,
  110. .mac_config = mvneta_mac_config,
  111. --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
  112. +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
  113. @@ -6633,7 +6633,6 @@ static void mvpp2_mac_link_down(struct p
  114. }
  115. static const struct phylink_mac_ops mvpp2_phylink_ops = {
  116. - .validate = phylink_generic_validate,
  117. .mac_select_pcs = mvpp2_select_pcs,
  118. .mac_prepare = mvpp2_mac_prepare,
  119. .mac_config = mvpp2_mac_config,
  120. --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
  121. +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
  122. @@ -360,7 +360,6 @@ static void prestera_pcs_an_restart(stru
  123. }
  124. static const struct phylink_mac_ops prestera_mac_ops = {
  125. - .validate = phylink_generic_validate,
  126. .mac_select_pcs = prestera_mac_select_pcs,
  127. .mac_config = prestera_mac_config,
  128. .mac_link_down = prestera_mac_link_down,
  129. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  130. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  131. @@ -654,7 +654,6 @@ static void mtk_mac_link_up(struct phyli
  132. }
  133. static const struct phylink_mac_ops mtk_phylink_ops = {
  134. - .validate = phylink_generic_validate,
  135. .mac_select_pcs = mtk_mac_select_pcs,
  136. .mac_pcs_get_state = mtk_mac_pcs_get_state,
  137. .mac_config = mtk_mac_config,
  138. --- a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c
  139. +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c
  140. @@ -125,7 +125,6 @@ static void lan966x_pcs_aneg_restart(str
  141. }
  142. const struct phylink_mac_ops lan966x_phylink_mac_ops = {
  143. - .validate = phylink_generic_validate,
  144. .mac_select_pcs = lan966x_phylink_mac_select,
  145. .mac_config = lan966x_phylink_mac_config,
  146. .mac_prepare = lan966x_phylink_mac_prepare,
  147. --- a/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
  148. +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
  149. @@ -138,7 +138,6 @@ const struct phylink_pcs_ops sparx5_phyl
  150. };
  151. const struct phylink_mac_ops sparx5_phylink_mac_ops = {
  152. - .validate = phylink_generic_validate,
  153. .mac_select_pcs = sparx5_phylink_mac_select_pcs,
  154. .mac_config = sparx5_phylink_mac_config,
  155. .mac_link_down = sparx5_phylink_mac_link_down,
  156. --- a/drivers/net/ethernet/mscc/ocelot_net.c
  157. +++ b/drivers/net/ethernet/mscc/ocelot_net.c
  158. @@ -1737,7 +1737,6 @@ static void vsc7514_phylink_mac_link_up(
  159. }
  160. static const struct phylink_mac_ops ocelot_phylink_ops = {
  161. - .validate = phylink_generic_validate,
  162. .mac_config = vsc7514_phylink_mac_config,
  163. .mac_link_down = vsc7514_phylink_mac_link_down,
  164. .mac_link_up = vsc7514_phylink_mac_link_up,
  165. --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
  166. +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
  167. @@ -1090,7 +1090,6 @@ static void stmmac_mac_link_up(struct ph
  168. }
  169. static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
  170. - .validate = phylink_generic_validate,
  171. .mac_select_pcs = stmmac_mac_select_pcs,
  172. .mac_config = stmmac_mac_config,
  173. .mac_link_down = stmmac_mac_link_down,
  174. --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
  175. +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
  176. @@ -1493,7 +1493,6 @@ static void am65_cpsw_nuss_mac_link_up(s
  177. }
  178. static const struct phylink_mac_ops am65_cpsw_phylink_mac_ops = {
  179. - .validate = phylink_generic_validate,
  180. .mac_config = am65_cpsw_nuss_mac_config,
  181. .mac_link_down = am65_cpsw_nuss_mac_link_down,
  182. .mac_link_up = am65_cpsw_nuss_mac_link_up,
  183. --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
  184. +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
  185. @@ -1736,7 +1736,6 @@ static void axienet_mac_link_up(struct p
  186. }
  187. static const struct phylink_mac_ops axienet_phylink_ops = {
  188. - .validate = phylink_generic_validate,
  189. .mac_select_pcs = axienet_mac_select_pcs,
  190. .mac_config = axienet_mac_config,
  191. .mac_link_down = axienet_mac_link_down,
  192. --- a/drivers/net/phy/phylink.c
  193. +++ b/drivers/net/phy/phylink.c
  194. @@ -651,7 +651,10 @@ static int phylink_validate_mac_and_pcs(
  195. }
  196. /* Then validate the link parameters with the MAC */
  197. - pl->mac_ops->validate(pl->config, supported, state);
  198. + if (pl->mac_ops->validate)
  199. + pl->mac_ops->validate(pl->config, supported, state);
  200. + else
  201. + phylink_generic_validate(pl->config, supported, state);
  202. return phylink_is_empty_linkmode(supported) ? -EINVAL : 0;
  203. }
  204. --- a/drivers/net/usb/asix_devices.c
  205. +++ b/drivers/net/usb/asix_devices.c
  206. @@ -787,7 +787,6 @@ static void ax88772_mac_link_up(struct p
  207. }
  208. static const struct phylink_mac_ops ax88772_phylink_mac_ops = {
  209. - .validate = phylink_generic_validate,
  210. .mac_config = ax88772_mac_config,
  211. .mac_link_down = ax88772_mac_link_down,
  212. .mac_link_up = ax88772_mac_link_up,
  213. --- a/include/linux/phylink.h
  214. +++ b/include/linux/phylink.h
  215. @@ -207,6 +207,11 @@ struct phylink_mac_ops {
  216. *
  217. * If the @state->interface mode is not supported, then the @supported
  218. * mask must be cleared.
  219. + *
  220. + * This member is optional; if not set, the generic validator will be
  221. + * used making use of @config->mac_capabilities and
  222. + * @config->supported_interfaces to determine which link modes are
  223. + * supported.
  224. */
  225. void validate(struct phylink_config *config, unsigned long *supported,
  226. struct phylink_link_state *state);