cpmodem_shim: support building against v5.4.164 and v4.4.100

Change-Id: I166168589a0b7555dec74d45463fd59436500703
diff --git a/cpmodem_shim/cpmodem_shim_main.c b/cpmodem_shim/cpmodem_shim_main.c
index e5bb813..697fbd3 100755
--- a/cpmodem_shim/cpmodem_shim_main.c
+++ b/cpmodem_shim/cpmodem_shim_main.c
@@ -790,9 +790,13 @@
 	CP_LKM_STUCK_DEINIT
 };
 static void cp_lkm_usb_stuck_check(struct cp_lkm_usb_base_dev* cpbdev, int action);
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4,4,100))
+static void cp_lkm_usb_pause_stuck_timer(unsigned long param);
+static void cp_lkm_usb_delay_timer (unsigned long param);
+#else
 static void cp_lkm_usb_pause_stuck_timer(struct timer_list *timer);
-
 static void cp_lkm_usb_delay_timer (struct timer_list *timer);
+#endif
 static void cp_lkm_usb_kevent (struct work_struct *work);
 static int cp_lkm_usb_open(struct cp_lkm_common_ctx *ctx);
 static int cp_lkm_usb_close(struct cp_lkm_common_ctx *ctx);
@@ -1651,8 +1655,13 @@
 		cpbdev->processing_state = USB_PROCESS_STATE_IDLE;
 		cpbdev->other_state = USB_PROCESS_STATE_IDLE;
 		INIT_WORK(&cpbdev->kevent, cp_lkm_usb_kevent);
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4,4,100))
+		cpbdev->rx_delay.function = cp_lkm_usb_delay_timer; //TODO: this needs to handle the cpdev or cpbdev??
+		cpbdev->rx_delay.data = (unsigned long) cpbdev; //????? should this be cpdev??
+		init_timer (&cpbdev->rx_delay);
+#else
 		timer_setup(&cpbdev->rx_delay, cp_lkm_usb_delay_timer, 0);
-
+#endif
 		cpbdev->data_process_tasklet.func = cp_lkm_usb_process_data_done_tasklet; //TODO: modify to take cpbdev
 		cpbdev->data_process_tasklet.data = (unsigned long) cpbdev;
 
@@ -2501,11 +2510,20 @@
 // 
 // The whole purpose of this function is to pump the system if it is otherwise idle. If 
 // it isn't idle, we can count on those processes to call cp_lkm_schedule_rx_restock when done. 
+
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4,4,100))
+static void cp_lkm_usb_delay_timer (unsigned long param)
+#else
 static void cp_lkm_usb_delay_timer (struct timer_list *timer)
+#endif
 {
 	unsigned long flags;
 
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4,4,100))
+	struct cp_lkm_usb_base_dev* cpbdev = (struct cp_lkm_usb_base_dev *)param;
+#else
 	struct cp_lkm_usb_base_dev* cpbdev = from_timer(cpbdev,timer,rx_delay);
+#endif
 
 	spin_lock_irqsave(&cpbdev->processing_state_lock, flags);
 	if(cpbdev->processing_state == USB_PROCESS_STATE_IDLE){
@@ -2542,7 +2560,13 @@
 	//g_stuck_chk++;
 	switch(action) {
 	case CP_LKM_STUCK_INIT:
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4,4,100))
+		cpbdev->usb_pause_stuck_timer.function = cp_lkm_usb_pause_stuck_timer;
+		cpbdev->usb_pause_stuck_timer.data = (unsigned long)cpbdev;
+		init_timer(&cpbdev->usb_pause_stuck_timer);
+#else
 		timer_setup(&cpbdev->usb_pause_stuck_timer, cp_lkm_usb_pause_stuck_timer, 0);
+#endif
 		break;
 	case CP_LKM_STUCK_START:
 		mod_timer(&cpbdev->usb_pause_stuck_timer, jiffies + msecs_to_jiffies(3000));
@@ -2560,9 +2584,17 @@
 // If we detect that it is stuck (if the tx has been paused for more than 3 seconds) then we cancel the
 // struck urb and this gets things going again. The cancelled urb results in a dropped packet which is undesirable,
 // but preferrable to being stuck.
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4,4,100))
+static void cp_lkm_usb_pause_stuck_timer (unsigned long param)
+#else
 static void cp_lkm_usb_pause_stuck_timer (struct timer_list *timer)
+#endif
 {
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4,4,100))
+	struct cp_lkm_usb_base_dev* cpbdev = (struct cp_lkm_usb_base_dev *)param;
+#else
 	struct cp_lkm_usb_base_dev* cpbdev = from_timer(cpbdev,timer,usb_pause_stuck_timer);
+#endif
 	struct skb_data *entry;
 	struct sk_buff *skb;
 	struct urb *urb = NULL;
@@ -2777,7 +2809,9 @@
 					work_done++;
 					tx_work_done++;
 					//fall through on purpose
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,164))
 					fallthrough;
+#endif
 				case in_data_cleanup:
 					if(entry->urb) {
 						//cp_lkm_usb_urb_cnt(-1);
@@ -4507,7 +4541,11 @@
 
 };
 
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4,4,100))
+static struct rtnl_link_stats64 *cp_lkm_pm_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
+#else
 static void cp_lkm_pm_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
+#endif
 {
 	struct cp_lkm_pm_net *pm_net;
 	int i;
@@ -4543,7 +4581,9 @@
 		stats->tx_dropped += tx_dropped;
 		stats->rx_over_errors += rx_over_errors;
 	}
-
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4,4,100))
+	return stats;
+#endif
 }
 
 static int cp_lkm_pm_net_open(struct net_device *dev)