Skip to contentSkip to conversation

mwifiex: remove timer wrapper functions

PATCH New Bing Zhao 1 participant 1 message Dec 14, 2010 Networking drivers (wireless)

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 mwifiex: remove timer wrapper functions

From: Kiran Divekar <[email protected]>

All the timer wrapper functions are removed and replaced by internal timer calls.

---
 drivers/net/wireless/mwifiex/11n_rxreorder.c |   53 ++++++++++++++----
 drivers/net/wireless/mwifiex/cmdevt.c        |   11 +++-
 drivers/net/wireless/mwifiex/init.c          |    4 +-
 drivers/net/wireless/mwifiex/main.c          |   45 +++++++++++++---
 drivers/net/wireless/mwifiex/main.h          |   11 +---
 drivers/net/wireless/mwifiex/util.c          |   73 --------------------------
 drivers/net/wireless/mwifiex/util.h          |   50 ------------------
 7 files changed, 90 insertions(+), 157 deletions(-)
drivers/net/wireless/mwifiex/11n_rxreorder.c +41 -12
index c7b9d2d..8fdb1fb 100644
@@ -184,10 +184,14 @@ mwifiex_11n_delete_rx_reorder_tbl_entry(struct mwifiex_private *priv,
 						 &(MAX_TID_VALUE - 1));
 
 	if (rx_reor_tbl_ptr->timer_context.timer) {
-		if (rx_reor_tbl_ptr->timer_context.timer_is_set)
-			mwifiex_stop_timer(rx_reor_tbl_ptr->timer_context.
-					   timer);
-		mwifiex_free_timer(rx_reor_tbl_ptr->timer_context.timer);
+		if (rx_reor_tbl_ptr->timer_context.timer_is_set) {
+			del_timer(&rx_reor_tbl_ptr->timer_context.timer->tl);
+			rx_reor_tbl_ptr->timer_context.timer->timer_is_canceled
+					= true;
+			rx_reor_tbl_ptr->timer_context.timer->time_period = 0;
+		}
+
+		kfree(rx_reor_tbl_ptr->timer_context.timer);
 	}
 
 	PRINTM(MDAT_D, "Delete rx_reor_tbl_ptr: %p\n", rx_reor_tbl_ptr);
@@ -359,9 +363,25 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
 		new_node->timer_context.priv = priv;
 		new_node->timer_context.timer_is_set = false;
 
-		mwifiex_init_timer(&new_node->timer_context.timer,
-				   mwifiex_flush_data,
-				   &new_node->timer_context);
+		new_node->timer_context.timer =
+			kmalloc(sizeof(struct mwifiex_drv_timer), GFP_KERNEL);
+		if (!new_node->timer_context.timer) {
+			LEAVE();
+			return;
+		}
+		init_timer(&new_node->timer_context.timer->tl);
+		new_node->timer_context.timer->tl.function =
+				mwifiex_timer_handler;
+		new_node->timer_context.timer->tl.data = (unsigned long)
+				new_node->timer_context.timer;
+
+		new_node->timer_context.timer->timer_function =
+				mwifiex_flush_data;
+		new_node->timer_context.timer->function_context =
+				&new_node->timer_context;
+		new_node->timer_context.timer->timer_is_canceled = true;
+		new_node->timer_context.timer->time_period = 0;
+		new_node->timer_context.timer->timer_is_periodic = false;
 
 		for (i = 0; i < win_size; ++i)
 			new_node->rx_reorder_ptr[i] = NULL;
@@ -534,11 +554,20 @@ mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
 		start_win = rx_reor_tbl_ptr->start_win;
 		win_size = rx_reor_tbl_ptr->win_size;
 		end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1);
