Index: driver/am930di.c
===================================================================
RCS file: /home/cvs/cvs/linux-wlan/driver/am930di.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- driver/am930di.c	2000/06/17 19:05:46	1.1.1.1
+++ driver/am930di.c	2000/06/24 14:59:51	1.2
@@ -241,14 +241,17 @@
 	{
 		am930mac_t	*mac;
 
+		/* Swapped with am930mac_destruct so that the mac still
+		   exists at destruction/deallocation time.
+		*/
+		am930DI_deconfig(instance);
+		
 		/* Destroy the subobjects */
 		mac = (am930mac_t*)instance->priv;
 		if ( mac != NULL )
 		{
 			am930mac_destruct(mac);
 		}
-
-		am930DI_deconfig(instance);
 
 		/* check to see if drvr_detach has been called previously and
 			expects to be called again.
Index: driver/am930llc.c
===================================================================
RCS file: /home/cvs/cvs/linux-wlan/driver/am930llc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.7
diff -u -r1.1.1.1 -r1.7
--- driver/am930llc.c	2000/06/17 19:05:47	1.1.1.1
+++ driver/am930llc.c	2000/06/25 20:25:14	1.7
@@ -78,6 +78,10 @@
 #include <linux/timer.h>
 #include <linux/errno.h>
 
+#ifdef WLAN_LINUX_24
+#include <linux/wait.h>
+#endif /* WLAN_LINUX_24 */
+
 /* Card and Driver services includes */
 #ifdef WLAN_PCMCIA
 #include <pcmcia/version.h>
@@ -167,6 +171,10 @@
 	{
 		memset( llc, 0, sizeof(am930llc_t));
 
+#ifdef WLAN_LINUX_24
+		init_waitqueue_head(&(llc->cmdwq));		
+#endif /* WLAN_LINUX_24 */
+		
 		llc->mac = mac;
 		llc->mgr = mgr;
 
@@ -190,6 +198,13 @@
 		}
 		memset( llc->dev->priv, 0, sizeof(devpriv_t));
 
+#ifdef WLAN_LINUX_24
+		/* This will get changed by register_netdev, and then we
+		   need to copy in the new name to the pcmcia area. */
+		strcpy(llc->dev->name, "eth%d");
+				
+#else /* WLAN_LINUX_24 */
+
 		/* the dev name field will point to the same memory used by the 
 			node_t field of the pcmcia di object */
 		#ifdef WLAN_PCMCIA
@@ -206,6 +221,7 @@
 		}
 		llc->dev->name[0] = '\0';
 		#endif
+#endif /* WLAN_LINUX_24 */
 
 		/* set the private data to point back at the llc */
 		V2P(llc->dev->priv)->llc = llc;
@@ -232,8 +248,17 @@
 			am930llc_destruct( llc );
 			llc = NULL;
 		}
+
 		WLAN_LOG_INFO1("Device %s registered\n", llc->dev->name);
 
+#ifdef WLAN_LINUX_24
+#ifdef WLAN_PCMCIA
+		/* Copy the name given to us by register_netdev into the
+		   buffer for the pcmcia routines. */
+		strcpy(((dev_link_t*)(llc->mac->di))->dev->dev_name, llc->dev->name);
+#endif
+#endif /* WLAN_LINUX_24 */
+
 #if 0
 		/* now set up the kernel timer */
 		init_timer(&llc->timer);
@@ -268,13 +293,9 @@
 	DBFENTER;
 	/* clear the expires field as a flag that we've timed out */
 	llc->timer.expires = 0;
-
-	/* Assume the timer was set up to watch us while an ioctl's in */
-	/*  the wait queue.  Check for NULL and if not, wake it */
-	if ( llc->cmdwq != NULL ){
-		wake_up_interruptible(&(llc->cmdwq));
-	}
 
+	am930_wake_up(llc->cmdwq);
+	
 	DBFEXIT;
 	return;
 }
