Skip to content

Commit d078a67

Browse files
hkallweitopsiff
authored andcommitted
r8169: improve rtl_set_d3_pll_down
mainline inclusion from mainline-v6.13-rc1 category: other Make use of new helper r8169_mod_reg8_cond() and move from a switch() to an if() clause. Benefit is that we don't have to touch this piece of code each time support for a new chip version is added. Signed-off-by: Heiner Kallweit <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> (cherry picked from commit 330dc22) Signed-off-by: Wentao Guan <[email protected]>
1 parent 5f61f03 commit d078a67

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,19 +1431,11 @@ static enum rtl_dash_type rtl_get_dash_type(struct rtl8169_private *tp)
14311431

14321432
static void rtl_set_d3_pll_down(struct rtl8169_private *tp, bool enable)
14331433
{
1434-
switch (tp->mac_version) {
1435-
case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_26:
1436-
case RTL_GIGA_MAC_VER_29 ... RTL_GIGA_MAC_VER_30:
1437-
case RTL_GIGA_MAC_VER_32 ... RTL_GIGA_MAC_VER_37:
1438-
case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66:
1439-
if (enable)
1440-
RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~D3_NO_PLL_DOWN);
1441-
else
1442-
RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) | D3_NO_PLL_DOWN);
1443-
break;
1444-
default:
1445-
break;
1446-
}
1434+
if (tp->mac_version >= RTL_GIGA_MAC_VER_25 &&
1435+
tp->mac_version != RTL_GIGA_MAC_VER_28 &&
1436+
tp->mac_version != RTL_GIGA_MAC_VER_31 &&
1437+
tp->mac_version != RTL_GIGA_MAC_VER_38)
1438+
r8169_mod_reg8_cond(tp, PMCH, D3_NO_PLL_DOWN, !enable);
14471439
}
14481440

14491441
static void rtl_reset_packet_filter(struct rtl8169_private *tp)

0 commit comments

Comments
 (0)