This patch fixes up the zd1211rw git tree to account for the work
queue changes in 2.6.20+.

--
Jon Smirl
[EMAIL PROTECTED]
diff --git a/zd_mac.c b/zd_mac.c
index 10339f5..ee78cd8 100644
--- a/zd_mac.c
+++ b/zd_mac.c
@@ -32,14 +32,14 @@ #include "zd_util.h"
 
 static void ieee_init(struct ieee80211_device *ieee);
 static void softmac_init(struct ieee80211softmac_device *sm);
-static void set_rts_cts_work(void *d);
-static void set_basic_rates_work(void *d);
+static void set_rts_cts_work(struct work_struct *work);
+static void set_basic_rates_work(struct work_struct *work);
 
 static void housekeeping_init(struct zd_mac *mac);
 static void housekeeping_enable(struct zd_mac *mac);
 static void housekeeping_disable(struct zd_mac *mac);
 
-static void set_multicast_hash_handler(void *mac_ptr);
+static void set_multicast_hash_handler(struct work_struct *work);
 
 static void do_rx(unsigned long mac_ptr);
 
@@ -52,8 +52,8 @@ int zd_mac_init(struct zd_mac *mac,
 	memset(mac, 0, sizeof(*mac));
 	spin_lock_init(&mac->lock);
 	mac->netdev = netdev;
-	INIT_WORK(&mac->set_rts_cts_work, set_rts_cts_work, mac);
-	INIT_WORK(&mac->set_basic_rates_work, set_basic_rates_work, mac);
+	INIT_DELAYED_WORK(&mac->set_rts_cts_work, set_rts_cts_work);
+	INIT_DELAYED_WORK(&mac->set_basic_rates_work, set_basic_rates_work);
 
 	skb_queue_head_init(&mac->rx_queue);
 	tasklet_init(&mac->rx_tasklet, do_rx, (unsigned long)mac);
@@ -63,8 +63,7 @@ int zd_mac_init(struct zd_mac *mac,
 	softmac_init(ieee80211_priv(netdev));
 	zd_chip_init(&mac->chip, netdev, intf);
 	housekeeping_init(mac);
-	INIT_WORK(&mac->set_multicast_hash_work, set_multicast_hash_handler,
-		  mac);
+	INIT_WORK(&mac->set_multicast_hash_work, set_multicast_hash_handler);
 	return 0;
 }
 
@@ -273,9 +272,10 @@ int zd_mac_set_mac_address(struct net_de
 	return 0;
 }
 
-static void set_multicast_hash_handler(void *mac_ptr)
+static void set_multicast_hash_handler(struct work_struct *work)
 {
-	struct zd_mac *mac = mac_ptr;
+	struct zd_mac *mac = container_of(work, struct zd_mac,
+										set_multicast_hash_work);
 	struct zd_mc_hash hash;
 
 	spin_lock_irq(&mac->lock);
@@ -419,9 +419,10 @@ static void try_enable_tx(struct zd_mac 
 	spin_unlock_irqrestore(&mac->lock, flags);
 }
 
-static void set_rts_cts_work(void *d)
+static void set_rts_cts_work(struct work_struct *work)
 {
-	struct zd_mac *mac = d;
+	struct zd_mac *mac =
+			container_of(work, struct zd_mac, set_rts_cts_work.work);
 	unsigned long flags;
 	u8 rts_rate;
 	unsigned int short_preamble;
@@ -440,9 +441,10 @@ static void set_rts_cts_work(void *d)
 	try_enable_tx(mac);
 }
 
-static void set_basic_rates_work(void *d)
+static void set_basic_rates_work(struct work_struct *work)
 {
-	struct zd_mac *mac = d;
+	struct zd_mac *mac =
+			container_of(work, struct zd_mac, set_rts_cts_work.work);
 	unsigned long flags;
 	u16 basic_rates;
 
@@ -520,12 +522,12 @@ static void bssinfo_change(struct net_de
 	if (need_set_rts_cts && !mac->updating_rts_rate) {
 		mac->updating_rts_rate = 1;
 		netif_stop_queue(mac->netdev);
-		queue_work(zd_workqueue, &mac->set_rts_cts_work);
+		queue_delayed_work(zd_workqueue, &mac->set_rts_cts_work, 0);
 	}
 	if (need_set_rates && !mac->updating_basic_rates) {
 		mac->updating_basic_rates = 1;
 		netif_stop_queue(mac->netdev);
-		queue_work(zd_workqueue, &mac->set_basic_rates_work);
+		queue_delayed_work(zd_workqueue, &mac->set_basic_rates_work, 0);
 	}
 	spin_unlock_irqrestore(&mac->lock, flags);
 }
@@ -1270,7 +1272,7 @@ struct iw_statistics *zd_mac_get_wireles
 
 /* Prevents requeuing while housekeeping is disabled. */
 static int housekeeping_queue_delayed_work(struct zd_mac *mac,
-				       struct work_struct *work,
+				       struct delayed_work *work,
 				       unsigned long delay)
 {
 	int enabled;
@@ -1285,7 +1287,7 @@ static int housekeeping_queue_delayed_wo
 }
 
 static void housekeeping_cancel_delayed_work(struct zd_mac *mac,
-	                                     struct work_struct *work)
+	                                     struct delayed_work *work)
 {
 	int i;
 
@@ -1322,10 +1324,11 @@ static int average_rssi(struct zd_mac *m
 	return total/count;
 }
 
-static void signal_strength_monitor(void *p)
+static void signal_strength_monitor(struct work_struct *work)
 {
+	struct zd_mac *mac =
+			container_of(work, struct zd_mac, housekeeping.signal_strength_work.work);
 	int r;
-	struct zd_mac *mac = p;
 	int strong_signal;
 	int rssi;
 
@@ -1358,10 +1361,11 @@ out:
 
 #define LINK_LED_WORK_DELAY HZ
 
-static void link_led_handler(void *p)
+static void link_led_handler(struct work_struct *work)
 {
+	struct zd_mac *mac =
+			container_of(work, struct zd_mac, housekeeping.link_led_work.work);
 	int r;
-	struct zd_mac *mac = p;
 	struct zd_chip *chip = &mac->chip;
 	struct ieee80211softmac_device *sm = ieee80211_priv(mac->netdev);
 	int is_associated;
@@ -1382,11 +1386,11 @@ static void link_led_handler(void *p)
 
 static void housekeeping_init(struct zd_mac *mac)
 {
-	INIT_WORK(&mac->housekeeping.signal_strength_work,
-		  signal_strength_monitor, mac);
+	INIT_DELAYED_WORK(&mac->housekeeping.signal_strength_work,
+		  signal_strength_monitor);
 	mac->housekeeping.strong_signal = -1;
 
-	INIT_WORK(&mac->housekeeping.link_led_work, link_led_handler, mac);
+	INIT_DELAYED_WORK(&mac->housekeeping.link_led_work, link_led_handler);
 }
 
 static void housekeeping_enable(struct zd_mac *mac)
diff --git a/zd_mac.h b/zd_mac.h
index b882d45..ba5fb78 100644
--- a/zd_mac.h
+++ b/zd_mac.h
@@ -121,8 +121,8 @@ #define ZD_RX_ERROR			0x80
 #define ZD_RX_STRONG_SIGNAL_BOUNDARY	0x3a
 
 struct housekeeping {
-	struct work_struct signal_strength_work;
-	struct work_struct link_led_work;
+	struct delayed_work signal_strength_work;
+	struct delayed_work link_led_work;
 	unsigned int enabled:1;
 	signed int strong_signal:2;
 };
@@ -140,8 +140,8 @@ struct zd_mac {
 	struct housekeeping housekeeping;
 	struct work_struct set_multicast_hash_work;
 	struct zd_mc_hash multicast_hash;
-	struct work_struct set_rts_cts_work;
-	struct work_struct set_basic_rates_work;
+	struct delayed_work set_rts_cts_work;
+	struct delayed_work set_basic_rates_work;
 
 	struct tasklet_struct rx_tasklet;
 	struct sk_buff_head rx_queue;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Zd1211-devs mailing list - http://zd1211.ath.cx/
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/zd1211-devs

Reply via email to