cpmodem_shim: Update driver to new timer interface
Signed-off-by: Harish Ambati <harish.ambati@est.tech>
Change-Id: Iee523c63013b8aab8e403b44d8d6677b0f66dad9
diff --git a/cpmodem_shim/cpmodem_shim.c b/cpmodem_shim/cpmodem_shim.c
index 0ad3061..e5bb813 100755
--- a/cpmodem_shim/cpmodem_shim.c
+++ b/cpmodem_shim/cpmodem_shim.c
@@ -790,9 +790,9 @@
CP_LKM_STUCK_DEINIT
};
static void cp_lkm_usb_stuck_check(struct cp_lkm_usb_base_dev* cpbdev, int action);
-static void cp_lkm_usb_pause_stuck_timer(unsigned long param);
+static void cp_lkm_usb_pause_stuck_timer(struct timer_list *timer);
-static void cp_lkm_usb_delay_timer (unsigned long param);
+static void cp_lkm_usb_delay_timer (struct timer_list *timer);
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,10 +1651,7 @@
cpbdev->processing_state = USB_PROCESS_STATE_IDLE;
cpbdev->other_state = USB_PROCESS_STATE_IDLE;
INIT_WORK(&cpbdev->kevent, cp_lkm_usb_kevent);
-
- 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);
+ timer_setup(&cpbdev->rx_delay, cp_lkm_usb_delay_timer, 0);
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;
@@ -2504,11 +2501,12 @@
//
// 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.
-static void cp_lkm_usb_delay_timer (unsigned long param)
+static void cp_lkm_usb_delay_timer (struct timer_list *timer)
{
unsigned long flags;
- struct cp_lkm_usb_base_dev* cpbdev = (struct cp_lkm_usb_base_dev *)param;
+ struct cp_lkm_usb_base_dev* cpbdev = from_timer(cpbdev,timer,rx_delay);
+
spin_lock_irqsave(&cpbdev->processing_state_lock, flags);
if(cpbdev->processing_state == USB_PROCESS_STATE_IDLE){
cp_lkm_schedule_rx_restock(cpbdev,NULL);
@@ -2544,9 +2542,7 @@
//g_stuck_chk++;
switch(action) {
case CP_LKM_STUCK_INIT:
- 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);
+ timer_setup(&cpbdev->usb_pause_stuck_timer, cp_lkm_usb_pause_stuck_timer, 0);
break;
case CP_LKM_STUCK_START:
mod_timer(&cpbdev->usb_pause_stuck_timer, jiffies + msecs_to_jiffies(3000));
@@ -2564,9 +2560,9 @@
// 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.
-static void cp_lkm_usb_pause_stuck_timer (unsigned long param)
+static void cp_lkm_usb_pause_stuck_timer (struct timer_list *timer)
{
- struct cp_lkm_usb_base_dev* cpbdev = (struct cp_lkm_usb_base_dev *)param;
+ struct cp_lkm_usb_base_dev* cpbdev = from_timer(cpbdev,timer,usb_pause_stuck_timer);
struct skb_data *entry;
struct sk_buff *skb;
struct urb *urb = NULL;
@@ -2781,6 +2777,7 @@
work_done++;
tx_work_done++;
//fall through on purpose
+ fallthrough;
case in_data_cleanup:
if(entry->urb) {
//cp_lkm_usb_urb_cnt(-1);
@@ -4510,7 +4507,7 @@
};
-static struct rtnl_link_stats64 *cp_lkm_pm_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
+static void cp_lkm_pm_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
{
struct cp_lkm_pm_net *pm_net;
int i;
@@ -4547,7 +4544,6 @@
stats->rx_over_errors += rx_over_errors;
}
- return stats;
}
static int cp_lkm_pm_net_open(struct net_device *dev)