Patch to make the vendor driver, ZD1211LnxDrv_2_16_0_0, build on
2.6.20-rc20. It also fixes what looks to be some definite problems
with uninitialized variables.

--
Jon Smirl
[EMAIL PROTECTED]
diff --git a/Makefile b/Makefile
index 2118ac3..624b912 100755
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ rM=rm -f -r
 
 # if the kernel is 2.6.x, trun on this
 KERN_26=y
-KERNEL_SOURCE=/usr/src/linux-2.6.9
+KERNEL_SOURCE=/lib/modules/`uname -r`/build
 
 # if the kernel is 2.4.x, trun on this
 #KERN_24=y
@@ -254,9 +254,9 @@ install: 
 	@echo "'make install' isn't required"
 else
 install: all
-	mkdir -p $(MODPATH)/net
-	cp $(MODULE) $(MODPATH)/net
-	depmod -a
+	sudo mkdir -p $(MODPATH)/kernel/drivers/net/wireless
+	sudo cp $(MODULE) $(MODPATH)/kernel/drivers/net/wireless
+	sudo depmod -a
 endif
 
 debug:
diff --git a/src/zd1205.c b/src/zd1205.c
index b4253c4..8e33730 100755
--- a/src/zd1205.c
+++ b/src/zd1205.c
@@ -31,7 +31,7 @@
 * -------------------------------------------------------------------- */
 #define __KERNEL_SYSCALLS__
 
-#include <linux/config.h>
+#include <linux/autoconf.h>
 #include <net/checksum.h>
 #include <linux/tcp.h>
 #include <linux/udp.h>
@@ -202,7 +202,6 @@ u8 CalculateQuality(struct zd1205_privat
 void zd1205_initCAM(struct zd1205_private *macp);
 int zd1205_CheckOverlapBss(struct zd1205_private *macp, plcp_wla_Header_t *pWlanHdr, u8 *pMacBody, u32 bodyLen);
 void zd1205_HandleQosRequest(struct zd1205_private *macp);
-void zd1205_SetRatesInfo(struct zd1205_private *macp);
 
 u8 X_To_dB(u32 X, u8 rate);
 u16 ZDLog10multiply100(int data);
@@ -446,7 +445,7 @@ struct iw_handler_def p80211wext_handler
 	private: (iw_handler *) zd1205_private_handler,
 	private_args: (struct iw_priv_args *) zd1205_private_args,
     #if WIRELESS_EXT > 18
-        get_wireless_stats: (struct iw_statistics * )zd1205_iw_getstats
+        get_wireless_stats: zd1205_iw_getstats
     #endif
 };
 #endif
@@ -476,10 +475,10 @@ static void wait_ms(unsigned int ms)
 		mdelay(ms);
 }
 
-asmlinkage _syscall3(int,write,int,fd,const char *,buf,off_t,count)
-asmlinkage _syscall3(int,read,int,fd,char *,buf,off_t,count)
-asmlinkage _syscall3(int,open,const char *,file,int,flag,int,mode)
-asmlinkage _syscall1(int,close,int,fd)
+//asmlinkage _syscall3(int,write,int,fd,const char *,buf,off_t,count)
+//asmlinkage _syscall3(int,read,int,fd,char *,buf,off_t,count)
+//asmlinkage _syscall3(int,open,const char *,file,int,flag,int,mode)
+//asmlinkage _syscall1(int,close,int,fd)
 #endif
 const U16 dot11A_Channel[]={36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,132,136,140,184,188,192,196,8,12,16,34,38,42,46,149,153,157,161,165};
 const U16 dot11A_Channel_Amount=sizeof(dot11A_Channel)/sizeof(U16);
@@ -5002,6 +5001,9 @@ zd1205_xmit_frame(struct sk_buff *skb, s
  	int rc = 0;
  	int notify_stop = false;
 	struct zd1205_private *macp = dev->priv;
+#if AAAA03_FIX == 1
+    struct sk_buff *new_skb = NULL;
+#endif
 
 	u16 TypeLen;
 	u8 *pHdr = skb->data;
@@ -5022,7 +5024,6 @@ zd1205_xmit_frame(struct sk_buff *skb, s
     BOOLEAN bHashSearchResult;
 	ZENTER(2);
 #if AAAA03_FIX == 1
-    struct skb_buff *new_skb = NULL;
     new_skb = skb_copy(skb, GFP_ATOMIC);
     while(!new_skb) printk("new skb is NULL\n");
     dev_kfree_skb_irq(skb);
@@ -8269,8 +8270,14 @@ #ifdef ZDCONF_MENUDBG
             }
             zd1205_lock(macp);
             zd1205_zd_dbg2_ioctl(macp, &zdreq,&ret);
-            copy_from_user(&in,((struct zdap_ioctl *)(ifr->ifr_data))->data,4);
-            copy_to_user(((struct zdap_ioctl *)(ifr->ifr_data))->data, &ret, sizeof(ret));
+            if (copy_from_user(&in,((struct zdap_ioctl *)(ifr->ifr_data))->data,4)){
+	            zd1205_unlock(macp);
+                return -EFAULT;
+            }
+            if(copy_to_user(((struct zdap_ioctl *)(ifr->ifr_data))->data, &ret, sizeof(ret))){
+	            zd1205_unlock(macp);
+                return -EFAULT;
+            }
             zd1205_unlock(macp);
             err = 0;
 	}
