[PATCH] libertas: pull current channel from firmware on mesh autostart

luisca at cozybit.com luisca at cozybit.com
Mon May 7 21:29:23 EDT 2007


---
 drivers/net/wireless/libertas/assoc.c   |    9 +++++++++
 drivers/net/wireless/libertas/assoc.h   |    2 ++
 drivers/net/wireless/libertas/cmdresp.c |    2 ++
 drivers/net/wireless/libertas/dev.h     |    1 +
 drivers/net/wireless/libertas/main.c    |    1 +
 5 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 4735ca4..25d3795 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -720,3 +720,12 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
 
 	return assoc_req;
 }
+
+void libertas_sync_channel ( struct work_struct *work)
+{
+	 wlan_private *priv = 
+		container_of(work, wlan_private, sync_channel) ;
+	int status = update_channel(priv) ;
+	if (status != 0)
+		lbs_pr_info("Channel synchronization failed.") ;
+}
diff --git a/drivers/net/wireless/libertas/assoc.h b/drivers/net/wireless/libertas/assoc.h
index b5eddf8..5e9c31f 100644
--- a/drivers/net/wireless/libertas/assoc.h
+++ b/drivers/net/wireless/libertas/assoc.h
@@ -9,6 +9,8 @@ void libertas_association_worker(struct work_struct *work);
 
 struct assoc_request * wlan_get_association_request(wlan_adapter *adapter);
 
+void libertas_sync_channel(struct work_struct *work);
+
 #define ASSOC_DELAY (HZ / 2)
 static inline void wlan_postpone_association_work(wlan_private *priv)
 {
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index b286d2d..edb38c7 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -14,6 +14,7 @@
 #include "dev.h"
 #include "join.h"
 #include "wext.h"
+#include "assoc.h"
 
 /** 
  *  @brief This function handles disconnect event. it
@@ -1017,6 +1018,7 @@ int libertas_process_event(wlan_private * priv)
 			netif_carrier_on(priv->mesh_dev) ;
 		}
 		adapter->mode = IW_MODE_ADHOC ;
+		schedule_work(&priv->sync_channel) ;
 		break;
 
 	default:
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 7dfb120..8661a52 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -149,6 +149,7 @@ struct _wlan_private {
 
 	struct delayed_work assoc_work;
 	struct workqueue_struct *assoc_thread;
+	struct work_struct sync_channel ;
 
 	/** Hardware access */
 	int (*hw_register_dev) (wlan_private * priv);
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 2f9f737..02d2c52 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -843,6 +843,7 @@ int libertas_activate_card(wlan_private *priv, char *fw_name)
 	priv->assoc_thread =
 		create_singlethread_workqueue("libertas_assoc");
 	INIT_DELAYED_WORK(&priv->assoc_work, libertas_association_worker);
+	INIT_WORK(&priv->sync_channel, libertas_sync_channel);
 
 	/*
 	 * Register the device. Fillup the private data structure with
-- 
1.4.4.2




More information about the libertas-dev mailing list