1 From 459fd2f11204c962e3153020f4f56748e0e10afb Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Tue, 21 Mar 2023 15:58:49 +0000
4 Subject: [PATCH] net: pcs: xpcs: use Autoneg bit rather than an_enabled
6 The Autoneg bit in the advertising bitmap and state->an_enabled are
7 always identical. Thus, we will be removing state->an_enabled.
9 Use the Autoneg bit in the advertising bitmap to indicate whether
10 autonegotiation should be used, rather than using the an_enabled
11 member which will be going away.
13 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
14 Reviewed-by: Simon Horman <simon.horman@corigine.com>
15 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
17 drivers/net/pcs/pcs-xpcs.c | 10 +++++++---
18 1 file changed, 7 insertions(+), 3 deletions(-)
20 --- a/drivers/net/pcs/pcs-xpcs.c
21 +++ b/drivers/net/pcs/pcs-xpcs.c
22 @@ -931,6 +931,7 @@ static int xpcs_get_state_c73(struct dw_
23 struct phylink_link_state *state,
24 const struct xpcs_compat *compat)
29 /* Link needs to be read first ... */
30 @@ -948,11 +949,13 @@ static int xpcs_get_state_c73(struct dw_
31 return xpcs_do_config(xpcs, state->interface, MLO_AN_INBAND, NULL);
34 - if (state->an_enabled && xpcs_aneg_done_c73(xpcs, state, compat)) {
35 + an_enabled = linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
36 + state->advertising);
37 + if (an_enabled && xpcs_aneg_done_c73(xpcs, state, compat)) {
38 state->an_complete = true;
39 xpcs_read_lpa_c73(xpcs, state);
40 xpcs_resolve_lpa_c73(xpcs, state);
41 - } else if (state->an_enabled) {
42 + } else if (an_enabled) {
44 } else if (state->link) {
45 xpcs_resolve_pma(xpcs, state);
46 @@ -1007,7 +1010,8 @@ static int xpcs_get_state_c37_1000basex(
50 - if (state->an_enabled) {
51 + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
52 + state->advertising)) {
53 /* Reset link state */