diff options
author | Chuanhong Guo <gch981213@gmail.com> | 2018-12-12 19:09:35 +0800 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2019-03-24 01:44:24 +0100 |
commit | 8d3af284e0b0735abbb915b01e65c22f4a049feb (patch) | |
tree | 0c845a669e07a2d5b0f0dba175565665311e2a19 /target/linux/ath79/files/drivers | |
parent | 67fced9ba336dd69c5a35aec3157db4b158a9e2d (diff) | |
download | upstream-8d3af284e0b0735abbb915b01e65c22f4a049feb.tar.gz upstream-8d3af284e0b0735abbb915b01e65c22f4a049feb.tar.bz2 upstream-8d3af284e0b0735abbb915b01e65c22f4a049feb.zip |
ath79: ag71xx: add support for timer functions in linux 4.15+
Kernel newer than 4.15 dropped "data" field and used from_timer
to cast out the parent struct pointer for current timer.
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Diffstat (limited to 'target/linux/ath79/files/drivers')
-rw-r--r-- | target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index b7b32f85db..f03c6b40a6 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -985,10 +985,16 @@ static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) return -EOPNOTSUPP; } +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)) static void ag71xx_oom_timer_handler(unsigned long data) { struct net_device *dev = (struct net_device *) data; struct ag71xx *ag = netdev_priv(dev); +#else +static void ag71xx_oom_timer_handler(struct timer_list *t) +{ + struct ag71xx *ag = from_timer(ag, t, oom_timer); +#endif napi_schedule(&ag->napi); } @@ -1401,9 +1407,13 @@ static int ag71xx_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&ag->restart_work, ag71xx_restart_work_func); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)) init_timer(&ag->oom_timer); ag->oom_timer.data = (unsigned long) dev; ag->oom_timer.function = ag71xx_oom_timer_handler; +#else + timer_setup(&ag->oom_timer, ag71xx_oom_timer_handler, 0); +#endif tx_size = AG71XX_TX_RING_SIZE_DEFAULT; ag->rx_ring.order = ag71xx_ring_size_order(AG71XX_RX_RING_SIZE_DEFAULT); |