@@ -8684,7 +8691,8 @@ #endif		
 
 void zd1205_load_card_setting(struct zd1205_private *macp, u8 bInit)
 {
-	int ifp;
+	//int ifp;
+	struct file *filp = NULL;
 	int bcount = 0;
 	mm_segment_t fs;
 	unsigned int file_length;
@@ -8705,12 +8713,17 @@ void zd1205_load_card_setting(struct zd1
 	set_fs(KERNEL_DS);
 
 	// open the file with the firmware for uploading
-	if (ifp = open(config_filename, O_RDONLY, 0 ), ifp < 0){
+	//if (ifp = open(config_filename, O_RDONLY, 0 ), ifp < 0){
+	filp = filp_open(config_filename, O_RDONLY, 0);
+printk("Filp is %p, %s\n", filp, config_filename);
+	if (IS_ERR_VALUE(PTR_ERR(filp))){
 		// error opening the file
-		ZD1211DEBUG(0, "File opening did not success\n");
+		ZD1211DEBUG(0, "File opening did not success %lu\n", PTR_ERR(filp));
 		set_fs(fs);
 		return;
 	}
+printk("Filp->f_op is %p\n", filp->f_op);
+	get_file(filp);
 
 	/* Get information about the file. */
 	//fstat (ifp, &file_info);
@@ -8722,11 +8735,13 @@ void zd1205_load_card_setting(struct zd1
 	old_buffer = buffer;
 
 	/* Read the file into the buffer. */
-	bcount = read(ifp, buffer, file_length);
+	//bcount = read(ifp, buffer, file_length);
+	bcount = filp->f_op->read(filp, buffer, file_length, 0);
 	ZD1211DEBUG(1, "bcount=%d\n", bcount);
 
 	// close the file
-	close(ifp);
+	//close(ifp);
+	filp_close(filp, 0);
 
 	// switch back the segment setting
 	set_fs(fs);
@@ -8805,7 +8820,8 @@ void zd1205_load_card_setting(struct zd1
 
 void zd1205_save_card_setting(struct zd1205_private *macp)
 {
-	int ifp;
+	//int ifp;
+	struct file *filp = NULL;
 	int bcount = 0;
 	mm_segment_t fs;
 	unsigned int file_length;
@@ -8825,12 +8841,15 @@ void zd1205_save_card_setting(struct zd1
 	set_fs(KERNEL_DS);
 
 	// open the file with the firmware for uploading
-	if (ifp = open(config_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666 ), ifp < 0){
+	//if (ifp = open(config_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666 ), ifp < 0){
+	filp = filp_open(config_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666 );
+	if (IS_ERR_VALUE(PTR_ERR(filp))){
 		// error opening the file
-		ZD1211DEBUG(0, "File opening did not success\n");
+		ZD1211DEBUG(0, "File opening did not success %lu\n", PTR_ERR(filp));
 		set_fs(fs);
 		return;
 	}
+	get_file(filp);
 
 	/* Get information about the file. */
 	//fstat (ifp, &file_info);
@@ -8878,11 +8897,13 @@ void zd1205_save_card_setting(struct zd1
     
 	/* Write the file into the buffer. */
 	ZD1211DEBUG(1, "write_byte=%d\n", write_byte);
-	bcount = write(ifp, old_buffer, write_byte);
+	//bcount = write(ifp, old_buffer, write_byte);
+	bcount = filp->f_op->write(filp, old_buffer, write_byte, 0);
 	ZD1211DEBUG(1, "bcount=%d\n", bcount);
 
 	// close the file
-	close(ifp);
+	//close(ifp);
+	filp_close(filp, 0);
 
 	// switch back the segment setting
 	set_fs(fs);
diff --git a/src/zd1205.h b/src/zd1205.h
index 3cbf206..ef76f56 100755
--- a/src/zd1205.h
+++ b/src/zd1205.h
@@ -1247,6 +1247,7 @@ #define ZDPRODUCTIOCTL          0x89FA
 **		Function Declarations
 ***************************************************************************
 */
+void zd1205_SetRatesInfo(struct zd1205_private *macp);
 void zd1205_sleep_reset(struct zd1205_private *macp);
 void zd1205_sw_reset(struct zd1205_private *macp);
 void zd1205_watchdog_cb(struct net_device *);
diff --git a/src/zd1205_proc.c b/src/zd1205_proc.c
index 7158892..df33f24 100755
--- a/src/zd1205_proc.c
+++ b/src/zd1205_proc.c
@@ -30,7 +30,7 @@
 *
 * -------------------------------------------------------------------- */
 
-#include <linux/config.h>
+#include <linux/autoconf.h>
 
 #ifdef CONFIG_PROC_FS
 #include "zd1205.h"
diff --git a/src/zd1211.c b/src/zd1211.c
index 8ec227f..83318aa 100755
--- a/src/zd1211.c
+++ b/src/zd1211.c
@@ -30,7 +30,7 @@
 *
 * -------------------------------------------------------------------- */
 
-#include <linux/config.h>
+#include <linux/autoconf.h>
 #include <net/checksum.h>
 #include <linux/tcp.h>
 #include <linux/udp.h>
@@ -1563,7 +1563,7 @@ #if fPROG_FLASH_BY_FW
 	u16  WriteIndex = 0;
 #endif
 
-#if fVERIFY_FLASH
+#ifdef fVERIFY_FLASH
 	u16  ReadAddr[cMAX_MULTI_READ_REG_NUM];
 	u16  ReadData[cMAX_MULTI_READ_REG_NUM];
 	u16  ReadIndex = 0;
@@ -1806,6 +1806,22 @@ int zd1211_ioctl(struct net_device *dev,
 	return 0;
 }
 
+void process_event(struct zd1205_private *macp);
+void scan_tout_event(struct work_struct *work)
+{
+	struct zd1205_private *macp = 
+		container_of(work, struct zd1205_private, scan_tout_event);
+	process_event(macp);
+}
+
+void kevent(struct work_struct *work)
+{
+	struct zd1205_private *macp = 
+		container_of(work, struct zd1205_private, kevent);
+	process_event(macp);
+}
+	
+
 #define	ZD1211_TX_TIMEOUT		(HZ*10)
 #define	ZD1211_MTU			1500
 extern struct iw_handler_def p80211wext_handler_def;
@@ -1827,8 +1843,8 @@ u8 zd1211_InitSetup(struct net_device *d
 	spin_lock_init(&(macp->q_lock));
 	spin_lock_init(&(macp->cs_lock));
     
-	INIT_WORK(&macp->kevent, kevent, macp);
-	INIT_WORK(&macp->scan_tout_event, kevent, macp);	
+	INIT_WORK(&macp->kevent, kevent);
+	INIT_WORK(&macp->scan_tout_event, scan_tout_event);	
 
 	macp->numTcb = NUM_TCB;
 	macp->numTbd = NUM_TBD;
@@ -1906,7 +1922,7 @@ #endif
 	dev->set_multicast_list = zd1205_set_multi;
 	dev->get_stats = zd1205_get_stats;
 #if ZDCONF_WE_STAT_SUPPORT == 1
-	dev->get_wireless_stats = zd1205_iw_getstats;
+	//dev->get_wireless_stats = zd1205_iw_getstats;
 #elif !defined(ZDCONF_WE_STAT_SUPPORT)
 	#error "Undefine ZDCONF_WE_STAT_SUPPORT"
 #endif
@@ -2286,20 +2302,7 @@ #endif
 	spin_unlock(&macp->intr_lock);
 }	
 
-
-
-
-
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 void zd1211_rx_comp_cb(struct urb *urb)
-#else
-void zd1211_rx_comp_cb(struct urb *urb, struct pt_regs *regs)
-#endif
-
-
-
-
 {
 	struct zd1205_private *macp = urb->context;
 
@@ -2390,11 +2393,7 @@ #endif
 
 
 //callback function for interrupt or response 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 void zd1211_intr_cb(struct urb *urb)
-#else
-void zd1211_intr_cb(struct urb *urb, struct pt_regs *regs)
-#endif
 {
 	struct zd1205_private *macp = urb->context;
 	u16 intNum;
@@ -2541,11 +2540,7 @@ #endif    
 
 
 //callback function for register get/set
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 void zd1211_reg_cb(struct urb *urb)
-#else
-void zd1211_reg_cb(struct urb *urb, struct pt_regs *regs)
-#endif
 {
 	struct zd1205_private *macp = urb->context;
 	set_bit(ZD1211_CMD_FINISH, &macp->flags);
@@ -2708,12 +2703,7 @@ #endif       
 	
 
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 void zd1211_tx_comp_cb(struct urb *urb)
-#else
-void zd1211_tx_comp_cb(struct urb *urb, struct pt_regs *regs)
-
-#endif
 {
 struct zd1205_private *macp = urb->context;
 	
@@ -3442,9 +3432,9 @@ void defer_kevent(struct zd1205_private 
 
 }    
 unsigned int smp_kevent_Lock = 0;
-void kevent(void *data)
-{
-    struct zd1205_private *macp = (struct zd1205_private *) data;
+
+void process_event(struct zd1205_private *macp)
+{		
     if (!macp->bUSBDeveiceAttached)
     {
         return;
diff --git a/src/zd1211.h b/src/zd1211.h
index 993a4f6..2eced3f 100755
--- a/src/zd1211.h
+++ b/src/zd1211.h
@@ -187,17 +187,10 @@ void ZD1211_WRITE_MULTI_REG(u16  *pAddre
 int zd1211_USB_SET_RF_REG(u16 *InputValue, int bIs3683A);
 int zd1211_submit_rx_urb(struct zd1205_private *macp);
 int zd1211_submit_tx_urb(struct zd1205_private *macp,BOOLEAN LastFrag);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 void zd1211_tx_comp_cb(struct urb *urb);
 void zd1211_rx_comp_cb(struct urb *urb);
 void zd1211_intr_cb(struct urb *urb);
 void zd1211_reg_cb(struct urb *urb);
-#else
-void zd1211_tx_comp_cb(struct urb *urb, struct pt_regs *regs);
-void zd1211_rx_comp_cb(struct urb *urb, struct pt_regs *regs);
-void zd1211_intr_cb(struct urb *urb, struct pt_regs *regs);
-void zd1211_reg_cb(struct urb *urb, struct pt_regs *regs);
-#endif
 void zd1211_disable_net_traffic(struct zd1205_private *macp);
 int zd1211_USB_ProgramFlash(struct zd1205_private *macp, u16 *Value, u16 RegCount);
 int zd1211_LoadUSBSpecCode(struct zd1205_private *macp, u8 *pBuffer, u32 uImgLength, u16 uCodeOfst, u8 bReboot);
@@ -205,7 +198,6 @@ int zd1211_Download_IncludeFile(struct z
 int zd1211_GetUSBSpecData(struct zd1205_private *macp, u8 *pBuffer, u32 uImgLength, u16 uCodeOfst);
 int zd1211_DownLoadUSBCode(struct zd1205_private *macp, u8* FileName, void *ptr, u16 uCodeOfst);
 int zd1211_WriteMultiRegister(u16 *Address, u16 *Value, u16 RegCount, u8 bAddUSBCSRAddress);
-void kevent(void *data);
 void defer_kevent(struct zd1205_private *macp, int flag);
 void zd1211_rx_isr(unsigned long parm);
 void zd1211_tx_isr(unsigned long parm);
diff --git a/src/zdapi.h b/src/zdapi.h
index 2cb4651..433ae6b 100755
--- a/src/zdapi.h
+++ b/src/zdapi.h
@@ -508,7 +508,7 @@ #endif
 	U32	(* EnterCS)(void);								// disable interrupt
 	U32 	(* Vir2PhyAddr)(U32 virtAddr);							// translate virtual address to physical address
 	BOOLEAN	(* CheckTCBAvail)(U8 NumOfFrag);						// check TCB available
-	void	(* DelayUs)(U16 ustime);								// delay function
+	void	(* DelayUs)(U32 ustime);								// delay function
 	void *	(* AllocBuffer)(U16 dataSize, U8 **pData);				// allocate wireless forwarding buffer
 
 	int	(* Rand)(U32 seed);
diff --git a/src/zddebug.c b/src/zddebug.c
index 4f74d81..cad77cd 100755
--- a/src/zddebug.c
+++ b/src/zddebug.c
@@ -134,7 +134,7 @@ void zd1205_dump_cnters(struct zd1205_pr
 	printk(KERN_DEBUG "regRWCompCnt    = %08d, regUnCompCnt   = %08d\n", macp->regRWCompCnt, macp->regUnCompCnt);
 	printk(KERN_DEBUG "regWaitRspCnt   = %08d, regRspCompCnt  = %08d\n", macp->regWaitRspCnt, macp->regRspCompCnt);
 	printk(KERN_DEBUG "regRdSleepCnt   = %08d, regRspCompCnt  = %08d\n", macp->regRdSleepCnt, macp->regRspCompCnt);
-    printk(KERN_DEBUG "lastRxComp = %08d\n", macp->lastRxComp);
+    printk(KERN_DEBUG "lastRxComp = %08lu\n", macp->lastRxComp);
         printk(KERN_DEBUG "macp.flags = %08x ", (u32) macp->flags);
         if(macp->bHandleNonRxTxRunning)
         {
@@ -1014,7 +1014,7 @@ #endif
 					}
 					WPADEBUG("\n");
 				}
-#if CODE4_AP
+#ifdef CODE4_AP
 			#ifdef HOSTAPD_SUPPORT
 				if (pSetting->BssType == AP_BSS)
 				{// Update Beacon FIFO in the next TBTT.
diff --git a/src/zdhci.c b/src/zdhci.c
index 5905274..35edbcc 100755
--- a/src/zdhci.c
+++ b/src/zdhci.c
@@ -1377,6 +1377,8 @@ #endif
 	}	
 	
 	if (!bBSSFound){
+		U32 seed;
+		
 		//FPRINT("IBSS not found, create it !!!");
 		/****************************************************/
 		/* We generate an IBSS								*/
@@ -1386,7 +1388,7 @@ #endif
             printk("In SLLLLLLLLLLLLLLLLLLP @ %s\n", __FUNCTION__);
             return FALSE;
         }
-		U32 seed = pdot11Obj->GetReg(reg, ZD_TSF_LowPart);
+		seed = pdot11Obj->GetReg(reg, ZD_TSF_LowPart);
 		mBssIndex = 0xff;
 		//generate random BSSID
 		mBssId.mac[0] = (U8)((pdot11Obj->Rand(seed) & ~0x3) | 0x2); // I/G = 0, U/L = 1
diff --git a/src/zdhw.c b/src/zdhw.c
index 5fa9e88..76a000d 100755
--- a/src/zdhw.c
+++ b/src/zdhw.c
@@ -1361,7 +1361,7 @@ #if !( (defined(OFDM) && defined(GCCK)) 
 #else
     LockPhyReg(pObj);
     //pObj->GetReg(reg, ZD_CR203, &tmpvalue);
-    tmpvalue &= ~BIT_4;
+    //tmpvalue &= ~BIT_4;
     //pObj->SetReg(reg, ZD_CR203, tmpvalue);
     UnLockPhyReg(pObj);
 #endif
@@ -3826,7 +3826,7 @@ void HW_RadioOnOff(zd_80211Obj_t *pObj, 
                 }
 
                 LockPhyReg(pObj);
-                tmpvalue &= 0xFF;
+                //tmpvalue &= 0xFF;
 
                 for (ii = 0; ii < 10; ii ++){
                         pObj->DelayUs(1000);
diff --git a/src/zdinlinef.h b/src/zdinlinef.h
index e5e6f6b..7da9373 100755
--- a/src/zdinlinef.h
+++ b/src/zdinlinef.h
@@ -333,6 +333,7 @@ #else
 #endif	
 	
 		default:
+			*(pLenInUs) = 0;
 			printk(KERN_ERR "zd1205: Invalid RF module parameter\n");
 			
 	}
diff --git a/src/zdpsmon.c b/src/zdpsmon.c
index 7eb126e..3c989a6 100755
--- a/src/zdpsmon.c
+++ b/src/zdpsmon.c
@@ -371,6 +371,8 @@ void ResetPSMonitor(void)
 Hash_t *RxInfoIndicate(MacAddr_t *sta, PsMode psm, U8 rate)
 {
 	Hash_t *pHash;
+	PsMode oldPsm;
+	StationState asoc;
 	
 	ZDEBUG("RxInfoIndicate");
     
@@ -393,10 +395,10 @@ Hash_t *RxInfoIndicate(MacAddr_t *sta, P
 		    return NULL;
     }    	
 	else{
-		PsMode oldPsm = pHash->psm;
-		StationState asoc = pHash->asoc;
-
 updateInfo:		
+		oldPsm = pHash->psm;
+		asoc = pHash->asoc;
+
 		if (rate > pHash->MaxRate)
 			pHash->MaxRate = rate;
             
-------------------------------------------------------------------------
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