@@ -324,7 +345,9 @@
 	if ( llc->dev != NULL )
 	{
 		del_timer(&llc->timer);
-		llc->dev->start = 0;
+
+		am930_netif_stop_queue(llc->dev);
+
 		unregister_netdev( llc->dev );
 		kfree(llc->dev);
 		llc->dev = NULL;
@@ -368,11 +391,9 @@
 {
 	DBFENTER;
 	
-	if ( llc->cmdwq != NULL ){
-		llc->cmdstatus = status;
-		wake_up_interruptible(&(llc->cmdwq));
-	}
-
+	llc->cmdstatus = status;
+	am930_wake_up(llc->cmdwq);
+	
 	DBFEXIT;
 	return;
 }
@@ -449,8 +470,10 @@
 				/* Now, do an interruptible_sleep, we'll be awakened by: */
 				/*  a signal the process, cmdtimerfunc (timeout), or llc_scancomplete */
 				interruptible_sleep_on(&(llc->cmdwq));
+#ifndef WLAN_LINUX_24
 				llc->cmdwq = NULL;
-
+#endif
+				
 				/* If sleep return is via signal */
 				if ( signal_pending(current) ) {
 					WLAN_LOG_DEBUG0(2,"Scan unblocked via signal\n");
@@ -578,7 +601,9 @@
 				/* Now, do an interruptible_sleep, we'll be awakened by: */
 				/*  a signal the process, cmdtimerfunc (timeout), or llc_scancomplete */
 				interruptible_sleep_on(&(llc->cmdwq));
+#ifndef WLAN_LINUX_24
 				llc->cmdwq = NULL;
+#endif 
 
 				/* If sleep return is via signal */
 				if ( signal_pending(current) ) {
@@ -622,7 +647,9 @@
 				/* Now, do an interruptible_sleep, we'll be awakened by: */
 				/*  a signal the process, cmdtimerfunc (timeout), or llc_scancomplete */
 				interruptible_sleep_on(&(llc->cmdwq));
+#ifndef WLAN_LINUX_24
 				llc->cmdwq = NULL;
+#endif 
 
 				/* If sleep return is via signal */
 				if ( signal_pending(current) ) {
@@ -855,80 +882,88 @@
 
 	DBFENTER;
 
-	if ( dev->start == 1 )
-	{
-		/* If some higher layer thinks we've missed a tx-done, we are passed
-			NULL. Caution: dev_tint handles the cli/sti ..
-		*/
+#ifndef WLAN_LINUX_24	
+	if (! dev->start == 1) {
+		DBFEXIT;
+		return result;
+	}
+
+	/* If some higher layer thinks we've missed a tx-done, we are passed
+	   NULL. Caution: dev_tint handles the cli/sti ..
+	*/
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,25))
-		if ( skb == NULL )
-		{
-			dev->tbusy = 0;
-			dev_tint(dev);
-			return 0;
-		}
+	if ( skb == NULL )
+	{
+		dev->tbusy = 0;
+		dev_tint(dev);
+		return 0;
+	}
+#endif
+		
+	if ( test_and_set_bit(0, (void*)&(dev->tbusy)) != 0 )
+	{
+		/* TODO: add a f/w reset capability here. see skeleton.c */
+		WLAN_LOG_DEBUG2(1, "called when tbusy set,"
+				"txllc.len=%d txmac.len=%d\n",
+				llc->mac->llcq->len,
+				llc->mac->macq->len);
+		result = 1;
+		DBFEXIT;
+		return result;
+	}
 #endif
+	
+	am930_netif_stop_queue(dev);
+	
+	dev->trans_start = jiffies;
 
-		if ( test_and_set_bit(0, (void*)&(dev->tbusy)) != 0 )
+	/* OK, now we setup the ether to 802.11 conversion */
+	pb = am930llc_pballoc();
+
+	if ( pb != NULL )
+	{
+		pb->ethhostbuf = skb;
+		pb->ethfree = am930llc_pbfreeskb;
+		pb->ethbuf = skb->data;
+		pb->ethbuflen = skb->len;
+		pb->ethfrmlen = skb->len;
+		pb->eth_hdr = (wlan_ethhdr_t*)pb->ethbuf;
+
+		if ( am930llc_pb_ether_to_p80211( llc, pb) != 0 )
 		{
-			/* TODO: add a f/w reset capability here. see skeleton.c */
-			WLAN_LOG_DEBUG2(1, "called when tbusy set,"
-			                   "txllc.len=%d txmac.len=%d\n",
-							   llc->mac->llcq->len,
-							   llc->mac->macq->len);
+				/* convert failed */
 			result = 1;
+			am930llc_pbfree(pb);
 		}
 		else
 		{
-			dev->trans_start = jiffies;
-
-			/* OK, now we setup the ether to 802.11 conversion */
-			pb = am930llc_pballoc();
-
-			if ( pb != NULL )
-			{
-				pb->ethhostbuf = skb;
-				pb->ethfree = am930llc_pbfreeskb;
-				pb->ethbuf = skb->data;
-				pb->ethbuflen = skb->len;
-				pb->ethfrmlen = skb->len;
-				pb->eth_hdr = (wlan_ethhdr_t*)pb->ethbuf;
-
-				if ( am930llc_pb_ether_to_p80211( llc, pb) != 0 )
-				{
-					/* convert failed */
-					result = 1;
-					am930llc_pbfree(pb);
-				}
-				else
-				{
-					txresult = 
-						am930mac_txllc( llc->mac, pb->eth_hdr->daddr,
-									 pb->eth_hdr->saddr, pb);
+			txresult = 
+				am930mac_txllc( llc->mac, pb->eth_hdr->daddr,
+						pb->eth_hdr->saddr, pb);
 		
-					if ( txresult == 0)  /* success and more buf avail, re: hw_txdata */
-					{
-						dev->tbusy = 0;
-						result = 0;
-					}
-					else if ( txresult == 1 ) /* success, no more avail */
-					{
-						result = 0;
-					}
-					else if ( txresult == 2 ) /* alloc failure, drop frame */
-					{
-						result = 0;
-						am930llc_pbfree(pb);
-					}
-					else /* buffer full or queue busy */
-					{
-						result = 1;
-						pb->ethfree = NULL;
-					}
-				}
+			if ( txresult == 0)  /* success and more buf avail, re: hw_txdata */
+			{
+				am930_netif_wake_queue(dev);
+				result = 0;
+			}
+			else if ( txresult == 1 ) /* success, no more avail */
+			{
+				result = 0;
+			}
+			else if ( txresult == 2 ) /* alloc failure, drop frame */
+			{
+				result = 0;
+				am930llc_pbfree(pb);
+			}
+			else /* buffer full or queue busy */
+			{
+				result = 1;
+				pb->ethfree = NULL;
 			}
 		}
 	}
+	
+
 
 	DBFEXIT;
 	return result;
@@ -947,11 +982,8 @@
 	int result = 0;
 	DBFENTER;
 
-	/* set the flags in the device object */
-	dev->tbusy = 0;
-	dev->interrupt = 0;
-	dev->start = 1;
-
+	am930_netif_start_queue(dev);
+	
 	#ifdef WLAN_PCMCIA
 	MOD_INC_USE_COUNT;
 	#endif
@@ -974,9 +1006,8 @@
 
 	DBFENTER;
 
-	/* set the flags in the device object */
-	dev->start = 0;
-	dev->tbusy = 1;
+	/* Does tbusy need to be set here in 2.2? */
+	am930_netif_stop_queue(dev);
 
 	#ifdef WLAN_PCMCIA
 	MOD_DEC_USE_COUNT;
@@ -1446,9 +1477,11 @@
 
 	DBFENTER;
 
+#ifndef WLAN_LINUX_24
 	llc->dev->interrupt = 1;
-
-	if ( llc->dev->start )
+#endif
+	
+	if ( am930_netif_running(llc->dev) )
 	{
 		if ( am930llc_pb_p80211_to_ether(llc, pb) == 0 )
 		{
@@ -1470,7 +1503,9 @@
 		}
 	}
 
+#ifndef WLAN_LINUX_24
 	llc->dev->interrupt = 0;
+#endif
 
 	am930llc_pbfree(pb);
 
@@ -1631,8 +1666,10 @@
 		V2P(llc->dev->priv)->stats.tx_packets++;
 	}
 
-	llc->dev->tbusy = 0;
+	am930_netif_wake_queue(llc->dev);
+#ifndef WLAN_LINUX_24
 	mark_bh(NET_BH);
+#endif 
 
 	DBFEXIT;
 	return;
Index: driver/am930llc.h
===================================================================
RCS file: /home/cvs/cvs/linux-wlan/driver/am930llc.h,v
retrieving revision 1.1.1.1
retrieving revision 1.5
diff -u -r1.1.1.1 -r1.5
--- driver/am930llc.h	2000/06/17 19:05:47	1.1.1.1
+++ driver/am930llc.h	2000/06/25 20:25:14	1.5
@@ -17,12 +17,53 @@
 *   <mark@absoval.com>.  Portions created by Mark S. Mathews
 *   are Copyright (C) 1998 AbsoluteValue Software, Inc.  All Rights Reserved.
 *
-*	--------------------------------------------------------------------
-*/
+*	-------------------------------------------------------------------- */
 
 #ifndef _LINUX_AM930LLC_H
 #define _LINUX_AM930LLC_H
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0))
+/* Well, the old code broke in 2.3.0, so that seems like as good a point
+   as any to make the cutoff. However, the port to 2.4 actually only
+   starts working somewhere later in the 2.3 series. */
+#define WLAN_LINUX_24
+#endif
+
+#ifdef WLAN_LINUX_24
+
+#define am930_wake_up(x) wake_up_interruptible(&(x))
+
+#define am930_netif_stop_queue netif_stop_queue
+#define am930_netif_wake_queue netif_wake_queue
+#define am930_netif_start_queue netif_start_queue
+#define am930_netif_running netif_running
+
+#else /* WLAN_LINUX_24 */
+
+#define am930_wake_up(x) \
+	if (x != NULL) wake_up_interruptible(&(x))
+
+#define am930_netif_stop_queue(x) { \
+	(x)->tbusy = 1;\
+ 	(x)->start = 0;\
+}
+
+#define am930_netif_wake_queue(x) { \
+	(x)->tbusy = 0; \
+ 	(x)->start = 1; \
+}
+
+#define am930_netif_start_queue(x) { \
+	(x)->tbusy = 0; \
+	(x)->interrupt = 0; \
+	(x)->start = 1; \
+}
+
+#define am930_netif_running(x) ((x)->start)
+
+#endif /* WLAN_LINUX_24 */
+
+
 /*=============================================================*/
 /*--- Constants -----------------------------------------------*/
 /*=============================================================*/
@@ -261,7 +302,12 @@
 	UINT				cmdbusy;
 	UINT				currcmd;
 	struct timer_list	cmdtimer;	/* ioctl cmd timeout timer */
+
+#ifdef WLAN_LINUX_24
+	wait_queue_head_t cmdwq;
+#else
 	struct wait_queue	*cmdwq;		/* ioctl blocking wait queue */
+#endif
 
 	/* Implementation specific config items */
 	int					ethconv;
