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