]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
r8169: simplify detecting chip versions with same XID
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 22 Nov 2018 21:00:10 +0000 (22:00 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 24 Nov 2018 01:32:28 +0000 (17:32 -0800)
For the GMII chip versions we set the version number which was set
already. This can be simplified.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/realtek/r8169.c

index 9fd8f4215dffee5bb00878e3e886917cfd30059f..4ed9dabe66fe0de6d29aeb99e77b1bd2a7ff32f9 100644 (file)
@@ -2116,18 +2116,13 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp)
 
        if (tp->mac_version == RTL_GIGA_MAC_NONE) {
                dev_err(tp_to_dev(tp), "unknown chip XID %03x\n", reg & 0xfcf);
-       } else if (tp->mac_version == RTL_GIGA_MAC_VER_42) {
-               tp->mac_version = tp->supports_gmii ?
-                                 RTL_GIGA_MAC_VER_42 :
-                                 RTL_GIGA_MAC_VER_43;
-       } else if (tp->mac_version == RTL_GIGA_MAC_VER_45) {
-               tp->mac_version = tp->supports_gmii ?
-                                 RTL_GIGA_MAC_VER_45 :
-                                 RTL_GIGA_MAC_VER_47;
-       } else if (tp->mac_version == RTL_GIGA_MAC_VER_46) {
-               tp->mac_version = tp->supports_gmii ?
-                                 RTL_GIGA_MAC_VER_46 :
-                                 RTL_GIGA_MAC_VER_48;
+       } else if (!tp->supports_gmii) {
+               if (tp->mac_version == RTL_GIGA_MAC_VER_42)
+                       tp->mac_version = RTL_GIGA_MAC_VER_43;
+               else if (tp->mac_version == RTL_GIGA_MAC_VER_45)
+                       tp->mac_version = RTL_GIGA_MAC_VER_47;
+               else if (tp->mac_version == RTL_GIGA_MAC_VER_46)
+                       tp->mac_version = RTL_GIGA_MAC_VER_48;
        }
 }