From 0b63a8546c9467b69c1c1a39dc3d8db649d7c35e Mon Sep 17 00:00:00 2001 From: "Alexei A. Smekalkine" Date: Fri, 11 Jan 2019 06:15:27 +0300 Subject: [PATCH] dahdi-base: fix build with Linux >= 4.7 and netdev support enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is required to support build for Linux ≥ 4.7 with CONFIG_DAHDI_NET enabled. Not trans_start field removed from net_device structure by Linux commit 9b36627acecd5792e81daf1a3bff8eab39ed45fb. Asterisk-Issue: DAHLIN-382 --- drivers/dahdi/dahdi-base.c | 3 ++- include/dahdi/kernel.h | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 626c31f..4e88a0c 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -2140,7 +2140,8 @@ static int dahdi_xmit(struct sk_buff *skb, struct net_device *dev) some space for us */ ss->outwritebuf = oldbuf; } - dev->trans_start = jiffies; + + netif_trans_update(dev); stats->tx_packets++; stats->tx_bytes += ss->writen[oldbuf]; print_debug_writebuf(ss, skb, oldbuf); diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 42730fb..1e2a02a 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -1419,6 +1419,13 @@ timer_setup(struct timer_list *timer, #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) #define dahdi_ktime_equal ktime_equal +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) + +static inline void netif_trans_update(struct net_device *dev) +{ + dev->trans_start = jiffies; +} + #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) #ifdef RHEL_RELEASE_VERSION @@ -1482,6 +1489,7 @@ static inline void *PDE_DATA(const struct inode *inode) #endif /* 3.10.0 */ #endif /* 3.16.0 */ #endif /* 4.0.0 */ +#endif /* 4.7.0 */ #endif /* 4.10.0 */ #endif /* 4.11.0 */ #endif /* 4.13.0 */ -- 2.11.0