r8152: fix build with linux-6.9
Signed-off-by: sbwml <admin@cooluc.com>
This commit is contained in:
parent
6c8740d2b6
commit
6abfb3bb6e
111
patches/200-fix-build-with-linux-6.9.patch
Normal file
111
patches/200-fix-build-with-linux-6.9.patch
Normal file
@ -0,0 +1,111 @@
|
||||
--- a/r8152.c
|
||||
+++ b/r8152.c
|
||||
@@ -1000,7 +1000,10 @@ struct r8152 {
|
||||
int (*up)(struct r8152 *tp);
|
||||
int (*down)(struct r8152 *tp);
|
||||
void (*unload)(struct r8152 *tp);
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ int (*eee_get)(struct r8152 *tp, struct ethtool_keee *eee);
|
||||
+ int (*eee_set)(struct r8152 *tp, struct ethtool_keee *eee);
|
||||
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
|
||||
int (*eee_get)(struct r8152 *tp, struct ethtool_eee *eee);
|
||||
int (*eee_set)(struct r8152 *tp, struct ethtool_eee *eee);
|
||||
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||
@@ -23361,7 +23364,11 @@ static void rtl8152_get_strings(struct n
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+static int r8152_get_eee(struct r8152 *tp, struct ethtool_keee *eee)
|
||||
+#else
|
||||
static int r8152_get_eee(struct r8152 *tp, struct ethtool_eee *eee)
|
||||
+#endif
|
||||
{
|
||||
u32 lp, adv, supported = 0;
|
||||
int ret;
|
||||
@@ -23387,17 +23394,33 @@ static int r8152_get_eee(struct r8152 *t
|
||||
|
||||
eee->eee_enabled = tp->eee_en;
|
||||
eee->eee_active = !!(supported & adv & lp);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(eee->supported, supported);
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(eee->advertised, tp->eee_adv);
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(eee->lp_advertised, lp);
|
||||
+#else
|
||||
eee->supported = supported;
|
||||
eee->advertised = mmd_eee_adv_to_ethtool_adv_t(tp->eee_adv);
|
||||
eee->lp_advertised = lp;
|
||||
+#endif
|
||||
|
||||
out:
|
||||
return (ret < 0) ? ret : 0;
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+static int r8152_set_eee(struct r8152 *tp, struct ethtool_keee *eee)
|
||||
+#else
|
||||
static int r8152_set_eee(struct r8152 *tp, struct ethtool_eee *eee)
|
||||
+#endif
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ u32 advertised = 0;
|
||||
+ ethtool_convert_link_mode_to_legacy_u32(&advertised, eee->advertised);
|
||||
+ u16 val = ethtool_adv_to_mmd_eee_adv_t(advertised);
|
||||
+#else
|
||||
u16 val = ethtool_adv_to_mmd_eee_adv_t(eee->advertised);
|
||||
+#endif
|
||||
|
||||
tp->eee_en = eee->eee_enabled;
|
||||
tp->eee_adv = val;
|
||||
@@ -23405,7 +23428,11 @@ static int r8152_set_eee(struct r8152 *t
|
||||
return rtl_eee_enable(tp, tp->eee_en);
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+static int r8153_get_eee(struct r8152 *tp, struct ethtool_keee *eee)
|
||||
+#else
|
||||
static int r8153_get_eee(struct r8152 *tp, struct ethtool_eee *eee)
|
||||
+#endif
|
||||
{
|
||||
u32 lp, adv, supported = 0;
|
||||
u16 val;
|
||||
@@ -23428,16 +23455,26 @@ static int r8153_get_eee(struct r8152 *t
|
||||
|
||||
eee->eee_enabled = tp->eee_en;
|
||||
eee->eee_active = !!(supported & adv & lp);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(eee->supported, supported);
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(eee->advertised, tp->eee_adv);
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(eee->lp_advertised, lp);
|
||||
+#else
|
||||
eee->supported = supported;
|
||||
eee->advertised = mmd_eee_adv_to_ethtool_adv_t(tp->eee_adv);
|
||||
eee->lp_advertised = lp;
|
||||
+#endif
|
||||
|
||||
out:
|
||||
return (ret < 0) ? ret : 0;
|
||||
}
|
||||
|
||||
static int
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
|
||||
+#else
|
||||
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
+#endif
|
||||
{
|
||||
struct r8152 *tp = netdev_priv(net);
|
||||
int ret;
|
||||
@@ -23464,7 +23501,11 @@ out:
|
||||
}
|
||||
|
||||
static int
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
|
||||
+#else
|
||||
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
+#endif
|
||||
{
|
||||
struct r8152 *tp = netdev_priv(net);
|
||||
int ret;
|
Loading…
Reference in New Issue
Block a user