-		if (rx_reor_tbl_ptr->timer_context.timer_is_set)
-			mwifiex_stop_timer(rx_reor_tbl_ptr->timer_context.
-					   timer);
-		mwifiex_start_timer(rx_reor_tbl_ptr->timer_context.timer,
-				    false, MIN_FLUSH_TIMER_MS * win_size);
+		if (rx_reor_tbl_ptr->timer_context.timer_is_set) {
+			del_timer(&rx_reor_tbl_ptr->timer_context.timer->tl);
+			rx_reor_tbl_ptr->timer_context.timer->timer_is_canceled
+					= true;
+			rx_reor_tbl_ptr->timer_context.timer->time_period = 0;
+		}
+		rx_reor_tbl_ptr->timer_context.timer->timer_is_periodic
+					= false;
+		rx_reor_tbl_ptr->timer_context.timer->time_period
+					= MIN_FLUSH_TIMER_MS * win_size;
+		mod_timer(&rx_reor_tbl_ptr->timer_context.timer->tl, jiffies
+			+ (MIN_FLUSH_TIMER_MS * win_size * HZ) / 1000);
+		rx_reor_tbl_ptr->timer_context.timer->timer_is_canceled
+					= false;
 		rx_reor_tbl_ptr->timer_context.timer_is_set = true;
 
 		PRINTM(MDAT_D, "TID %d, TA %02x:%02x:%02x:%02x:%02x:%02x\n",
drivers/net/wireless/mwifiex/cmdevt.c +8 -3
index 509eab0..873de93 100644
@@ -311,8 +311,11 @@ mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
 	cmd_code &= HostCmd_CMD_ID_MASK;
 
 	/* Setup the timer after transmit command */
-	mwifiex_start_timer(adapter->mwifiex_cmd_timer, false,
-			    MWIFIEX_TIMER_10S);
+	adapter->mwifiex_cmd_timer->timer_is_periodic = false;
+	adapter->mwifiex_cmd_timer->time_period = MWIFIEX_TIMER_10S;
+	mod_timer(&adapter->mwifiex_cmd_timer->tl,
+		jiffies + (MWIFIEX_TIMER_10S * HZ) / 1000);
+	adapter->mwifiex_cmd_timer->timer_is_canceled = false;
 
 	adapter->cmd_timer_is_set = true;
 
@@ -900,7 +903,9 @@ mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
 	/* Now we got response from FW, cancel the command timer */
 	if (adapter->cmd_timer_is_set) {
 		/* Cancel command timeout timer */
-		mwifiex_stop_timer(adapter->mwifiex_cmd_timer);
+		del_timer(&adapter->mwifiex_cmd_timer->tl);
+		adapter->mwifiex_cmd_timer->timer_is_canceled = true;
+		adapter->mwifiex_cmd_timer->time_period = 0;
 		/* Cancel command timeout timer */
 		adapter->cmd_timer_is_set = false;
 	}
drivers/net/wireless/mwifiex/init.c +3 -1
index d0a2556..51ce799 100644
@@ -360,7 +360,9 @@ mwifiex_free_adapter(struct mwifiex_adapter *adapter)
 
 	if (adapter->cmd_timer_is_set) {
 		/* Cancel command timeout timer */
-		mwifiex_stop_timer(adapter->mwifiex_cmd_timer);
+		del_timer(&adapter->mwifiex_cmd_timer->tl);
+		adapter->mwifiex_cmd_timer->timer_is_canceled = true;
+		adapter->mwifiex_cmd_timer->time_period = 0;
 		adapter->cmd_timer_is_set = false;
 	}
 
drivers/net/wireless/mwifiex/main.c +36 -9

64 lines not on this page · raw message

drivers/net/wireless/mwifiex/main.h +2 -9
index 620616a..010a68a 100644
@@ -482,7 +482,7 @@ struct mwifiex_tx_ba_stream_tbl {
 struct mwifiex_rx_reorder_tbl;
 
 struct reorder_tmr_cnxt {
-	void *timer;
+	struct mwifiex_drv_timer *timer;
 	u8 timer_is_set;
 	struct mwifiex_rx_reorder_tbl *ptr;
 	struct mwifiex_private *priv;
@@ -592,7 +592,7 @@ struct mwifiex_adapter {
 	void *mwifiex_cmd_lock;
 	u32 num_cmd_timeout;
 	u16 last_init_cmd;
-	void *mwifiex_cmd_timer;
+	struct mwifiex_drv_timer *mwifiex_cmd_timer;
 	u8 cmd_timer_is_set;
 	struct mwifiex_list_head cmd_free_q;
 	struct mwifiex_list_head cmd_pending_q;
@@ -704,13 +704,6 @@ enum mwifiex_status mwifiex_prepare_cmd(struct mwifiex_private *priv,
 
 void mwifiex_cmd_timeout_func(void *FunctionContext);
 
-enum mwifiex_status mwifiex_init_timer(void **timer,
-				       void (*callback) (void *context),
-				       void *context);
-enum mwifiex_status mwifiex_free_timer(void *timer);
-enum mwifiex_status mwifiex_start_timer(void *timer, u8 periodic,
-					u32 msec);
-enum mwifiex_status mwifiex_stop_timer(void *timer);
 enum mwifiex_status mwifiex_misc_ioctl_host_cmd(struct mwifiex_adapter
 						*adapter,
 						struct mwifiex_ioctl_req
drivers/net/wireless/mwifiex/util.c +0 -73

79 lines not on this page · raw message

drivers/net/wireless/mwifiex/util.h +0 -50

54 lines not on this page · raw message

Signature · 1 line
1.7.0.2