aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2017-01-27 13:56:48 +0100
committerFelix Fietkau <nbd@nbd.name>2017-02-01 17:49:54 +0100
commit0f19c1d6cfc8aeb7636a561ff30eb7f50b48d99d (patch)
treec055b729d62c125ab05485e9a868746605ea9d86
parentf6750db5dd664d8d1a339f2daad2c6ad08b1b145 (diff)
downloadupstream-0f19c1d6cfc8aeb7636a561ff30eb7f50b48d99d.tar.gz
upstream-0f19c1d6cfc8aeb7636a561ff30eb7f50b48d99d.tar.bz2
upstream-0f19c1d6cfc8aeb7636a561ff30eb7f50b48d99d.zip
rtl8366_smi: add linux 4.4 compatibility
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366_smi.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
index 699234d22d..b8cdf30de4 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
@@ -19,6 +19,7 @@
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <linux/rtl8366.h>
+#include <linux/version.h>
#ifdef CONFIG_RTL8366_SMI_DEBUG_FS
#include <linux/debugfs.h>
@@ -914,7 +915,6 @@ static inline void rtl8366_debugfs_remove(struct rtl8366_smi *smi) {}
static int rtl8366_smi_mii_init(struct rtl8366_smi *smi)
{
int ret;
- int i;
smi->mii_bus = mdiobus_alloc();
if (smi->mii_bus == NULL) {
@@ -930,9 +930,14 @@ static int rtl8366_smi_mii_init(struct rtl8366_smi *smi)
dev_name(smi->parent));
smi->mii_bus->parent = smi->parent;
smi->mii_bus->phy_mask = ~(0x1f);
- smi->mii_bus->irq = smi->mii_irq;
- for (i = 0; i < PHY_MAX_ADDR; i++)
- smi->mii_irq[i] = PHY_POLL;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0)
+ {
+ int i;
+ smi->mii_bus->irq = smi->mii_irq;
+ for (i = 0; i < PHY_MAX_ADDR; i++)
+ smi->mii_irq[i] = PHY_POLL;
+ }
+#endif
ret = mdiobus_register(smi->mii_bus);
if (ret)