[PATCH 1/2] Apply Lident script for ft1000-usb.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Marek Belisko <marek.belisko@xxxxxxxxx>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c   | 1412 ++++----
 .../staging/ft1000/ft1000-usb/ft1000_download.c    | 2223 ++++++------
 drivers/staging/ft1000/ft1000-usb/ft1000_hw.c      | 3950 ++++++++++----------
 drivers/staging/ft1000/ft1000-usb/ft1000_hw.h      |    6 +-
 drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h   |  132 +-
 drivers/staging/ft1000/ft1000-usb/ft1000_proc.c    |  335 +-
 drivers/staging/ft1000/ft1000-usb/ft1000_usb.c     |  373 +-
 drivers/staging/ft1000/ft1000-usb/ft1000_usb.h     |  426 +--
 8 files changed, 4569 insertions(+), 4288 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
b/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
index 65087ce..27e2f5a 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
@@ -42,25 +42,27 @@
 //#include "ft1000_ioctl.h"

 void ft1000_DestroyDevice(struct net_device *dev);
-u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx,
PUCHAR buffer, u8 highlow);
-u16 ft1000_read_register(struct ft1000_device *ft1000dev, short*
Data, u16 nRegIndx);
-
-extern inline u16 ft1000_asic_read (struct net_device *dev, u16 offset);
-extern inline void ft1000_asic_write (struct net_device *dev, u16
offset, u16 value);
-extern void CardSendCommand(struct ft1000_device *ft1000dev, unsigned
short *ptempbuffer, int size);
-
-static int ft1000_ChOpen (struct inode *Inode, struct file *File);
-static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait);
+u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx,
+			PUCHAR buffer, u8 highlow);
+u16 ft1000_read_register(struct ft1000_device *ft1000dev, short *Data,
+			 u16 nRegIndx);
+
+extern inline u16 ft1000_asic_read(struct net_device *dev, u16 offset);
+extern inline void ft1000_asic_write(struct net_device *dev, u16 offset,
+				     u16 value);
+extern void CardSendCommand(struct ft1000_device *ft1000dev,
+			    unsigned short *ptempbuffer, int size);
+
+static int ft1000_ChOpen(struct inode *Inode, struct file *File);
+static unsigned int ft1000_ChPoll(struct file *file, poll_table * wait);
 static int ft1000_ChIoctl(struct file *File, unsigned int Command,
-                           unsigned long Argument);
-static int ft1000_ChRelease (struct inode *Inode, struct file *File);
+			  unsigned long Argument);
+static int ft1000_ChRelease(struct inode *Inode, struct file *File);

 static int ft1000_flarion_cnt = 0;

 //need to looking usage of ft1000Handle

-
-
 // Global pointer to device object
 static struct ft1000_device *pdevobj[MAX_NUM_CARDS + 2];
 //static devfs_handle_t ft1000Handle[MAX_NUM_CARDS];
@@ -79,17 +81,13 @@ int numofmsgbuf = 0;
 //
 // Table of entry-point routines for char device
 //
-static struct file_operations ft1000fops =
-{
-    unlocked_ioctl:    ft1000_ChIoctl,
-    poll:     ft1000_ChPoll,
-    open:     ft1000_ChOpen,
-    release:  ft1000_ChRelease
+static struct file_operations ft1000fops = {
+unlocked_ioctl:ft1000_ChIoctl,
+poll:	ft1000_ChPoll,
+open:	ft1000_ChOpen,
+release:ft1000_ChRelease
 };

-
-
-
 //---------------------------------------------------------------------------
 // Function:    exec_mknod
 //
@@ -102,38 +100,38 @@ static struct file_operations ft1000fops =
 // Notes:
 //
 //---------------------------------------------------------------------------
-static int exec_mknod (void *pdata)
+static int exec_mknod(void *pdata)
 {
-    PFT1000_INFO info;
-    char mjnum[4];
-    char minornum[4];
-    char temp[32];
-    int retcode;
-//    int i;					//aelias [-] reason : unused variable
-    char *envp[] = { "HOME=/", "PATH=/usr/bin:/bin", NULL };
-    char *argv[]={"-m 666",temp,"c",mjnum,minornum,NULL};
-
-    info = pdata;
-    DEBUG("ft1000_chdev:exec_mknod is called with major number =
%d\n", info->DeviceMajor);
-    sprintf(temp, "%s%s", "/dev/", info->DeviceName) ;
-    sprintf(mjnum, "%d", info->DeviceMajor);
-    sprintf(minornum, "%d", info->CardNumber);
-
-    //char *argv[]={"mknod","-m 666",temp,"c",mjnum,minornum,NULL};
+	PFT1000_INFO info;
+	char mjnum[4];
+	char minornum[4];
+	char temp[32];
+	int retcode;
+//    int i;                                    //aelias [-] reason :
unused variable
+	char *envp[] = { "HOME=/", "PATH=/usr/bin:/bin", NULL };
+	char *argv[] = { "-m 666", temp, "c", mjnum, minornum, NULL };
+
+	info = pdata;
+	DEBUG("ft1000_chdev:exec_mknod is called with major number = %d\n",
+	      info->DeviceMajor);
+	sprintf(temp, "%s%s", "/dev/", info->DeviceName);
+	sprintf(mjnum, "%d", info->DeviceMajor);
+	sprintf(minornum, "%d", info->CardNumber);
+
+	//char *argv[]={"mknod","-m 666",temp,"c",mjnum,minornum,NULL};
 //    char *argv[]={"-m 666",temp,"c",mjnum,minornum,NULL};

-    //for (i=0; i<7;i++)
-    //    DEBUG("argv[%d]=%s\n", i, argv[i]);
-
-
-    retcode = call_usermodehelper ("/bin/mknod", argv, envp, 1);
-    if (retcode) {
-        DEBUG("ft1000_chdev:exec_mknod failed to make the node:
retcode = %d\n", retcode);
-    }
-
+	//for (i=0; i<7;i++)
+	//    DEBUG("argv[%d]=%s\n", i, argv[i]);

+	retcode = call_usermodehelper("/bin/mknod", argv, envp, 1);
+	if (retcode) {
+		DEBUG
+		    ("ft1000_chdev:exec_mknod failed to make the node: retcode = %d\n",
+		     retcode);
+	}

-    return retcode;
+	return retcode;

 }

@@ -143,32 +141,34 @@ static int exec_mknod (void *pdata)
 // Description: This module removes the FT1000 device file
 //
 //---------------------------------------------------------------------------
-static int rm_mknod (void *pdata)
+static int rm_mknod(void *pdata)
 {

-    PFT1000_INFO info;
-    //char *argv[4]={"rm", "-f", "/dev/FT1000", NULL};
-    int retcode;
-    char temp[32];
-    char *argv[]={"rm", "-f", temp, NULL};
+	PFT1000_INFO info;
+	//char *argv[4]={"rm", "-f", "/dev/FT1000", NULL};
+	int retcode;
+	char temp[32];
+	char *argv[] = { "rm", "-f", temp, NULL };

-    info = (PFT1000_INFO)pdata;
-    DEBUG("ft1000_chdev:rm_mknod is called for device %s\n", info->DeviceName);
-    sprintf(temp, "%s%s", "/dev/", info->DeviceName) ;
+	info = (PFT1000_INFO) pdata;
+	DEBUG("ft1000_chdev:rm_mknod is called for device %s\n",
+	      info->DeviceName);
+	sprintf(temp, "%s%s", "/dev/", info->DeviceName);

 //    char *argv[]={"rm", "-f", temp, NULL};

-    retcode = call_usermodehelper ("/bin/rm", argv, NULL, 1);
-    if (retcode) {
-        DEBUG("ft1000_chdev:rm_mknod failed to remove the node:
retcode = %d\n", retcode);
-    }
-    else
-        DEBUG("ft1000_chdev:rm_mknod done!\n");
-
+	retcode = call_usermodehelper("/bin/rm", argv, NULL, 1);
+	if (retcode) {
+		DEBUG
+		    ("ft1000_chdev:rm_mknod failed to remove the node: retcode = %d\n",
+		     retcode);
+	} else
+		DEBUG("ft1000_chdev:rm_mknod done!\n");

-    return retcode;
+	return retcode;

 }
+
 //---------------------------------------------------------------------------
 // Function:    ft1000_get_buffer
 //
@@ -181,30 +181,26 @@ static int rm_mknod (void *pdata)
 // Notes:
 //
 //---------------------------------------------------------------------------
-PDPRAM_BLK ft1000_get_buffer (struct list_head *bufflist)
+PDPRAM_BLK ft1000_get_buffer(struct list_head * bufflist)
 {
-    unsigned long flags;
-    PDPRAM_BLK ptr;
-
-    spin_lock_irqsave(&free_buff_lock, flags);
-    // Check if buffer is available
-    if ( list_empty(bufflist) ) {
-        DEBUG("ft1000_get_buffer:  No more buffer - %d\n", numofmsgbuf);
-        ptr = NULL;
-    }
-    else {
-        numofmsgbuf--;
-        ptr = list_entry(bufflist->next, DPRAM_BLK, list);
-        list_del(&ptr->list);
-        //DEBUG("ft1000_get_buffer: number of free msg buffers =
%d\n", numofmsgbuf);
-    }
-    spin_unlock_irqrestore(&free_buff_lock, flags);
-
-    return ptr;
-}
-
-
+	unsigned long flags;
+	PDPRAM_BLK ptr;
+
+	spin_lock_irqsave(&free_buff_lock, flags);
+	// Check if buffer is available
+	if (list_empty(bufflist)) {
+		DEBUG("ft1000_get_buffer:  No more buffer - %d\n", numofmsgbuf);
+		ptr = NULL;
+	} else {
+		numofmsgbuf--;
+		ptr = list_entry(bufflist->next, DPRAM_BLK, list);
+		list_del(&ptr->list);
+		//DEBUG("ft1000_get_buffer: number of free msg buffers = %d\n", numofmsgbuf);
+	}
+	spin_unlock_irqrestore(&free_buff_lock, flags);

+	return ptr;
+}

 //---------------------------------------------------------------------------
 // Function:    ft1000_free_buffer
@@ -218,16 +214,16 @@ PDPRAM_BLK ft1000_get_buffer (struct list_head *bufflist)
 // Notes:
 //
 //---------------------------------------------------------------------------
-void ft1000_free_buffer (PDPRAM_BLK pdpram_blk, struct list_head *plist)
+void ft1000_free_buffer(PDPRAM_BLK pdpram_blk, struct list_head *plist)
 {
-    unsigned long flags;
-
-    spin_lock_irqsave(&free_buff_lock, flags);
-    // Put memory back to list
-    list_add_tail(&pdpram_blk->list, plist);
-    numofmsgbuf++;
-    //DEBUG("ft1000_free_buffer: number of free msg buffers = %d\n",
numofmsgbuf);
-    spin_unlock_irqrestore(&free_buff_lock, flags);
+	unsigned long flags;
+
+	spin_lock_irqsave(&free_buff_lock, flags);
+	// Put memory back to list
+	list_add_tail(&pdpram_blk->list, plist);
+	numofmsgbuf++;
+	//DEBUG("ft1000_free_buffer: number of free msg buffers = %d\n", numofmsgbuf);
+	spin_unlock_irqrestore(&free_buff_lock, flags);
 }

 //---------------------------------------------------------------------------
@@ -244,62 +240,64 @@ void ft1000_free_buffer (PDPRAM_BLK pdpram_blk,
struct list_head *plist)
 //---------------------------------------------------------------------------
 int ft1000_CreateDevice(struct ft1000_device *dev)
 {
-    PFT1000_INFO info = netdev_priv(dev->net);
-    int result;
-    int i;
-    pid_t pid;
-
-    // make a new device name
-    sprintf(info->DeviceName, "%s%d", "FT100", info->CardNumber);
+	PFT1000_INFO info = netdev_priv(dev->net);
+	int result;
+	int i;
+	pid_t pid;

-    // Delete any existing FT1000 node
-    pid = kernel_thread (rm_mknod,(void *)info, 0);
-    msleep(1000);
+	// make a new device name
+	sprintf(info->DeviceName, "%s%d", "FT100", info->CardNumber);

-    DEBUG("ft1000_CreateDevice: number of instance = %d\n",
ft1000_flarion_cnt);
-    DEBUG("DeviceCreated = %x\n", info->DeviceCreated);
+	// Delete any existing FT1000 node
+	pid = kernel_thread(rm_mknod, (void *)info, 0);
+	msleep(1000);

-    //save the device info to global array
-    pdevobj[info->CardNumber] = dev;
+	DEBUG("ft1000_CreateDevice: number of instance = %d\n",
+	      ft1000_flarion_cnt);
+	DEBUG("DeviceCreated = %x\n", info->DeviceCreated);

-    DEBUG("ft1000_CreateDevice: ******SAVED pdevobj[%d]=%x\n",
info->CardNumber, (unsigned int)pdevobj[info->CardNumber]);	//aelias
[+] reason:up
+	//save the device info to global array
+	pdevobj[info->CardNumber] = dev;

-    if (info->DeviceCreated)
-    {
-	DEBUG("ft1000_CreateDevice: \"%s\" already registered\n", info->DeviceName);
-	return -EIO;
-    }
+	DEBUG("ft1000_CreateDevice: ******SAVED pdevobj[%d]=%x\n",
info->CardNumber, (unsigned int)pdevobj[info->CardNumber]);	//aelias
[+] reason:up

+	if (info->DeviceCreated) {
+		DEBUG("ft1000_CreateDevice: \"%s\" already registered\n",
+		      info->DeviceName);
+		return -EIO;
+	}

-    // register the device
-    DEBUG("ft1000_CreateDevice: \"%s\" device registration\n",
info->DeviceName);
-    info->DeviceMajor = 0;
-
-    result = register_chrdev(info->DeviceMajor, info->DeviceName, &ft1000fops);
-    if (result < 0)
-    {
-	DEBUG("ft1000_CreateDevice: unable to get major %d\n", info->DeviceMajor);
-	return result;
-    }
-
-    DEBUG("ft1000_CreateDevice: registered char device \"%s\"\n",
info->DeviceName);
+	// register the device
+	DEBUG("ft1000_CreateDevice: \"%s\" device registration\n",
+	      info->DeviceName);
+	info->DeviceMajor = 0;
+
+	result =
+	    register_chrdev(info->DeviceMajor, info->DeviceName, &ft1000fops);
+	if (result < 0) {
+		DEBUG("ft1000_CreateDevice: unable to get major %d\n",
+		      info->DeviceMajor);
+		return result;
+	}

-    // save a dynamic device major number
-    if (info->DeviceMajor == 0)
-    {
-	info->DeviceMajor = result;
-	DEBUG("ft1000_PcdCreateDevice: device major = %d\n", info->DeviceMajor);
-    }
+	DEBUG("ft1000_CreateDevice: registered char device \"%s\"\n",
+	      info->DeviceName);

-    // Create a thread to call user mode app to mknod
-    pid = kernel_thread (exec_mknod, (void *)info, 0);
+	// save a dynamic device major number
+	if (info->DeviceMajor == 0) {
+		info->DeviceMajor = result;
+		DEBUG("ft1000_PcdCreateDevice: device major = %d\n",
+		      info->DeviceMajor);
+	}
+	// Create a thread to call user mode app to mknod
+	pid = kernel_thread(exec_mknod, (void *)info, 0);

-    // initialize application information
-    info->appcnt = 0;
+	// initialize application information
+	info->appcnt = 0;

 //    if (ft1000_flarion_cnt == 0) {
 //
-//    	  DEBUG("Initialize free_buff_lock and freercvpool\n");
+//        DEBUG("Initialize free_buff_lock and freercvpool\n");
 //        spin_lock_init(&free_buff_lock);
 //
 //        // initialize a list of buffers to be use for queuing up
receive command data
@@ -317,33 +315,28 @@ int ft1000_CreateDevice(struct ft1000_device *dev)
 //        numofmsgbuf = NUM_OF_FREE_BUFFERS;
 //    }

-
-    // initialize application information
-    info->appcnt = 0;
-    for (i=0; i<MAX_NUM_APP; i++) {
-        info->app_info[i].nTxMsg = 0;
-        info->app_info[i].nRxMsg = 0;
-        info->app_info[i].nTxMsgReject = 0;
-        info->app_info[i].nRxMsgMiss = 0;
-        info->app_info[i].fileobject = 0;
-        info->app_info[i].app_id = i+1;
-        info->app_info[i].DspBCMsgFlag = 0;
-        info->app_info[i].NumOfMsg = 0;
-        init_waitqueue_head(&info->app_info[i].wait_dpram_msg);
-        INIT_LIST_HEAD (&info->app_info[i].app_sqlist);
-    }
-
-
-
+	// initialize application information
+	info->appcnt = 0;
+	for (i = 0; i < MAX_NUM_APP; i++) {
+		info->app_info[i].nTxMsg = 0;
+		info->app_info[i].nRxMsg = 0;
+		info->app_info[i].nTxMsgReject = 0;
+		info->app_info[i].nRxMsgMiss = 0;
+		info->app_info[i].fileobject = 0;
+		info->app_info[i].app_id = i + 1;
+		info->app_info[i].DspBCMsgFlag = 0;
+		info->app_info[i].NumOfMsg = 0;
+		init_waitqueue_head(&info->app_info[i].wait_dpram_msg);
+		INIT_LIST_HEAD(&info->app_info[i].app_sqlist);
+	}

 //    ft1000Handle[info->CardNumber] = devfs_register(NULL,
info->DeviceName, DEVFS_FL_AUTO_DEVNUM, 0, 0,
 //                                  S_IFCHR | S_IRUGO | S_IWUGO,
&ft1000fops, NULL);

+	info->DeviceCreated = TRUE;
+	ft1000_flarion_cnt++;

-    info->DeviceCreated = TRUE;
-    ft1000_flarion_cnt++;
-
-    return result;
+	return result;
 }

 //---------------------------------------------------------------------------
@@ -358,47 +351,49 @@ int ft1000_CreateDevice(struct ft1000_device *dev)
 //---------------------------------------------------------------------------
 void ft1000_DestroyDevice(struct net_device *dev)
 {
-    PFT1000_INFO info = netdev_priv(dev);
-    int result = 0;
-    pid_t pid;
-		int i;
-    PDPRAM_BLK pdpram_blk;
-    DPRAM_BLK *ptr;
-
-    DEBUG("ft1000_chdev:ft1000_DestroyDevice called\n");
-
+	PFT1000_INFO info = netdev_priv(dev);
+	int result = 0;
+	pid_t pid;
+	int i;
+	PDPRAM_BLK pdpram_blk;
+	DPRAM_BLK *ptr;

+	DEBUG("ft1000_chdev:ft1000_DestroyDevice called\n");

-    if (info->DeviceCreated)
-	{
-        ft1000_flarion_cnt--;
+	if (info->DeviceCreated) {
+		ft1000_flarion_cnt--;
 		unregister_chrdev(info->DeviceMajor, info->DeviceName);
-		DEBUG("ft1000_DestroyDevice: unregistered device \"%s\", result = %d\n",
-					   info->DeviceName, result);
-
-       pid = kernel_thread (rm_mknod, (void *)info, 0);
-
-        // Make sure we free any memory reserve for slow Queue
-        for (i=0; i<MAX_NUM_APP; i++) {
-            while (list_empty(&info->app_info[i].app_sqlist) == 0) {
-                pdpram_blk =
list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list);
-                list_del(&pdpram_blk->list);
-                ft1000_free_buffer(pdpram_blk, &freercvpool);
-
-            }
-            wake_up_interruptible(&info->app_info[i].wait_dpram_msg);
-        }
-
-        // Remove buffer allocated for receive command data
-        if (ft1000_flarion_cnt == 0) {
-            while (list_empty(&freercvpool) == 0) {
-                ptr = list_entry(freercvpool.next, DPRAM_BLK, list);
-                list_del(&ptr->list);
-                kfree(ptr->pbuffer);
-                kfree(ptr);
-            }
-        }
-
+		DEBUG
+		    ("ft1000_DestroyDevice: unregistered device \"%s\", result = %d\n",
+		     info->DeviceName, result);
+
+		pid = kernel_thread(rm_mknod, (void *)info, 0);
+
+		// Make sure we free any memory reserve for slow Queue
+		for (i = 0; i < MAX_NUM_APP; i++) {
+			while (list_empty(&info->app_info[i].app_sqlist) == 0) {
+				pdpram_blk =
+				    list_entry(info->app_info[i].app_sqlist.
+					       next, DPRAM_BLK, list);
+				list_del(&pdpram_blk->list);
+				ft1000_free_buffer(pdpram_blk, &freercvpool);
+
+			}
+			wake_up_interruptible(&info->app_info[i].
+					      wait_dpram_msg);
+		}
+
+		// Remove buffer allocated for receive command data
+		if (ft1000_flarion_cnt == 0) {
+			while (list_empty(&freercvpool) == 0) {
+				ptr =
+				    list_entry(freercvpool.next, DPRAM_BLK,
+					       list);
+				list_del(&ptr->list);
+				kfree(ptr->pbuffer);
+				kfree(ptr);
+			}
+		}
 //        devfs_unregister(ft1000Handle[info->CardNumber]);

 		info->DeviceCreated = FALSE;
@@ -406,7 +401,6 @@ void ft1000_DestroyDevice(struct net_device *dev)
 		pdevobj[info->CardNumber] = NULL;
 	}

-
 }

 //---------------------------------------------------------------------------
@@ -419,60 +413,58 @@ void ft1000_DestroyDevice(struct net_device *dev)
 // Notes:
 //
 //---------------------------------------------------------------------------
-static int ft1000_ChOpen (struct inode *Inode, struct file *File)
+static int ft1000_ChOpen(struct inode *Inode, struct file *File)
 {
-    PFT1000_INFO info;
-    int i,num;
-
-    DEBUG("ft1000_ChOpen called\n");
-    num = (MINOR(Inode->i_rdev) & 0xf);
-    DEBUG("ft1000_ChOpen: minor number=%d\n", num);
-
-    for (i=0; i<5; i++)
-        DEBUG("pdevobj[%d]=%x\n", i, (unsigned int)pdevobj[i]);
//aelias [+] reason: down
-
-    if ( pdevobj[num] != NULL )
-        //info = (PFT1000_INFO)(pdevobj[num]->net->priv);
-    	info = (FT1000_INFO *) netdev_priv (pdevobj[num]->net);
-    else
-    {
-        DEBUG("ft1000_ChOpen: can not find device object %d\n", num);
-        return -1;
-    }
-
-    DEBUG("f_owner = 0x%8x number of application = %d\n",
(u32)(&File->f_owner), info->appcnt );
-
-    // Check if maximum number of application exceeded
-    if (info->appcnt > MAX_NUM_APP) {
-        DEBUG("Maximum number of application exceeded\n");
-        return -EACCES;
-    }
-
-    // Search for available application info block
-    for (i=0; i<MAX_NUM_APP; i++) {
-        if ( (info->app_info[i].fileobject == 0) ) {
-            break;
-        }
-    }
-
-    // Fail due to lack of application info block
-    if (i == MAX_NUM_APP) {
-        DEBUG("Could not find an application info block\n");
-        return -EACCES;
-    }
-
-    info->appcnt++;
-    info->app_info[i].fileobject = (u32)(&File->f_owner);
-    info->app_info[i].nTxMsg = 0;
-    info->app_info[i].nRxMsg = 0;
-    info->app_info[i].nTxMsgReject = 0;
-    info->app_info[i].nRxMsgMiss = 0;
-
-    File->private_data = pdevobj[num]->net;
-
-    return 0;
-}
+	PFT1000_INFO info;
+	int i, num;
+
+	DEBUG("ft1000_ChOpen called\n");
+	num = (MINOR(Inode->i_rdev) & 0xf);
+	DEBUG("ft1000_ChOpen: minor number=%d\n", num);
+
+	for (i = 0; i < 5; i++)
+		DEBUG("pdevobj[%d]=%x\n", i, (unsigned int)pdevobj[i]);	//aelias
[+] reason: down
+
+	if (pdevobj[num] != NULL)
+		//info = (PFT1000_INFO)(pdevobj[num]->net->priv);
+		info = (FT1000_INFO *) netdev_priv(pdevobj[num]->net);
+	else {
+		DEBUG("ft1000_ChOpen: can not find device object %d\n", num);
+		return -1;
+	}

+	DEBUG("f_owner = 0x%8x number of application = %d\n",
+	      (u32) (&File->f_owner), info->appcnt);
+
+	// Check if maximum number of application exceeded
+	if (info->appcnt > MAX_NUM_APP) {
+		DEBUG("Maximum number of application exceeded\n");
+		return -EACCES;
+	}
+	// Search for available application info block
+	for (i = 0; i < MAX_NUM_APP; i++) {
+		if ((info->app_info[i].fileobject == 0)) {
+			break;
+		}
+	}
+
+	// Fail due to lack of application info block
+	if (i == MAX_NUM_APP) {
+		DEBUG("Could not find an application info block\n");
+		return -EACCES;
+	}
+
+	info->appcnt++;
+	info->app_info[i].fileobject = (u32) (&File->f_owner);
+	info->app_info[i].nTxMsg = 0;
+	info->app_info[i].nRxMsg = 0;
+	info->app_info[i].nTxMsgReject = 0;
+	info->app_info[i].nRxMsgMiss = 0;
+
+	File->private_data = pdevobj[num]->net;
+
+	return 0;
+}

 //---------------------------------------------------------------------------
 // Function:    ft1000_ChPoll
@@ -485,43 +477,45 @@ static int ft1000_ChOpen (struct inode *Inode,
struct file *File)
 //
 //---------------------------------------------------------------------------

-static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait)
+static unsigned int ft1000_ChPoll(struct file *file, poll_table * wait)
 {
-    struct net_device *dev = file->private_data;
-    PFT1000_INFO info;
-    int i;
-
-    //DEBUG("ft1000_ChPoll called\n");
-    if (ft1000_flarion_cnt == 0) {
-        DEBUG("FT1000:ft1000_ChPoll called when ft1000_flarion_cnt is zero\n");
-        return (-EBADF);
-    }
-
-	info = (FT1000_INFO *) netdev_priv (dev);
-
-    // Search for matching file object
-    for (i=0; i<MAX_NUM_APP; i++) {
-        if ( info->app_info[i].fileobject == (u32)(&file->f_owner) ) {
-            //DEBUG("FT1000:ft1000_ChIoctl: Message is for AppId =
%d\n", info->app_info[i].app_id);
-            break;
-        }
-    }
-
-    // Could not find application info block
-    if (i == MAX_NUM_APP) {
-        DEBUG("FT1000:ft1000_ChIoctl:Could not find application info block\n");
-        return ( -EACCES );
-    }
-
-    if (list_empty(&info->app_info[i].app_sqlist) == 0) {
-        DEBUG("FT1000:ft1000_ChPoll:Message detected in slow queue\n");
-        return(POLLIN | POLLRDNORM | POLLPRI);
-    }
-
-    poll_wait (file, &info->app_info[i].wait_dpram_msg, wait);
-    //DEBUG("FT1000:ft1000_ChPoll:Polling for data from DSP\n");
-
-    return (0);
+	struct net_device *dev = file->private_data;
+	PFT1000_INFO info;
+	int i;
+
+	//DEBUG("ft1000_ChPoll called\n");
+	if (ft1000_flarion_cnt == 0) {
+		DEBUG
+		    ("FT1000:ft1000_ChPoll called when ft1000_flarion_cnt is zero\n");
+		return (-EBADF);
+	}
+
+	info = (FT1000_INFO *) netdev_priv(dev);
+
+	// Search for matching file object
+	for (i = 0; i < MAX_NUM_APP; i++) {
+		if (info->app_info[i].fileobject == (u32) (&file->f_owner)) {
+			//DEBUG("FT1000:ft1000_ChIoctl: Message is for AppId = %d\n",
info->app_info[i].app_id);
+			break;
+		}
+	}
+
+	// Could not find application info block
+	if (i == MAX_NUM_APP) {
+		DEBUG
+		    ("FT1000:ft1000_ChIoctl:Could not find application info block\n");
+		return (-EACCES);
+	}
+
+	if (list_empty(&info->app_info[i].app_sqlist) == 0) {
+		DEBUG("FT1000:ft1000_ChPoll:Message detected in slow queue\n");
+		return (POLLIN | POLLRDNORM | POLLPRI);
+	}
+
+	poll_wait(file, &info->app_info[i].wait_dpram_msg, wait);
+	//DEBUG("FT1000:ft1000_ChPoll:Polling for data from DSP\n");
+
+	return (0);
 }

 //---------------------------------------------------------------------------
@@ -534,349 +528,435 @@ static unsigned int ft1000_ChPoll(struct file
*file, poll_table *wait)
 // Notes:
 //
 //---------------------------------------------------------------------------
-static int ft1000_ChIoctl (struct file *File, unsigned int Command,
-                           unsigned long Argument)
+static int ft1000_ChIoctl(struct file *File, unsigned int Command,
+			  unsigned long Argument)
 {
-    struct net_device *dev;
-    PFT1000_INFO info;
-    struct ft1000_device *ft1000dev;
-    int result=0;
-    int cmd;
-    int i;
-    u16 tempword;
-    unsigned long flags;
-    struct timeval tv;
-    IOCTL_GET_VER get_ver_data;
-    IOCTL_GET_DSP_STAT get_stat_data;
-    u8 ConnectionMsg[] =
{0x00,0x44,0x10,0x20,0x80,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x93,0x64,
-
0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x0a,
-
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
0x00,0x00,0x02,0x37,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x01,0x7f,0x00,
-                          0x00,0x01,0x00,0x00};
-
-    unsigned short ledStat=0;
-    unsigned short conStat=0;
-
-    //DEBUG("ft1000_ChIoctl called\n");
-
-    if (ft1000_flarion_cnt == 0) {
-        DEBUG("FT1000:ft1000_ChIoctl called when ft1000_flarion_cnt
is zero\n");
-        return (-EBADF);
-    }
-
-    //DEBUG("FT1000:ft1000_ChIoctl:Command = 0x%x Argument =
0x%8x\n", Command, (u32)Argument);
-
-    dev = File->private_data;
-	info = (FT1000_INFO *) netdev_priv (dev);
-    ft1000dev = info->pFt1000Dev;
-    cmd = _IOC_NR(Command);
-    //DEBUG("FT1000:ft1000_ChIoctl:cmd = 0x%x\n", cmd);
-
-    // process the command
-    switch (cmd) {
-    case IOCTL_REGISTER_CMD:
-            DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_REGISTER called\n");
-            result = get_user(tempword, (unsigned short *)Argument);
-            if (result) {
-                DEBUG("result = %d failed to get_user\n", result);
-                break;
-            }
-            if (tempword == DSPBCMSGID) {
-                // Search for matching file object
-                for (i=0; i<MAX_NUM_APP; i++) {
-                    if ( info->app_info[i].fileobject ==
(u32)(&File->f_owner) ) {
-                        info->app_info[i].DspBCMsgFlag = 1;
-                        DEBUG("FT1000:ft1000_ChIoctl:Registered for
broadcast messages\n");
-                        break;
-                    }
-                }
-            }
-            break;
-
-    case IOCTL_GET_VER_CMD:
-        DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_VER called\n");
-
-        get_ver_data.drv_ver = FT1000_DRV_VER;
-
-        if (copy_to_user((PIOCTL_GET_VER)Argument, &get_ver_data,
sizeof(get_ver_data)) ) {
-            DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
-            result = -EFAULT;
-            break;
-        }
-
-        DEBUG("FT1000:ft1000_ChIoctl:driver version =
0x%x\n",(unsigned int)get_ver_data.drv_ver);
-
-        break;
-    case IOCTL_CONNECT:
-        // Connect Message
-        DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_CONNECT\n");
-        ConnectionMsg[79] = 0xfc;
-			   CardSendCommand(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
-
-        break;
-    case IOCTL_DISCONNECT:
-        // Disconnect Message
-        DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_DISCONNECT\n");
-        ConnectionMsg[79] = 0xfd;
-			   CardSendCommand(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
-        break;
-    case IOCTL_GET_DSP_STAT_CMD:
-        //DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_DSP_STAT called\n");
-
-        memcpy(get_stat_data.DspVer, info->DspVer, DSPVERSZ);
-        memcpy(get_stat_data.HwSerNum, info->HwSerNum, HWSERNUMSZ);
-        memcpy(get_stat_data.Sku, info->Sku, SKUSZ);
-        memcpy(get_stat_data.eui64, info->eui64, EUISZ);
-
-            if (info->ProgConStat != 0xFF) {
-                ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_LED,
(PUCHAR)&ledStat, FT1000_MAG_DSP_LED_INDX);
-                get_stat_data.LedStat = ntohs(ledStat);
-                DEBUG("FT1000:ft1000_ChIoctl: LedStat = 0x%x\n",
get_stat_data.LedStat);
-                ft1000_read_dpram16(ft1000dev,
FT1000_MAG_DSP_CON_STATE, (PUCHAR)&conStat,
FT1000_MAG_DSP_CON_STATE_INDX);
-                get_stat_data.ConStat = ntohs(conStat);
-                DEBUG("FT1000:ft1000_ChIoctl: ConStat = 0x%x\n",
get_stat_data.ConStat);
-            }
-            else {
-                get_stat_data.ConStat = 0x0f;
-            }
-
-
-        get_stat_data.nTxPkts = info->stats.tx_packets;
-        get_stat_data.nRxPkts = info->stats.rx_packets;
-        get_stat_data.nTxBytes = info->stats.tx_bytes;
-        get_stat_data.nRxBytes = info->stats.rx_bytes;
-        do_gettimeofday ( &tv );
-        get_stat_data.ConTm = (u32)(tv.tv_sec - info->ConTm);
-        DEBUG("Connection Time = %d\n", (int)get_stat_data.ConTm);
-        if (copy_to_user((PIOCTL_GET_DSP_STAT)Argument,
&get_stat_data, sizeof(get_stat_data)) ) {
-            DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
-            result = -EFAULT;
-            break;
-        }
-        DEBUG("ft1000_chioctl: GET_DSP_STAT succeed\n");
-        break;
-    case IOCTL_SET_DPRAM_CMD:
-        {
-            IOCTL_DPRAM_BLK dpram_data;
-            //IOCTL_DPRAM_COMMAND dpram_command;
-            USHORT qtype;
-            USHORT msgsz;
-            PPSEUDO_HDR ppseudo_hdr;
-            PUSHORT pmsg;
-            USHORT total_len;
-            USHORT app_index;
-            u16 status;
-
-            //DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_SET_DPRAM called\n");
-
-
-            if (ft1000_flarion_cnt == 0) {
-                return (-EBADF);
-            }
-
-            if (info->DrvMsgPend) {
-                return (-ENOTTY);
-            }
-
-            if ( (info->DspAsicReset) || (info->fProvComplete == 0) ) {
-                return (-EACCES);
-            }
-
-            info->fAppMsgPend = 1;
-
-            if (info->CardReady) {
-
-               //DEBUG("FT1000:ft1000_ChIoctl: try to SET_DPRAM \n");
-
-                // Get the length field to see how many bytes to copy
-                result = get_user(msgsz, (unsigned short *)Argument);
-                msgsz = ntohs (msgsz);
-                //DEBUG("FT1000:ft1000_ChIoctl: length of message =
%d\n", msgsz);
-
-                if (msgsz > MAX_CMD_SQSIZE) {
-                    DEBUG("FT1000:ft1000_ChIoctl: bad message length
= %d\n", msgsz);
-                    result = -EINVAL;
-                    break;
-                }
-
-                //if ( copy_from_user(&(dpram_command.dpram_blk),
(PIOCTL_DPRAM_BLK)Argument, msgsz+2) ) {
-                if ( copy_from_user(&dpram_data,
(PIOCTL_DPRAM_BLK)Argument, msgsz+2) ) {
-                    DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
-                    result = -EFAULT;
-                }
-                else {
+	struct net_device *dev;
+	PFT1000_INFO info;
+	struct ft1000_device *ft1000dev;
+	int result = 0;
+	int cmd;
+	int i;
+	u16 tempword;
+	unsigned long flags;
+	struct timeval tv;
+	IOCTL_GET_VER get_ver_data;
+	IOCTL_GET_DSP_STAT get_stat_data;
+	u8 ConnectionMsg[] =
+	    { 0x00, 0x44, 0x10, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
+   0x00, 0x00, 0x00, 0x93, 0x64,
+		0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		    0x00, 0x05, 0x00, 0x00, 0x00, 0x0a,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+		    0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00,
+		    0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x02, 0x37, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+		    0x00, 0x01, 0x00, 0x01, 0x7f, 0x00,
+		0x00, 0x01, 0x00, 0x00
+	};
+
+	unsigned short ledStat = 0;
+	unsigned short conStat = 0;
+
+	//DEBUG("ft1000_ChIoctl called\n");
+
+	if (ft1000_flarion_cnt == 0) {
+		DEBUG
+		    ("FT1000:ft1000_ChIoctl called when ft1000_flarion_cnt is zero\n");
+		return (-EBADF);
+	}
+	//DEBUG("FT1000:ft1000_ChIoctl:Command = 0x%x Argument = 0x%8x\n",
Command, (u32)Argument);
+
+	dev = File->private_data;
+	info = (FT1000_INFO *) netdev_priv(dev);
+	ft1000dev = info->pFt1000Dev;
+	cmd = _IOC_NR(Command);
+	//DEBUG("FT1000:ft1000_ChIoctl:cmd = 0x%x\n", cmd);
+
+	// process the command
+	switch (cmd) {
+	case IOCTL_REGISTER_CMD:
+		DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_REGISTER called\n");
+		result = get_user(tempword, (unsigned short *)Argument);
+		if (result) {
+			DEBUG("result = %d failed to get_user\n", result);
+			break;
+		}
+		if (tempword == DSPBCMSGID) {
+			// Search for matching file object
+			for (i = 0; i < MAX_NUM_APP; i++) {
+				if (info->app_info[i].fileobject ==
+				    (u32) (&File->f_owner)) {
+					info->app_info[i].DspBCMsgFlag = 1;
+					DEBUG
+					    ("FT1000:ft1000_ChIoctl:Registered for broadcast messages\n");
+					break;
+				}
+			}
+		}
+		break;
+
+	case IOCTL_GET_VER_CMD:
+		DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_VER called\n");
+
+		get_ver_data.drv_ver = FT1000_DRV_VER;
+
+		if (copy_to_user
+		    ((PIOCTL_GET_VER) Argument, &get_ver_data,
+		     sizeof(get_ver_data))) {
+			DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
+			result = -EFAULT;
+			break;
+		}
+
+		DEBUG("FT1000:ft1000_ChIoctl:driver version = 0x%x\n",
+		      (unsigned int)get_ver_data.drv_ver);
+
+		break;
+	case IOCTL_CONNECT:
+		// Connect Message
+		DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_CONNECT\n");
+		ConnectionMsg[79] = 0xfc;
+		CardSendCommand(ft1000dev, (unsigned short *)ConnectionMsg,
+				0x4c);
+
+		break;
+	case IOCTL_DISCONNECT:
+		// Disconnect Message
+		DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_DISCONNECT\n");
+		ConnectionMsg[79] = 0xfd;
+		CardSendCommand(ft1000dev, (unsigned short *)ConnectionMsg,
+				0x4c);
+		break;
+	case IOCTL_GET_DSP_STAT_CMD:
+		//DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_DSP_STAT called\n");
+
+		memcpy(get_stat_data.DspVer, info->DspVer, DSPVERSZ);
+		memcpy(get_stat_data.HwSerNum, info->HwSerNum, HWSERNUMSZ);
+		memcpy(get_stat_data.Sku, info->Sku, SKUSZ);
+		memcpy(get_stat_data.eui64, info->eui64, EUISZ);
+
+		if (info->ProgConStat != 0xFF) {
+			ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_LED,
+					    (PUCHAR) & ledStat,
+					    FT1000_MAG_DSP_LED_INDX);
+			get_stat_data.LedStat = ntohs(ledStat);
+			DEBUG("FT1000:ft1000_ChIoctl: LedStat = 0x%x\n",
+			      get_stat_data.LedStat);
+			ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE,
+					    (PUCHAR) & conStat,
+					    FT1000_MAG_DSP_CON_STATE_INDX);
+			get_stat_data.ConStat = ntohs(conStat);
+			DEBUG("FT1000:ft1000_ChIoctl: ConStat = 0x%x\n",
+			      get_stat_data.ConStat);
+		} else {
+			get_stat_data.ConStat = 0x0f;
+		}
+
+		get_stat_data.nTxPkts = info->stats.tx_packets;
+		get_stat_data.nRxPkts = info->stats.rx_packets;
+		get_stat_data.nTxBytes = info->stats.tx_bytes;
+		get_stat_data.nRxBytes = info->stats.rx_bytes;
+		do_gettimeofday(&tv);
+		get_stat_data.ConTm = (u32) (tv.tv_sec - info->ConTm);
+		DEBUG("Connection Time = %d\n", (int)get_stat_data.ConTm);
+		if (copy_to_user
+		    ((PIOCTL_GET_DSP_STAT) Argument, &get_stat_data,
+		     sizeof(get_stat_data))) {
+			DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
+			result = -EFAULT;
+			break;
+		}
+		DEBUG("ft1000_chioctl: GET_DSP_STAT succeed\n");
+		break;
+	case IOCTL_SET_DPRAM_CMD:
+		{
+			IOCTL_DPRAM_BLK dpram_data;
+			//IOCTL_DPRAM_COMMAND dpram_command;
+			USHORT qtype;
+			USHORT msgsz;
+			PPSEUDO_HDR ppseudo_hdr;
+			PUSHORT pmsg;
+			USHORT total_len;
+			USHORT app_index;
+			u16 status;
+
+			//DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_SET_DPRAM called\n");
+
+			if (ft1000_flarion_cnt == 0) {
+				return (-EBADF);
+			}
+
+			if (info->DrvMsgPend) {
+				return (-ENOTTY);
+			}
+
+			if ((info->DspAsicReset) || (info->fProvComplete == 0)) {
+				return (-EACCES);
+			}
+
+			info->fAppMsgPend = 1;
+
+			if (info->CardReady) {
+
+				//DEBUG("FT1000:ft1000_ChIoctl: try to SET_DPRAM \n");
+
+				// Get the length field to see how many bytes to copy
+				result =
+				    get_user(msgsz, (unsigned short *)Argument);
+				msgsz = ntohs(msgsz);
+				//DEBUG("FT1000:ft1000_ChIoctl: length of message = %d\n", msgsz);
+
+				if (msgsz > MAX_CMD_SQSIZE) {
+					DEBUG
+					    ("FT1000:ft1000_ChIoctl: bad message length = %d\n",
+					     msgsz);
+					result = -EINVAL;
+					break;
+				}
+				//if ( copy_from_user(&(dpram_command.dpram_blk),
(PIOCTL_DPRAM_BLK)Argument, msgsz+2) ) {
+				if (copy_from_user
+				    (&dpram_data, (PIOCTL_DPRAM_BLK) Argument,
+				     msgsz + 2)) {
+					DEBUG
+					    ("FT1000:ft1000_ChIoctl: copy fault occurred\n");
+					result = -EFAULT;
+				} else {
 #if 0
-                    // whc - for debugging only
-                    ptr = (char *)&dpram_data;
-                    for (i=0; i<msgsz; i++) {
-                        DEBUG(1,"FT1000:ft1000_ChIoctl: data %d =
0x%x\n", i, *ptr++);
-                    }
+					// whc - for debugging only
+					ptr = (char *)&dpram_data;
+					for (i = 0; i < msgsz; i++) {
+						DEBUG(1,
+						      "FT1000:ft1000_ChIoctl: data %d = 0x%x\n",
+						      i, *ptr++);
+					}
 #endif
-                    // Check if this message came from a registered application
-                    for (i=0; i<MAX_NUM_APP; i++) {
-                        if ( info->app_info[i].fileobject ==
(u32)(&File->f_owner) ) {
-                            break;
-                        }
-                    }
-                    if (i==MAX_NUM_APP) {
-                        DEBUG("FT1000:No matching application fileobject\n");
-                        result = -EINVAL;
-                        break;
-                    }
-                    app_index = i;
-
-                    // Check message qtype type which is the lower
byte within qos_class
-                    //qtype =
ntohs(dpram_command.dpram_blk.pseudohdr.qos_class) & 0xff;
-                    qtype = ntohs(dpram_data.pseudohdr.qos_class) & 0xff;
-                    //DEBUG("FT1000_ft1000_ChIoctl: qtype = %d\n", qtype);
-                    if (qtype) {
-                    }
-                    else {
-                        // Put message into Slow Queue
-                        // Only put a message into the DPRAM if msg
doorbell is available
-                        status = ft1000_read_register(ft1000dev,
&tempword, FT1000_REG_DOORBELL);
-                        //DEBUG("FT1000_ft1000_ChIoctl: READ REGISTER
tempword=%x\n", tempword);
-                        if (tempword & FT1000_DB_DPRAM_TX) {
-                            // Suspend for 2ms and try again due to
DSP doorbell busy
-                            mdelay(2);
-                            status = ft1000_read_register(ft1000dev,
&tempword, FT1000_REG_DOORBELL);
-                            if (tempword & FT1000_DB_DPRAM_TX) {
-                                // Suspend for 1ms and try again due
to DSP doorbell busy
-                                mdelay(1);
-                                status =
ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
-                                if (tempword & FT1000_DB_DPRAM_TX) {
-                                    status =
ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
-                                    if (tempword & FT1000_DB_DPRAM_TX) {
-                                        // Suspend for 3ms and try
again due to DSP doorbell busy
-                                        mdelay(3);
-                                        status =
ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
-                                        if (tempword & FT1000_DB_DPRAM_TX) {
-
DEBUG("FT1000:ft1000_ChIoctl:Doorbell not available\n");
-                                            result = -ENOTTY;
-                                            break;
-                                        }
-                                    }
-                                }
-                            }
-                        }
-
-                        //DEBUG("FT1000_ft1000_ChIoctl: finished
reading register\n");
-
-                        // Make sure we are within the limits of the
slow queue memory limitation
-                        if ( (msgsz < MAX_CMD_SQSIZE) && (msgsz > PSEUDOSZ) ) {
-                            // Need to put sequence number plus new
checksum for message
-                            //pmsg =
(PUSHORT)&dpram_command.dpram_blk.pseudohdr;
-                            pmsg = (PUSHORT)&dpram_data.pseudohdr;
-                            ppseudo_hdr = (PPSEUDO_HDR)pmsg;
-                            total_len = msgsz+2;
-                            if (total_len & 0x1) {
-                                total_len++;
-                            }
-
-                            // Insert slow queue sequence number
-                            ppseudo_hdr->seq_num = info->squeseqnum++;
-                            ppseudo_hdr->portsrc =
info->app_info[app_index].app_id;
-                            // Calculate new checksum
-                            ppseudo_hdr->checksum = *pmsg++;
-                            //DEBUG("checksum = 0x%x\n",
ppseudo_hdr->checksum);
-                            for (i=1; i<7; i++) {
-                                ppseudo_hdr->checksum ^= *pmsg++;
-                                //DEBUG("checksum = 0x%x\n",
ppseudo_hdr->checksum);
-                            }
-                            pmsg++;
-                            ppseudo_hdr = (PPSEUDO_HDR)pmsg;
+					// Check if this message came from a registered application
+					for (i = 0; i < MAX_NUM_APP; i++) {
+						if (info->app_info[i].
+						    fileobject ==
+						    (u32) (&File->f_owner)) {
+							break;
+						}
+					}
+					if (i == MAX_NUM_APP) {
+						DEBUG
+						    ("FT1000:No matching application fileobject\n");
+						result = -EINVAL;
+						break;
+					}
+					app_index = i;
+
+					// Check message qtype type which is the lower byte within qos_class
+					//qtype = ntohs(dpram_command.dpram_blk.pseudohdr.qos_class) & 0xff;
+					qtype =
+					    ntohs(dpram_data.pseudohdr.
+						  qos_class) & 0xff;
+					//DEBUG("FT1000_ft1000_ChIoctl: qtype = %d\n", qtype);
+					if (qtype) {
+					} else {
+						// Put message into Slow Queue
+						// Only put a message into the DPRAM if msg doorbell is available
+						status =
+						    ft1000_read_register
+						    (ft1000dev, &tempword,
+						     FT1000_REG_DOORBELL);
+						//DEBUG("FT1000_ft1000_ChIoctl: READ REGISTER tempword=%x\n", tempword);
+						if (tempword &
+						    FT1000_DB_DPRAM_TX) {
+							// Suspend for 2ms and try again due to DSP doorbell busy
+							mdelay(2);
+							status =
+							    ft1000_read_register
+							    (ft1000dev,
+							     &tempword,
+							     FT1000_REG_DOORBELL);
+							if (tempword &
+							    FT1000_DB_DPRAM_TX)
+							{
+								// Suspend for 1ms and try again due to DSP doorbell busy
+								mdelay(1);
+								status =
+								    ft1000_read_register
+								    (ft1000dev,
+								     &tempword,
+								     FT1000_REG_DOORBELL);
+								if (tempword &
+								    FT1000_DB_DPRAM_TX)
+								{
+									status =
+									    ft1000_read_register
+									    (ft1000dev,
+									     &tempword,
+									     FT1000_REG_DOORBELL);
+									if (tempword & FT1000_DB_DPRAM_TX) {
+										// Suspend for 3ms and try again due to DSP doorbell busy
+										mdelay
+										    (3);
+										status
+										    =
+										    ft1000_read_register
+										    (ft1000dev,
+										     &tempword,
+										     FT1000_REG_DOORBELL);
+										if (tempword & FT1000_DB_DPRAM_TX) {
+											DEBUG
+											    ("FT1000:ft1000_ChIoctl:Doorbell not available\n");
+											result
+											    =
+											    -ENOTTY;
+											break;
+										}
+									}
+								}
+							}
+						}
+						//DEBUG("FT1000_ft1000_ChIoctl: finished reading register\n");
+
+						// Make sure we are within the limits of the slow queue memory limitation
+						if ((msgsz < MAX_CMD_SQSIZE)
+						    && (msgsz > PSEUDOSZ)) {
+							// Need to put sequence number plus new checksum for message
+							//pmsg = (PUSHORT)&dpram_command.dpram_blk.pseudohdr;
+							pmsg =
+							    (PUSHORT) &
+							    dpram_data.
+							    pseudohdr;
+							ppseudo_hdr =
+							    (PPSEUDO_HDR) pmsg;
+							total_len = msgsz + 2;
+							if (total_len & 0x1) {
+								total_len++;
+							}
+							// Insert slow queue sequence number
+							ppseudo_hdr->seq_num =
+							    info->squeseqnum++;
+							ppseudo_hdr->portsrc =
+							    info->
+							    app_info[app_index].
+							    app_id;
+							// Calculate new checksum
+							ppseudo_hdr->checksum =
+							    *pmsg++;
+							//DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum);
+							for (i = 1; i < 7; i++) {
+								ppseudo_hdr->
+								    checksum ^=
+								    *pmsg++;
+								//DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum);
+							}
+							pmsg++;
+							ppseudo_hdr =
+							    (PPSEUDO_HDR) pmsg;
 #if 0
-                            ptr = (char *)&dpram_data;
-                            DEBUG("FT1000:ft1000_ChIoctl: Command Send\n");
-                            for (i=0; i<total_len; i++) {
-                                DEBUG("FT1000:ft1000_ChIoctl: data %d
= 0x%x\n", i, *ptr++);
-                            }
+							ptr =
+							    (char *)&dpram_data;
+							DEBUG
+							    ("FT1000:ft1000_ChIoctl: Command Send\n");
+							for (i = 0;
+							     i < total_len;
+							     i++) {
+								DEBUG
+								    ("FT1000:ft1000_ChIoctl: data %d = 0x%x\n",
+								     i, *ptr++);
+							}
 #endif
-                            //dpram_command.extra = 0;
-
-                            //CardSendCommand(ft1000dev,(unsigned
char*)&dpram_command,total_len+2);
-                            CardSendCommand(ft1000dev,(unsigned
short*)&dpram_data,total_len+2);
-
-
-                            info->app_info[app_index].nTxMsg++;
-                            break;
-                        }
-                        else {
-                            result = -EINVAL;
-                            break;
-                        }
-                    }
-                }
-            }
-            else {
-                DEBUG("FT1000:ft1000_ChIoctl: Card not ready take messages\n");
-                result = -EACCES;
-            }
-
-        }
-        break;
-    case IOCTL_GET_DPRAM_CMD:
-        {
-            PDPRAM_BLK pdpram_blk;
-            PIOCTL_DPRAM_BLK pioctl_dpram;
-            int msglen;
-
-            //DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_DPRAM called\n");
-
-            if (ft1000_flarion_cnt == 0) {
-                return (-EBADF);
-            }
-
-            // Search for matching file object
-            for (i=0; i<MAX_NUM_APP; i++) {
-                if ( info->app_info[i].fileobject == (u32)(&File->f_owner) ) {
-                    //DEBUG("FT1000:ft1000_ChIoctl: Message is for
AppId = %d\n", info->app_info[i].app_id);
-                    break;
-                }
-            }
-
-            // Could not find application info block
-            if (i == MAX_NUM_APP) {
-                DEBUG("FT1000:ft1000_ChIoctl:Could not find
application info block\n");
-                result = -EBADF;
-                break;
-            }
-
-            result = 0;
-            pioctl_dpram = (PIOCTL_DPRAM_BLK)Argument;
-            if (list_empty(&info->app_info[i].app_sqlist) == 0) {
-                //DEBUG("FT1000:ft1000_ChIoctl:Message detected in
slow queue\n");
-                spin_lock_irqsave(&free_buff_lock, flags);
-                pdpram_blk =
list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list);
-                list_del(&pdpram_blk->list);
-                info->app_info[i].NumOfMsg--;
-                //DEBUG("FT1000:ft1000_ChIoctl:NumOfMsg for app %d =
%d\n", i, info->app_info[i].NumOfMsg);
-                spin_unlock_irqrestore(&free_buff_lock, flags);
-                msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ;
-                pioctl_dpram->total_len = htons(msglen);
-                //DEBUG("FT1000:ft1000_ChIoctl:msg length = %x\n", msglen);
-                if(copy_to_user (&pioctl_dpram->pseudohdr,
pdpram_blk->pbuffer, msglen))
-				{
-					DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
-	             	result = -EFAULT;
-	             	break;
+							//dpram_command.extra = 0;
+
+							//CardSendCommand(ft1000dev,(unsigned char*)&dpram_command,total_len+2);
+							CardSendCommand
+							    (ft1000dev,
+							     (unsigned short *)
+							     &dpram_data,
+							     total_len + 2);
+
+							info->
+							    app_info[app_index].
+							    nTxMsg++;
+							break;
+						} else {
+							result = -EINVAL;
+							break;
+						}
+					}
+				}
+			} else {
+				DEBUG
+				    ("FT1000:ft1000_ChIoctl: Card not ready take messages\n");
+				result = -EACCES;
+			}
+
+		}
+		break;
+	case IOCTL_GET_DPRAM_CMD:
+		{
+			PDPRAM_BLK pdpram_blk;
+			PIOCTL_DPRAM_BLK pioctl_dpram;
+			int msglen;
+
+			//DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_DPRAM called\n");
+
+			if (ft1000_flarion_cnt == 0) {
+				return (-EBADF);
+			}
+			// Search for matching file object
+			for (i = 0; i < MAX_NUM_APP; i++) {
+				if (info->app_info[i].fileobject ==
+				    (u32) (&File->f_owner)) {
+					//DEBUG("FT1000:ft1000_ChIoctl: Message is for AppId = %d\n",
info->app_info[i].app_id);
+					break;
+				}
+			}
+
+			// Could not find application info block
+			if (i == MAX_NUM_APP) {
+				DEBUG
+				    ("FT1000:ft1000_ChIoctl:Could not find application info block\n");
+				result = -EBADF;
+				break;
+			}
+
+			result = 0;
+			pioctl_dpram = (PIOCTL_DPRAM_BLK) Argument;
+			if (list_empty(&info->app_info[i].app_sqlist) == 0) {
+				//DEBUG("FT1000:ft1000_ChIoctl:Message detected in slow queue\n");
+				spin_lock_irqsave(&free_buff_lock, flags);
+				pdpram_blk =
+				    list_entry(info->app_info[i].app_sqlist.
+					       next, DPRAM_BLK, list);
+				list_del(&pdpram_blk->list);
+				info->app_info[i].NumOfMsg--;
+				//DEBUG("FT1000:ft1000_ChIoctl:NumOfMsg for app %d = %d\n", i,
info->app_info[i].NumOfMsg);
+				spin_unlock_irqrestore(&free_buff_lock, flags);
+				msglen =
+				    ntohs(*(u16 *) pdpram_blk->pbuffer) +
+				    PSEUDOSZ;
+				pioctl_dpram->total_len = htons(msglen);
+				//DEBUG("FT1000:ft1000_ChIoctl:msg length = %x\n", msglen);
+				if (copy_to_user
+				    (&pioctl_dpram->pseudohdr,
+				     pdpram_blk->pbuffer, msglen)) {
+					DEBUG
+					    ("FT1000:ft1000_ChIoctl: copy fault occurred\n");
+					result = -EFAULT;
+					break;
 				}

-                ft1000_free_buffer(pdpram_blk, &freercvpool);
-                result = msglen;
-            }
-            //DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_DPRAM no
message\n");
-        }
-        break;
-
-    default:
-        DEBUG("FT1000:ft1000_ChIoctl:unknown command: 0x%x\n", Command);
-        result = -ENOTTY;
-        break;
-    }
-    info->fAppMsgPend = 0;
-    return result;
+				ft1000_free_buffer(pdpram_blk, &freercvpool);
+				result = msglen;
+			}
+			//DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_DPRAM no message\n");
+		}
+		break;
+
+	default:
+		DEBUG("FT1000:ft1000_ChIoctl:unknown command: 0x%x\n", Command);
+		result = -ENOTTY;
+		break;
+	}
+	info->fAppMsgPend = 0;
+	return result;
 }

 //---------------------------------------------------------------------------
@@ -889,46 +969,46 @@ static int ft1000_ChIoctl (struct file *File,
unsigned int Command,
 // Notes:
 //
 //---------------------------------------------------------------------------
-static int ft1000_ChRelease (struct inode *Inode, struct file *File)
+static int ft1000_ChRelease(struct inode *Inode, struct file *File)
 {
-    PFT1000_INFO info;
-    struct net_device *dev;
-    int i;
-    PDPRAM_BLK pdpram_blk;
-
-    DEBUG("ft1000_ChRelease called\n");
-
-    dev = File->private_data;
-	info = (FT1000_INFO *) netdev_priv (dev);
-
-    if (ft1000_flarion_cnt == 0) {
-        info->appcnt--;
-        return (-EBADF);
-    }
-
-    // Search for matching file object
-    for (i=0; i<MAX_NUM_APP; i++) {
-        if ( info->app_info[i].fileobject == (u32)(&File->f_owner) ) {
-            //DEBUG("FT1000:ft1000_ChIoctl: Message is for AppId =
%d\n", info->app_info[i].app_id);
-            break;
-        }
-    }
-
-    if (i==MAX_NUM_APP)
-	    return 0;
-
-    while (list_empty(&info->app_info[i].app_sqlist) == 0) {
-        DEBUG("Remove and free memory queue up on slow queue\n");
-        pdpram_blk = list_entry(info->app_info[i].app_sqlist.next,
DPRAM_BLK, list);
-        list_del(&pdpram_blk->list);
-        ft1000_free_buffer(pdpram_blk, &freercvpool);
-    }
-
-    // initialize application information
-    info->appcnt--;
-    DEBUG("ft1000_chdev:%s:appcnt = %d\n", __FUNCTION__, info->appcnt);
-    info->app_info[i].fileobject = 0;
-
-    return 0;
-}
+	PFT1000_INFO info;
+	struct net_device *dev;
+	int i;
+	PDPRAM_BLK pdpram_blk;
+
+	DEBUG("ft1000_ChRelease called\n");

+	dev = File->private_data;
+	info = (FT1000_INFO *) netdev_priv(dev);
+
+	if (ft1000_flarion_cnt == 0) {
+		info->appcnt--;
+		return (-EBADF);
+	}
+	// Search for matching file object
+	for (i = 0; i < MAX_NUM_APP; i++) {
+		if (info->app_info[i].fileobject == (u32) (&File->f_owner)) {
+			//DEBUG("FT1000:ft1000_ChIoctl: Message is for AppId = %d\n",
info->app_info[i].app_id);
+			break;
+		}
+	}
+
+	if (i == MAX_NUM_APP)
+		return 0;
+
+	while (list_empty(&info->app_info[i].app_sqlist) == 0) {
+		DEBUG("Remove and free memory queue up on slow queue\n");
+		pdpram_blk =
+		    list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK,
+			       list);
+		list_del(&pdpram_blk->list);
+		ft1000_free_buffer(pdpram_blk, &freercvpool);
+	}
+
+	// initialize application information
+	info->appcnt--;
+	DEBUG("ft1000_chdev:%s:appcnt = %d\n", __FUNCTION__, info->appcnt);
+	info->app_info[i].fileobject = 0;
+
+	return 0;
+}
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 93f75b1..a889606 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -26,23 +26,23 @@
 #define  DWNLD_PS_HDR_LOC        0x0A

 #define  MAX_DSP_WAIT_LOOPS      40
-#define  DSP_WAIT_SLEEP_TIME     1000       /* 1 millisecond */
-#define  DSP_WAIT_DISPATCH_LVL   50         /* 50 usec */
+#define  DSP_WAIT_SLEEP_TIME     1000	/* 1 millisecond */
+#define  DSP_WAIT_DISPATCH_LVL   50	/* 50 usec */

 #define  HANDSHAKE_TIMEOUT_VALUE 0xF1F1
-#define  HANDSHAKE_RESET_VALUE   0xFEFE   /* When DSP requests startover */
-#define  HANDSHAKE_RESET_VALUE_USB   0xFE7E   /* When DSP requests startover */
-#define  HANDSHAKE_DSP_BL_READY  0xFEFE   /* At start DSP writes this
when bootloader ready */
-#define  HANDSHAKE_DSP_BL_READY_USB  0xFE7E   /* At start DSP writes
this when bootloader ready */
-#define  HANDSHAKE_DRIVER_READY  0xFFFF   /* Driver writes after
receiving 0xFEFE */
-#define  HANDSHAKE_SEND_DATA     0x0000   /* DSP writes this when
ready for more data */
+#define  HANDSHAKE_RESET_VALUE   0xFEFE	/* When DSP requests startover */
+#define  HANDSHAKE_RESET_VALUE_USB   0xFE7E	/* When DSP requests startover */
+#define  HANDSHAKE_DSP_BL_READY  0xFEFE	/* At start DSP writes this
when bootloader ready */
+#define  HANDSHAKE_DSP_BL_READY_USB  0xFE7E	/* At start DSP writes
this when bootloader ready */
+#define  HANDSHAKE_DRIVER_READY  0xFFFF	/* Driver writes after
receiving 0xFEFE */
+#define  HANDSHAKE_SEND_DATA     0x0000	/* DSP writes this when ready
for more data */

-#define  HANDSHAKE_REQUEST       0x0001   /* Request from DSP */
-#define  HANDSHAKE_RESPONSE      0x0000   /* Satisfied DSP request */
+#define  HANDSHAKE_REQUEST       0x0001	/* Request from DSP */
+#define  HANDSHAKE_RESPONSE      0x0000	/* Satisfied DSP request */

 #define  REQUEST_CODE_LENGTH     0x0000
 #define  REQUEST_RUN_ADDRESS     0x0001
-#define  REQUEST_CODE_SEGMENT    0x0002   /* In WORD count */
+#define  REQUEST_CODE_SEGMENT    0x0002	/* In WORD count */
 #define  REQUEST_DONE_BL         0x0003
 #define  REQUEST_DONE_CL         0x0004
 #define  REQUEST_VERSION_INFO    0x0005
@@ -67,18 +67,17 @@
 #define  DWNLD_MAG_CHKSUM_LOC        0x03
 #define  DWNLD_MAG_VAL_LOC           0x04

-#define  HANDSHAKE_MAG_DSP_BL_READY  0xFEFE0000   /* At start DSP
writes this when bootloader ready */
-#define  HANDSHAKE_MAG_DSP_ENTRY     0x01000000   /* Dsp writes this
to request for entry address */
-#define  HANDSHAKE_MAG_DSP_DATA      0x02000000   /* Dsp writes this
to request for data block */
-#define  HANDSHAKE_MAG_DSP_DONE      0x03000000   /* Dsp writes this
to indicate download done */
+#define  HANDSHAKE_MAG_DSP_BL_READY  0xFEFE0000	/* At start DSP
writes this when bootloader ready */
+#define  HANDSHAKE_MAG_DSP_ENTRY     0x01000000	/* Dsp writes this to
request for entry address */
+#define  HANDSHAKE_MAG_DSP_DATA      0x02000000	/* Dsp writes this to
request for data block */
+#define  HANDSHAKE_MAG_DSP_DONE      0x03000000	/* Dsp writes this to
indicate download done */

-#define  HANDSHAKE_MAG_DRV_READY     0xFFFF0000   /* Driver writes
this to indicate ready to download */
-#define  HANDSHAKE_MAG_DRV_DATA      0x02FECDAB   /* Driver writes
this to indicate data available to DSP */
-#define  HANDSHAKE_MAG_DRV_ENTRY     0x01FECDAB   /* Driver writes
this to indicate entry point to DSP */
+#define  HANDSHAKE_MAG_DRV_READY     0xFFFF0000	/* Driver writes this
to indicate ready to download */
+#define  HANDSHAKE_MAG_DRV_DATA      0x02FECDAB	/* Driver writes this
to indicate data available to DSP */
+#define  HANDSHAKE_MAG_DRV_ENTRY     0x01FECDAB	/* Driver writes this
to indicate entry point to DSP */

 #define  HANDSHAKE_MAG_TIMEOUT_VALUE 0xF1F1

-
 // New Magnemite downloader
 #define  DWNLD_MAG1_HANDSHAKE_LOC     0x00
 #define  DWNLD_MAG1_TYPE_LOC          0x01
@@ -87,60 +86,67 @@

 #pragma pack (push, pack_save, 1)
 typedef struct _DSP_FILE_HDR {
-   long        build_date;
-   long        dsp_coff_date;
-   long        loader_code_address;
-   long        loader_code_size;
-   long        loader_code_end;
-   long        dsp_code_address;
-   long        dsp_code_size;
-   long        dsp_code_end;
-   long        reserved[8];
+	long build_date;
+	long dsp_coff_date;
+	long loader_code_address;
+	long loader_code_size;
+	long loader_code_end;
+	long dsp_code_address;
+	long dsp_code_size;
+	long dsp_code_end;
+	long reserved[8];
 } DSP_FILE_HDR, *PDSP_FILE_HDR;

 typedef struct _DSP_FILE_HDR_5 {
-   long              version_id;          // Version ID of this image format.
-   long              package_id;          // Package ID of code release.
-   long              build_date;          // Date/time stamp when
file was built.
-   long              commands_offset;     // Offset to attached
commands in Pseudo Hdr format.
-   long              loader_offset;       // Offset to bootloader code.
-   long              loader_code_address; // Start address of bootloader.
-   long              loader_code_end;     // Where bootloader code ends.
-   long              loader_code_size;
-   long              version_data_offset; // Offset were scrambled
version data begins.
-   long              version_data_size;   // Size, in words, of
scrambled version data.
-   long              nDspImages;          // Number of DSP images in file.
-} DSP_FILE_HDR_5, * PDSP_FILE_HDR_5;
+	long version_id;	// Version ID of this image format.
+	long package_id;	// Package ID of code release.
+	long build_date;	// Date/time stamp when file was built.
+	long commands_offset;	// Offset to attached commands in Pseudo Hdr format.
+	long loader_offset;	// Offset to bootloader code.
+	long loader_code_address;	// Start address of bootloader.
+	long loader_code_end;	// Where bootloader code ends.
+	long loader_code_size;
+	long version_data_offset;	// Offset were scrambled version data begins.
+	long version_data_size;	// Size, in words, of scrambled version data.
+	long nDspImages;	// Number of DSP images in file.
+} DSP_FILE_HDR_5, *PDSP_FILE_HDR_5;

 typedef struct _DSP_IMAGE_INFO {
-   long              coff_date;           // Date/time when DSP Coff
image was built.
-   long              begin_offset;        // Offset in file where image begins.
-   long              end_offset;          // Offset in file where image begins.
-   long              run_address;         // On chip Start address of DSP code.
-   long              image_size;          // Size of image.
-   long              version;             // Embedded version # of DSP code.
+	long coff_date;		// Date/time when DSP Coff image was built.
+	long begin_offset;	// Offset in file where image begins.
+	long end_offset;	// Offset in file where image begins.
+	long run_address;	// On chip Start address of DSP code.
+	long image_size;	// Size of image.
+	long version;		// Embedded version # of DSP code.
 } DSP_IMAGE_INFO, *PDSP_IMAGE_INFO;

 typedef struct _DSP_IMAGE_INFO_V6 {
-   long              coff_date;           // Date/time when DSP Coff
image was built.
-   long              begin_offset;        // Offset in file where image begins.
-   long              end_offset;          // Offset in file where image begins.
-   long              run_address;         // On chip Start address of DSP code.
-   long              image_size;          // Size of image.
-   long              version;             // Embedded version # of DSP code.
-   unsigned short    checksum;            // DSP File checksum
-   unsigned short    pad1;
+	long coff_date;		// Date/time when DSP Coff image was built.
+	long begin_offset;	// Offset in file where image begins.
+	long end_offset;	// Offset in file where image begins.
+	long run_address;	// On chip Start address of DSP code.
+	long image_size;	// Size of image.
+	long version;		// Embedded version # of DSP code.
+	unsigned short checksum;	// DSP File checksum
+	unsigned short pad1;
 } DSP_IMAGE_INFO_V6, *PDSP_IMAGE_INFO_V6;

-
-u16 ft1000_read_register(struct ft1000_device *ft1000dev, short*
Data, u16 nRegIndx);
-u16 ft1000_write_register(struct ft1000_device *ft1000dev, USHORT
value, u16 nRegIndx);
-u16 ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx,
PUCHAR buffer, USHORT cnt);
-u16 ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT
indx, PUCHAR buffer, USHORT cnt);
-u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx,
PUCHAR buffer, u8 highlow);
-u16 ft1000_write_dpram16(struct ft1000_device *ft1000dev, USHORT
indx, USHORT value, u8 highlow);
-u16 fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT
indx, PUCHAR buffer);
-u16 fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT
indx, PUCHAR buffer);
+u16 ft1000_read_register(struct ft1000_device *ft1000dev, short *Data,
+			 u16 nRegIndx);
+u16 ft1000_write_register(struct ft1000_device *ft1000dev, USHORT value,
+			  u16 nRegIndx);
+u16 ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx,
+			PUCHAR buffer, USHORT cnt);
+u16 ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT indx,
+			 PUCHAR buffer, USHORT cnt);
+u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx,
+			PUCHAR buffer, u8 highlow);
+u16 ft1000_write_dpram16(struct ft1000_device *ft1000dev, USHORT indx,
+			 USHORT value, u8 highlow);
+u16 fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx,
+			    PUCHAR buffer);
+u16 fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT indx,
+			     PUCHAR buffer);

 //---------------------------------------------------------------------------
 // Function:    getfw
@@ -154,54 +160,54 @@ u16 fix_ft1000_write_dpram32(struct
ft1000_device *ft1000dev, USHORT indx, PUCHA
 // Notes:
 //
 //---------------------------------------------------------------------------
-char *getfw (char *fn, int *pimgsz)
+char *getfw(char *fn, int *pimgsz)
 {
-    struct file *fd;
-    mm_segment_t fs = get_fs();
-    loff_t pos;
-    char *pfwimg;
-    int fwimgsz;
-
-    set_fs(get_ds());
-
-    fd = filp_open(fn, 0, 0);
-    if ( IS_ERR(fd) )
-    {
-       DEBUG("FT1000:%s:can not open dsp image\n", __FUNCTION__);
-       set_fs(fs);
-       return NULL;
-    }
-
-    fwimgsz = i_size_read(fd->f_dentry->d_inode);
-    *pimgsz = fwimgsz;
-
-    if (fwimgsz <= 0)
-    {
-       DEBUG("FT1000:%s:invalid file size\n", __FUNCTION__);
-       filp_close(fd, current->files);
-       set_fs(fs);
-       return NULL;
-    }
-    pfwimg = (char*)vmalloc ( fwimgsz );
-    if (pfwimg == NULL) {
-        DEBUG("FT1000:%s:can not allocate memory for dsp image\n",
__FUNCTION__);
-        filp_close(fd, current->files);
-        set_fs(fs);
-        return NULL;
-    }
-    pos = 0;
-    if (vfs_read(fd, pfwimg, fwimgsz, &pos) != fwimgsz) {
-       vfree(pfwimg);
-       DEBUG("FT1000:%s:failed to read firmware image\n",__FUNCTION__);
-       filp_close(fd, current->files);
-       set_fs(fs);
-       return NULL;
-    }
-
-    filp_close(fd, current->files);
-    set_fs(fs);
-
-    return pfwimg;
+	struct file *fd;
+	mm_segment_t fs = get_fs();
+	loff_t pos;
+	char *pfwimg;
+	int fwimgsz;
+
+	set_fs(get_ds());
+
+	fd = filp_open(fn, 0, 0);
+	if (IS_ERR(fd)) {
+		DEBUG("FT1000:%s:can not open dsp image\n", __FUNCTION__);
+		set_fs(fs);
+		return NULL;
+	}
+
+	fwimgsz = i_size_read(fd->f_dentry->d_inode);
+	*pimgsz = fwimgsz;
+
+	if (fwimgsz <= 0) {
+		DEBUG("FT1000:%s:invalid file size\n", __FUNCTION__);
+		filp_close(fd, current->files);
+		set_fs(fs);
+		return NULL;
+	}
+	pfwimg = (char *)vmalloc(fwimgsz);
+	if (pfwimg == NULL) {
+		DEBUG("FT1000:%s:can not allocate memory for dsp image\n",
+		      __FUNCTION__);
+		filp_close(fd, current->files);
+		set_fs(fs);
+		return NULL;
+	}
+	pos = 0;
+	if (vfs_read(fd, pfwimg, fwimgsz, &pos) != fwimgsz) {
+		vfree(pfwimg);
+		DEBUG("FT1000:%s:failed to read firmware image\n",
+		      __FUNCTION__);
+		filp_close(fd, current->files);
+		set_fs(fs);
+		return NULL;
+	}
+
+	filp_close(fd, current->files);
+	set_fs(fs);
+
+	return pfwimg;
 }

 //---------------------------------------------------------------------------
@@ -216,68 +222,71 @@ char *getfw (char *fn, int *pimgsz)
 // Notes:
 //
 //---------------------------------------------------------------------------
-ULONG check_usb_db (struct ft1000_device *ft1000dev)
+ULONG check_usb_db(struct ft1000_device * ft1000dev)
 {
-   int               loopcnt;
-   USHORT            temp;
-   ULONG             status;
-
-   loopcnt = 0;
-   while (loopcnt < 10)
-   {
-
-      status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_DOORBELL);
-      DEBUG("check_usb_db: read FT1000_REG_DOORBELL value is %x\n", temp);
-      if (temp & 0x0080)
-      {
-           DEBUG("FT1000:Got checkusb doorbell\n");
-           status = ft1000_write_register (ft1000dev, 0x0080,
FT1000_REG_DOORBELL);
+	int loopcnt;
+	USHORT temp;
+	ULONG status;
+
+	loopcnt = 0;
+	while (loopcnt < 10) {
+
+		status =
+		    ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL);
+		DEBUG("check_usb_db: read FT1000_REG_DOORBELL value is %x\n",
+		      temp);
+		if (temp & 0x0080) {
+			DEBUG("FT1000:Got checkusb doorbell\n");
+			status =
+			    ft1000_write_register(ft1000dev, 0x0080,
+						  FT1000_REG_DOORBELL);
 #if FIFO_DNLD
-           status = ft1000_write_register (ft1000dev, 0x0100,
FT1000_REG_DOORBELL);
+			status =
+			    ft1000_write_register(ft1000dev, 0x0100,
+						  FT1000_REG_DOORBELL);
 #endif
-           status = ft1000_write_register (ft1000dev,  0x8000,
FT1000_REG_DOORBELL);
-           break;
-      }
-      else
-      {
-           loopcnt++;
-           msleep (10);
-      }
-
-   } //end of while
+			status =
+			    ft1000_write_register(ft1000dev, 0x8000,
+						  FT1000_REG_DOORBELL);
+			break;
+		} else {
+			loopcnt++;
+			msleep(10);
+		}

+	}			//end of while

-   loopcnt = 0;
-   while (loopcnt < 20)
-   {
+	loopcnt = 0;
+	while (loopcnt < 20) {

-      status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_DOORBELL);
-      DEBUG("FT1000:check_usb_db:Doorbell = 0x%x\n", temp);
-      if (temp & 0x8000)
-      {
-         loopcnt++;
-         msleep (10);
-      }
-      else
-      {
-         DEBUG("check_usb_db: door bell is cleared, return 0\n");
-         return 0;
-      }
+		status =
+		    ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL);
+		DEBUG("FT1000:check_usb_db:Doorbell = 0x%x\n", temp);
+		if (temp & 0x8000) {
+			loopcnt++;
+			msleep(10);
+		} else {
+			DEBUG("check_usb_db: door bell is cleared, return 0\n");
+			return 0;
+		}
 #if 0
-      // Check if Card is present
-      status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_SUP_IMASK);
-      if (temp == 0x0000) {
-          break;
-      }
+		// Check if Card is present
+		status =
+		    ft1000_read_register(ft1000dev, &temp,
+					 FT1000_REG_SUP_IMASK);
+		if (temp == 0x0000) {
+			break;
+		}

-      status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_ASIC_ID);
-      if (temp == 0xffff) {
-         break;
-      }
+		status =
+		    ft1000_read_register(ft1000dev, &temp, FT1000_REG_ASIC_ID);
+		if (temp == 0xffff) {
+			break;
+		}
 #endif
-   }
+	}

-   return HANDSHAKE_MAG_TIMEOUT_VALUE;
+	return HANDSHAKE_MAG_TIMEOUT_VALUE;

 }

@@ -295,101 +304,112 @@ ULONG check_usb_db (struct ft1000_device *ft1000dev)
 // Notes:
 //
 //---------------------------------------------------------------------------
-USHORT get_handshake(struct ft1000_device *ft1000dev, USHORT expected_value)
+USHORT get_handshake(struct ft1000_device * ft1000dev, USHORT expected_value)
 {
-   USHORT            handshake;
-   int               loopcnt;
-   ULONG             status=0;
-   PFT1000_INFO       pft1000info = netdev_priv(ft1000dev->net);
+	USHORT handshake;
+	int loopcnt;
+	ULONG status = 0;
+	PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);

-   loopcnt = 0;
-   while (loopcnt < 100)
-   {
+	loopcnt = 0;
+	while (loopcnt < 100) {

 #if FIFO_DNLD
-           // Need to clear downloader doorbell if Hartley ASIC
-           status = ft1000_write_register (ft1000dev,
FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL);
-           //DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp);
-               if (pft1000info->fcodeldr)
-               {
-                   DEBUG(" get_handshake: fcodeldr is %d\n",
pft1000info->fcodeldr);
-                   pft1000info->fcodeldr = 0;
-                   status = check_usb_db(ft1000dev);
-                   if (status != STATUS_SUCCESS)
-                   {
-                       DEBUG("get_handshake: check_usb_db failed\n");
-                       status = STATUS_FAILURE;
-                       break;
-                   }
-                   status = ft1000_write_register (ft1000dev,
FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL);
-               }
-
-                status = ft1000_read_dpram16 (ft1000dev,
DWNLD_MAG1_HANDSHAKE_LOC, (PUCHAR)&handshake, 1);
-                //DEBUG("get_handshake: handshake is %x\n", tempx);
-                handshake = ntohs(handshake);
-                //DEBUG("get_handshake: after swap, handshake is
%x\n", handshake);
+		// Need to clear downloader doorbell if Hartley ASIC
+		status =
+		    ft1000_write_register(ft1000dev, FT1000_DB_DNLD_RX,
+					  FT1000_REG_DOORBELL);
+		//DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp);
+		if (pft1000info->fcodeldr) {
+			DEBUG(" get_handshake: fcodeldr is %d\n",
+			      pft1000info->fcodeldr);
+			pft1000info->fcodeldr = 0;
+			status = check_usb_db(ft1000dev);
+			if (status != STATUS_SUCCESS) {
+				DEBUG("get_handshake: check_usb_db failed\n");
+				status = STATUS_FAILURE;
+				break;
+			}
+			status =
+			    ft1000_write_register(ft1000dev, FT1000_DB_DNLD_RX,
+						  FT1000_REG_DOORBELL);
+		}
+
+		status =
+		    ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC,
+					(PUCHAR) & handshake, 1);
+		//DEBUG("get_handshake: handshake is %x\n", tempx);
+		handshake = ntohs(handshake);
+		//DEBUG("get_handshake: after swap, handshake is %x\n", handshake);
 #else
-           // Need to clear downloader doorbell if Hartley ASIC
-           status = ft1000_read_register (ft1000dev, &temp,
FT1000_REG_DOORBELL);
-           //DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp);
-           if (temp)
-           {
-               if (temp & FT1000_DB_DNLD_RX)
-               {
-                   //DEBUG("get_handshake: write FT1000_DB_DNLD_RX to
doorbell register\n");
-                   status = ft1000_write_register(ft1000dev,
FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL);
-               }
-
-               if (pft1000info->fcodeldr)
-               {
-                   DEBUG(" get_handshake: fcodeldr is %d\n",
pft1000info->fcodeldr);
-                   pft1000info->fcodeldr = 0;
-                   status = check_usb_db(ft1000dev);
-                   if (status != STATUS_SUCCESS)
-                   {
-                       DEBUG("get_handshake: check_usb_db failed\n");
-                       status = STATUS_FAILURE;
-                       break;
-                   }
-
-                   status = ft1000_read_register (ft1000dev, &temp,
FT1000_REG_DOORBELL);
-                   //DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp);
-                   if (temp)
-                   {
-                       if (temp & FT1000_DB_DNLD_RX)
-                           status =
ft1000_write_register(ft1000dev,FT1000_DB_DNLD_RX,
FT1000_REG_DOORBELL);
-                   }
-                }
-
-                status = ft1000_read_dpram16 (ft1000dev,
DWNLD_MAG1_HANDSHAKE_LOC, (PUCHAR)&handshake, 1);
-                //DEBUG("get_handshake: handshake is %x\n", tempx);
-                handshake = ntohs(handshake);
-                //DEBUG("get_handshake: after swap, handshake is
%x\n", handshake);
-
-           } //end of if temp
-#endif
+		// Need to clear downloader doorbell if Hartley ASIC
+		status =
+		    ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL);
+		//DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp);
+		if (temp) {
+			if (temp & FT1000_DB_DNLD_RX) {
+				//DEBUG("get_handshake: write FT1000_DB_DNLD_RX to doorbell register\n");
+				status =
+				    ft1000_write_register(ft1000dev,
+							  FT1000_DB_DNLD_RX,
+							  FT1000_REG_DOORBELL);
+			}

+			if (pft1000info->fcodeldr) {
+				DEBUG(" get_handshake: fcodeldr is %d\n",
+				      pft1000info->fcodeldr);
+				pft1000info->fcodeldr = 0;
+				status = check_usb_db(ft1000dev);
+				if (status != STATUS_SUCCESS) {
+					DEBUG
+					    ("get_handshake: check_usb_db failed\n");
+					status = STATUS_FAILURE;
+					break;
+				}

-        if (status)
-           return HANDSHAKE_TIMEOUT_VALUE;
+				status =
+				    ft1000_read_register(ft1000dev, &temp,
+							 FT1000_REG_DOORBELL);
+				//DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp);
+				if (temp) {
+					if (temp & FT1000_DB_DNLD_RX)
+						status =
+						    ft1000_write_register
+						    (ft1000dev,
+						     FT1000_DB_DNLD_RX,
+						     FT1000_REG_DOORBELL);
+				}
+			}
+
+			status =
+			    ft1000_read_dpram16(ft1000dev,
+						DWNLD_MAG1_HANDSHAKE_LOC,
+						(PUCHAR) & handshake, 1);
+			//DEBUG("get_handshake: handshake is %x\n", tempx);
+			handshake = ntohs(handshake);
+			//DEBUG("get_handshake: after swap, handshake is %x\n", handshake);
+
+		}		//end of if temp
+#endif

-        //DEBUG("get_handshake: handshake= %x\n", handshake);
-        if ((handshake == expected_value) || (handshake ==
HANDSHAKE_RESET_VALUE_USB))
-        {
-            //DEBUG("get_handshake: return handshake %x\n", handshake);
-            return handshake;
-        }
-        else
-        {
-            loopcnt++;
-            msleep (10);
-        }
-        //DEBUG("HANDSHKE LOOP: %d\n", loopcnt);
+		if (status)
+			return HANDSHAKE_TIMEOUT_VALUE;
+
+		//DEBUG("get_handshake: handshake= %x\n", handshake);
+		if ((handshake == expected_value)
+		    || (handshake == HANDSHAKE_RESET_VALUE_USB)) {
+			//DEBUG("get_handshake: return handshake %x\n", handshake);
+			return handshake;
+		} else {
+			loopcnt++;
+			msleep(10);
+		}
+		//DEBUG("HANDSHKE LOOP: %d\n", loopcnt);

-   }
+	}

-   //DEBUG("get_handshake: return handshake time out\n");
-   return HANDSHAKE_TIMEOUT_VALUE;
+	//DEBUG("get_handshake: return handshake time out\n");
+	return HANDSHAKE_TIMEOUT_VALUE;
 }

 //---------------------------------------------------------------------------
@@ -406,87 +426,102 @@ USHORT get_handshake(struct ft1000_device
*ft1000dev, USHORT expected_value)
 // Notes:
 //
 //---------------------------------------------------------------------------
-void put_handshake(struct ft1000_device *ft1000dev,USHORT handshake_value)
+void put_handshake(struct ft1000_device *ft1000dev, USHORT handshake_value)
 {
-    ULONG tempx;
-    USHORT tempword;
-    int i;
-    ULONG status;
-
-
-
-        tempx = (ULONG)handshake_value;
-        tempx = ntohl(tempx);
-
-        tempword = (USHORT)(tempx & 0xffff);
-        status = ft1000_write_dpram16 (ft1000dev,
DWNLD_MAG1_HANDSHAKE_LOC, tempword, 0);
-        tempword = (USHORT)(tempx >> 16);
-        status = ft1000_write_dpram16 (ft1000dev,
DWNLD_MAG1_HANDSHAKE_LOC, tempword, 1);
-        status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_TX,
FT1000_REG_DOORBELL);
+	ULONG tempx;
+	USHORT tempword;
+	int i;
+	ULONG status;
+
+	tempx = (ULONG) handshake_value;
+	tempx = ntohl(tempx);
+
+	tempword = (USHORT) (tempx & 0xffff);
+	status =
+	    ft1000_write_dpram16(ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, tempword,
+				 0);
+	tempword = (USHORT) (tempx >> 16);
+	status =
+	    ft1000_write_dpram16(ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, tempword,
+				 1);
+	status =
+	    ft1000_write_register(ft1000dev, FT1000_DB_DNLD_TX,
+				  FT1000_REG_DOORBELL);
 #if FIFO_DNLD
-        for (i=0; i<1000; i++);
+	for (i = 0; i < 1000; i++) ;
 #else
-        for (i=0; i<10; i++)
-        {
-            status = ft1000_read_register (ft1000dev, &tempword,
FT1000_REG_DOORBELL);
-            if ((tempword & FT1000_DB_DNLD_TX) == 0)
-                break;
-        }
-        if (i==10)
-        {
-            DEBUG("FT1000:put_handshake could not clear Tx doorbell\n");
-            status = ft1000_read_register (ft1000dev, &tempword,
FT1000_REG_DOORBELL);
-            DEBUG("FT1000:put_handshake:doorbell = 0x%x\n",tempword);
-        }
+	for (i = 0; i < 10; i++) {
+		status =
+		    ft1000_read_register(ft1000dev, &tempword,
+					 FT1000_REG_DOORBELL);
+		if ((tempword & FT1000_DB_DNLD_TX) == 0)
+			break;
+	}
+	if (i == 10) {
+		DEBUG("FT1000:put_handshake could not clear Tx doorbell\n");
+		status =
+		    ft1000_read_register(ft1000dev, &tempword,
+					 FT1000_REG_DOORBELL);
+		DEBUG("FT1000:put_handshake:doorbell = 0x%x\n", tempword);
+	}
 #endif

 }

 USHORT get_handshake_usb(struct ft1000_device *ft1000dev, USHORT
expected_value)
 {
-   USHORT            handshake;
-   int               loopcnt;
-   USHORT            temp;
-   ULONG             status=0;
-
-   PFT1000_INFO      pft1000info = netdev_priv(ft1000dev->net);
-   loopcnt = 0;
-   handshake = 0;
-   while (loopcnt < 100)
-   {
-       if (pft1000info->usbboot == 2) {
-           status = ft1000_read_dpram32 (ft1000dev, 0,
(PUCHAR)&(pft1000info->tempbuf[0]), 64);
-           for (temp=0; temp<16; temp++)
-               DEBUG("tempbuf %d = 0x%x\n", temp, pft1000info->tempbuf[temp]);
-           status = ft1000_read_dpram16 (ft1000dev,
DWNLD_MAG1_HANDSHAKE_LOC, (PUCHAR)&handshake, 1);
-           DEBUG("handshake from read_dpram16 = 0x%x\n", handshake);
-           if (pft1000info->dspalive == pft1000info->tempbuf[6])
-               handshake = 0;
-           else {
-               handshake = pft1000info->tempbuf[1];
-               pft1000info->dspalive = pft1000info->tempbuf[6];
-           }
-       }
-       else {
-           status = ft1000_read_dpram16 (ft1000dev,
DWNLD_MAG1_HANDSHAKE_LOC, (PUCHAR)&handshake, 1);
-       }
-       loopcnt++;
-       msleep(10);
-       handshake = ntohs(handshake);
-       if ((handshake == expected_value) || (handshake ==
HANDSHAKE_RESET_VALUE_USB))
-       {
-           return handshake;
-       }
-   }
-
-   return HANDSHAKE_TIMEOUT_VALUE;
+	USHORT handshake;
+	int loopcnt;
+	USHORT temp;
+	ULONG status = 0;
+
+	PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
+	loopcnt = 0;
+	handshake = 0;
+	while (loopcnt < 100) {
+		if (pft1000info->usbboot == 2) {
+			status =
+			    ft1000_read_dpram32(ft1000dev, 0,
+						(PUCHAR) & (pft1000info->
+							    tempbuf[0]), 64);
+			for (temp = 0; temp < 16; temp++)
+				DEBUG("tempbuf %d = 0x%x\n", temp,
+				      pft1000info->tempbuf[temp]);
+			status =
+			    ft1000_read_dpram16(ft1000dev,
+						DWNLD_MAG1_HANDSHAKE_LOC,
+						(PUCHAR) & handshake, 1);
+			DEBUG("handshake from read_dpram16 = 0x%x\n",
+			      handshake);
+			if (pft1000info->dspalive == pft1000info->tempbuf[6])
+				handshake = 0;
+			else {
+				handshake = pft1000info->tempbuf[1];
+				pft1000info->dspalive = pft1000info->tempbuf[6];
+			}
+		} else {
+			status =
+			    ft1000_read_dpram16(ft1000dev,
+						DWNLD_MAG1_HANDSHAKE_LOC,
+						(PUCHAR) & handshake, 1);
+		}
+		loopcnt++;
+		msleep(10);
+		handshake = ntohs(handshake);
+		if ((handshake == expected_value)
+		    || (handshake == HANDSHAKE_RESET_VALUE_USB)) {
+			return handshake;
+		}
+	}
+
+	return HANDSHAKE_TIMEOUT_VALUE;
 }

-void put_handshake_usb(struct ft1000_device *ft1000dev,USHORT handshake_value)
+void put_handshake_usb(struct ft1000_device *ft1000dev, USHORT handshake_value)
 {
-   int i;
+	int i;

-        for (i=0; i<1000; i++);
+	for (i = 0; i < 1000; i++) ;
 }

 //---------------------------------------------------------------------------
@@ -503,65 +538,68 @@ void put_handshake_usb(struct ft1000_device
*ft1000dev,USHORT handshake_value)
 //---------------------------------------------------------------------------
 USHORT get_request_type(struct ft1000_device *ft1000dev)
 {
-   USHORT   request_type;
-   ULONG    status;
-   USHORT   tempword;
-   ULONG    tempx;
-   PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
-
-   if ( pft1000info->bootmode == 1)
-   {
-       status = fix_ft1000_read_dpram32 (ft1000dev,
DWNLD_MAG1_TYPE_LOC, (PUCHAR)&tempx);
-       tempx = ntohl(tempx);
-   }
-   else
-   {
+	USHORT request_type;
+	ULONG status;
+	USHORT tempword;
+	ULONG tempx;
+	PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
+
+	if (pft1000info->bootmode == 1) {
+		status =
+		    fix_ft1000_read_dpram32(ft1000dev, DWNLD_MAG1_TYPE_LOC,
+					    (PUCHAR) & tempx);
+		tempx = ntohl(tempx);
+	} else {
 #if FIFO_DNLD
-       tempx = 0;
+		tempx = 0;
 #else
-       status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_TYPE_LOC,
(PUCHAR)&tempword, 0);
-       tempx = tempword;
+		status =
+		    ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_TYPE_LOC,
+					(PUCHAR) & tempword, 0);
+		tempx = tempword;
 #endif
-       status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_TYPE_LOC,
(PUCHAR)&tempword, 1);
-       tempx |= (tempword << 16);
-       tempx = ntohl(tempx);
-   }
-   request_type = (USHORT)tempx;
+		status =
+		    ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_TYPE_LOC,
+					(PUCHAR) & tempword, 1);
+		tempx |= (tempword << 16);
+		tempx = ntohl(tempx);
+	}
+	request_type = (USHORT) tempx;

-   //DEBUG("get_request_type: request_type is %x\n", request_type);
-   return request_type;
+	//DEBUG("get_request_type: request_type is %x\n", request_type);
+	return request_type;

 }

-USHORT get_request_type_usb(struct ft1000_device *ft1000dev)
+USHORT get_request_type_usb(struct ft1000_device * ft1000dev)
 {
-   USHORT   request_type;
-   ULONG    status;
-   USHORT   tempword;
-   ULONG    tempx;
-   PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
-   if ( pft1000info->bootmode == 1)
-   {
-       status = fix_ft1000_read_dpram32 (ft1000dev,
DWNLD_MAG1_TYPE_LOC, (PUCHAR)&tempx);
-       tempx = ntohl(tempx);
-   }
-   else
-   {
-       if (pft1000info->usbboot == 2) {
-          tempx = pft1000info->tempbuf[2];
-          tempword = pft1000info->tempbuf[3];
-       }
-       else {
-          tempx = 0;
-          status = ft1000_read_dpram16 (ft1000dev,
DWNLD_MAG1_TYPE_LOC, (PUCHAR)&tempword, 1);
-       }
-       tempx |= (tempword << 16);
-       tempx = ntohl(tempx);
-   }
-   request_type = (USHORT)tempx;
-
-   //DEBUG("get_request_type: request_type is %x\n", request_type);
-   return request_type;
+	USHORT request_type;
+	ULONG status;
+	USHORT tempword;
+	ULONG tempx;
+	PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
+	if (pft1000info->bootmode == 1) {
+		status =
+		    fix_ft1000_read_dpram32(ft1000dev, DWNLD_MAG1_TYPE_LOC,
+					    (PUCHAR) & tempx);
+		tempx = ntohl(tempx);
+	} else {
+		if (pft1000info->usbboot == 2) {
+			tempx = pft1000info->tempbuf[2];
+			tempword = pft1000info->tempbuf[3];
+		} else {
+			tempx = 0;
+			status =
+			    ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_TYPE_LOC,
+						(PUCHAR) & tempword, 1);
+		}
+		tempx |= (tempword << 16);
+		tempx = ntohl(tempx);
+	}
+	request_type = (USHORT) tempx;
+
+	//DEBUG("get_request_type: request_type is %x\n", request_type);
+	return request_type;

 }

@@ -579,58 +617,60 @@ USHORT get_request_type_usb(struct ft1000_device
*ft1000dev)
 //---------------------------------------------------------------------------
 long get_request_value(struct ft1000_device *ft1000dev)
 {
-   ULONG     value;
-   USHORT   tempword;
-   ULONG    status;
-   PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
-
-
-       if ( pft1000info->bootmode == 1)
-       {
-	   status = fix_ft1000_read_dpram32(ft1000dev, DWNLD_MAG1_SIZE_LOC,
(PUCHAR)&value);
-	   value = ntohl(value);
-       }
-       else
-       {
-	   status = ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_SIZE_LOC,
(PUCHAR)&tempword, 0);
-	   value = tempword;
-           status = ft1000_read_dpram16(ft1000dev,
DWNLD_MAG1_SIZE_LOC, (PUCHAR)&tempword, 1);
-	   value |= (tempword << 16);
-	   value = ntohl(value);
-       }
-
-
-   //DEBUG("get_request_value: value is %x\n", value);
-   return value;
+	ULONG value;
+	USHORT tempword;
+	ULONG status;
+	PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
+
+	if (pft1000info->bootmode == 1) {
+		status =
+		    fix_ft1000_read_dpram32(ft1000dev, DWNLD_MAG1_SIZE_LOC,
+					    (PUCHAR) & value);
+		value = ntohl(value);
+	} else {
+		status =
+		    ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_SIZE_LOC,
+					(PUCHAR) & tempword, 0);
+		value = tempword;
+		status =
+		    ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_SIZE_LOC,
+					(PUCHAR) & tempword, 1);
+		value |= (tempword << 16);
+		value = ntohl(value);
+	}
+
+	//DEBUG("get_request_value: value is %x\n", value);
+	return value;

 }

 long get_request_value_usb(struct ft1000_device *ft1000dev)
 {
-   ULONG     value;
-   USHORT   tempword;
-   ULONG    status;
-   PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
-
-       if (pft1000info->usbboot == 2) {
-          value = pft1000info->tempbuf[4];
-          tempword = pft1000info->tempbuf[5];
-       }
-       else {
-          value = 0;
-          status = ft1000_read_dpram16(ft1000dev,
DWNLD_MAG1_SIZE_LOC, (PUCHAR)&tempword, 1);
-       }
-
-       value |= (tempword << 16);
-       value = ntohl(value);
+	ULONG value;
+	USHORT tempword;
+	ULONG status;
+	PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
+
+	if (pft1000info->usbboot == 2) {
+		value = pft1000info->tempbuf[4];
+		tempword = pft1000info->tempbuf[5];
+	} else {
+		value = 0;
+		status =
+		    ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_SIZE_LOC,
+					(PUCHAR) & tempword, 1);
+	}
+
+	value |= (tempword << 16);
+	value = ntohl(value);

 #if FIFO_DNLD
-   if (pft1000info->usbboot == 1)
-       pft1000info->usbboot = 2;
+	if (pft1000info->usbboot == 1)
+		pft1000info->usbboot = 2;
 #endif

-   //DEBUG("get_request_value_usb: value is %x\n", value);
-   return value;
+	//DEBUG("get_request_value_usb: value is %x\n", value);
+	return value;

 }

@@ -649,20 +689,18 @@ long get_request_value_usb(struct ft1000_device
*ft1000dev)
 //---------------------------------------------------------------------------
 void put_request_value(struct ft1000_device *ft1000dev, long lvalue)
 {
-   ULONG    tempx;
-   ULONG    status;
-
-       tempx = ntohl(lvalue);
-       status = fix_ft1000_write_dpram32(ft1000dev,
DWNLD_MAG1_SIZE_LOC, (PUCHAR)&tempx);
-
+	ULONG tempx;
+	ULONG status;

+	tempx = ntohl(lvalue);
+	status =
+	    fix_ft1000_write_dpram32(ft1000dev, DWNLD_MAG1_SIZE_LOC,
+				     (PUCHAR) & tempx);

-   //DEBUG("put_request_value: value is %x\n", lvalue);
+	//DEBUG("put_request_value: value is %x\n", lvalue);

 }

-
-
 //---------------------------------------------------------------------------
 // Function:    hdr_checksum
 //
@@ -677,17 +715,15 @@ void put_request_value(struct ft1000_device
*ft1000dev, long lvalue)
 //---------------------------------------------------------------------------
 USHORT hdr_checksum(PPSEUDO_HDR pHdr)
 {
-   USHORT   *usPtr = (USHORT *)pHdr;
-   USHORT   chksum;
+	USHORT *usPtr = (USHORT *) pHdr;
+	USHORT chksum;

+	chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^
+		    usPtr[4]) ^ usPtr[5]) ^ usPtr[6]);

-  chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^
-                    usPtr[4]) ^ usPtr[5]) ^ usPtr[6]);
-
-  return chksum;
+	return chksum;
 }

-
 //---------------------------------------------------------------------------
 // Function:    write_blk
 //
@@ -705,143 +741,157 @@ USHORT hdr_checksum(PPSEUDO_HDR pHdr)
 // Notes:
 //
 //---------------------------------------------------------------------------
-ULONG write_blk (struct ft1000_device *ft1000dev, USHORT **pUsFile,
UCHAR **pUcFile, long word_length)
+ULONG write_blk(struct ft1000_device * ft1000dev, USHORT ** pUsFile,
+		UCHAR ** pUcFile, long word_length)
 {
-   ULONG Status = STATUS_SUCCESS;
-   USHORT dpram;
-   long temp_word_length;
-   int loopcnt, i, j;
-   USHORT *pTempFile;
-   USHORT tempword;
-   USHORT tempbuffer[64];
-   USHORT resultbuffer[64];
-   PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
-
-   //DEBUG("FT1000:download:start word_length = %d\n",(int)word_length);
-   dpram = (USHORT)DWNLD_MAG1_PS_HDR_LOC;
-   tempword = *(*pUsFile);
-   (*pUsFile)++;
-   Status = ft1000_write_dpram16(ft1000dev, dpram, tempword, 0);
-   tempword = *(*pUsFile);
-   (*pUsFile)++;
-   Status = ft1000_write_dpram16(ft1000dev, dpram++, tempword, 1);
-
-   *pUcFile = *pUcFile + 4;
-   word_length--;
-   tempword = (USHORT)word_length;
-   word_length = (word_length / 16) + 1;
-   pTempFile = *pUsFile;
-   temp_word_length = word_length;
-   for (; word_length > 0; word_length--) /* In words */
-   {
-	   loopcnt = 0;
-
-	      for (i=0; i<32; i++)
-	      {
-		       if (tempword != 0)
-		       {
-    		           tempbuffer[i++] = *(*pUsFile);
-			   (*pUsFile)++;
-   	    	           tempbuffer[i] = *(*pUsFile);
-			   (*pUsFile)++;
-			   *pUcFile = *pUcFile + 4;
-			   loopcnt++;
-			   tempword--;
-		       }
-		       else
-		       {
-			   tempbuffer[i++] = 0;
-			   tempbuffer[i] = 0;
-                       }
-	      }
-
-              //DEBUG("write_blk: loopcnt is %d\n", loopcnt);
-              //DEBUG("write_blk: bootmode = %d\n", bootmode);
-              //DEBUG("write_blk: dpram = %x\n", dpram);
-	      if (pft1000info->bootmode == 0)
-	      {
-		 if (dpram >= 0x3F4)
-                     Status = ft1000_write_dpram32 (ft1000dev, dpram,
(PUCHAR)&tempbuffer[0], 8);
-	         else
-                    Status = ft1000_write_dpram32 (ft1000dev, dpram,
(PUCHAR)&tempbuffer[0], 64);
-	      }
-	      else
-	      {
-                 for (j=0; j<10; j++)
-                 {
-                   Status = ft1000_write_dpram32 (ft1000dev, dpram,
(PUCHAR)&tempbuffer[0], 64);
-		   if (Status == STATUS_SUCCESS)
-		   {
-		       // Work around for ASIC bit stuffing problem.
-		       if ( (tempbuffer[31] & 0xfe00) == 0xfe00)
-		       {
-      		           Status = ft1000_write_dpram32(ft1000dev, dpram+12,
(PUCHAR)&tempbuffer[24], 64);
-		       }
-    		       // Let's check the data written
-	    	       Status = ft1000_read_dpram32 (ft1000dev, dpram,
(PUCHAR)&resultbuffer[0], 64);
-		       if ( (tempbuffer[31] & 0xfe00) == 0xfe00)
-		       {
-		           for (i=0; i<28; i++)
-		           {
-			       if (resultbuffer[i] != tempbuffer[i])
-			       {
-			           //NdisMSleep (100);
-                                   DEBUG("FT1000:download:DPRAM write
failed 1 during bootloading\n");
-				   msleep(10);
-     	  			   Status = STATUS_FAILURE;
-				   break;
-				}
-			   }
-   			   Status = ft1000_read_dpram32 (ft1000dev, dpram+12,
(PUCHAR)&resultbuffer[0], 64);
-		           for (i=0; i<16; i++)
-		           {
-    			       if (resultbuffer[i] != tempbuffer[i+24])
-    			       {
-                                   //NdisMSleep (100);
-                                   DEBUG("FT1000:download:DPRAM write
failed 2 during bootloading\n");
-				   msleep(10);
-				   Status = STATUS_FAILURE;
-				   break;
-				}
-			   }
+	ULONG Status = STATUS_SUCCESS;
+	USHORT dpram;
+	long temp_word_length;
+	int loopcnt, i, j;
+	USHORT *pTempFile;
+	USHORT tempword;
+	USHORT tempbuffer[64];
+	USHORT resultbuffer[64];
+	PFT1000_INFO pft1000info = netdev_priv(ft1000dev->net);
+
+	//DEBUG("FT1000:download:start word_length = %d\n",(int)word_length);
+	dpram = (USHORT) DWNLD_MAG1_PS_HDR_LOC;
+	tempword = *(*pUsFile);
+	(*pUsFile)++;
+	Status = ft1000_write_dpram16(ft1000dev, dpram, tempword, 0);
+	tempword = *(*pUsFile);
+	(*pUsFile)++;
+	Status = ft1000_write_dpram16(ft1000dev, dpram++, tempword, 1);
+
+	*pUcFile = *pUcFile + 4;
+	word_length--;
+	tempword = (USHORT) word_length;
+	word_length = (word_length / 16) + 1;
+	pTempFile = *pUsFile;
+	temp_word_length = word_length;
+	for (; word_length > 0; word_length--) {	/* In words */
+		loopcnt = 0;
+
+		for (i = 0; i < 32; i++) {
+			if (tempword != 0) {
+				tempbuffer[i++] = *(*pUsFile);
+				(*pUsFile)++;
+				tempbuffer[i] = *(*pUsFile);
+				(*pUsFile)++;
+				*pUcFile = *pUcFile + 4;
+				loopcnt++;
+				tempword--;
+			} else {
+				tempbuffer[i++] = 0;
+				tempbuffer[i] = 0;
 			}
+		}
+
+		//DEBUG("write_blk: loopcnt is %d\n", loopcnt);
+		//DEBUG("write_blk: bootmode = %d\n", bootmode);
+		//DEBUG("write_blk: dpram = %x\n", dpram);
+		if (pft1000info->bootmode == 0) {
+			if (dpram >= 0x3F4)
+				Status =
+				    ft1000_write_dpram32(ft1000dev, dpram,
+							 (PUCHAR) &
+							 tempbuffer[0], 8);
 			else
-			{
-			    for (i=0; i<32; i++)
-			    {
-    			        if (resultbuffer[i] != tempbuffer[i])
-    			        {
-                                    //NdisMSleep (100);
-                                    DEBUG("FT1000:download:DPRAM
write failed 3 during bootloading\n");
-				    msleep(10);
-				    Status = STATUS_FAILURE;
-				    break;
+				Status =
+				    ft1000_write_dpram32(ft1000dev, dpram,
+							 (PUCHAR) &
+							 tempbuffer[0], 64);
+		} else {
+			for (j = 0; j < 10; j++) {
+				Status =
+				    ft1000_write_dpram32(ft1000dev, dpram,
+							 (PUCHAR) &
+							 tempbuffer[0], 64);
+				if (Status == STATUS_SUCCESS) {
+					// Work around for ASIC bit stuffing problem.
+					if ((tempbuffer[31] & 0xfe00) == 0xfe00) {
+						Status =
+						    ft1000_write_dpram32
+						    (ft1000dev, dpram + 12,
+						     (PUCHAR) & tempbuffer[24],
+						     64);
+					}
+					// Let's check the data written
+					Status =
+					    ft1000_read_dpram32(ft1000dev,
+								dpram,
+								(PUCHAR) &
+								resultbuffer[0],
+								64);
+					if ((tempbuffer[31] & 0xfe00) == 0xfe00) {
+						for (i = 0; i < 28; i++) {
+							if (resultbuffer[i] !=
+							    tempbuffer[i]) {
+								//NdisMSleep (100);
+								DEBUG
+								    ("FT1000:download:DPRAM write failed 1 during bootloading\n");
+								msleep(10);
+								Status =
+								    STATUS_FAILURE;
+								break;
+							}
+						}
+						Status =
+						    ft1000_read_dpram32
+						    (ft1000dev, dpram + 12,
+						     (PUCHAR) & resultbuffer[0],
+						     64);
+						for (i = 0; i < 16; i++) {
+							if (resultbuffer[i] !=
+							    tempbuffer[i +
+								       24]) {
+								//NdisMSleep (100);
+								DEBUG
+								    ("FT1000:download:DPRAM write failed 2 during bootloading\n");
+								msleep(10);
+								Status =
+								    STATUS_FAILURE;
+								break;
+							}
+						}
+					} else {
+						for (i = 0; i < 32; i++) {
+							if (resultbuffer[i] !=
+							    tempbuffer[i]) {
+								//NdisMSleep (100);
+								DEBUG
+								    ("FT1000:download:DPRAM write failed 3 during bootloading\n");
+								msleep(10);
+								Status =
+								    STATUS_FAILURE;
+								break;
+							}
+						}
+					}
+
+					if (Status == STATUS_SUCCESS)
+						break;
+
 				}
-			    }
 			}

-			if (Status == STATUS_SUCCESS)
-			    break;
-
-		    }
-		}
+			if (Status != STATUS_SUCCESS) {
+				DEBUG
+				    ("FT1000:download:Write failed tempbuffer[31] = 0x%x\n",
+				     tempbuffer[31]);
+				break;
+			}

-		if (Status != STATUS_SUCCESS)
-		{
-                    DEBUG("FT1000:download:Write failed
tempbuffer[31] = 0x%x\n", tempbuffer[31]);
-		    break;
 		}
+		dpram = dpram + loopcnt;
+	}

-	     }
-   	     dpram = dpram + loopcnt;
-   }
-
-   return Status;
+	return Status;
 }

-static void usb_dnld_complete (struct urb *urb)
+static void usb_dnld_complete(struct urb *urb)
 {
-    //DEBUG("****** usb_dnld_complete\n");
+	//DEBUG("****** usb_dnld_complete\n");
 }

 //---------------------------------------------------------------------------
@@ -861,60 +911,58 @@ static void usb_dnld_complete (struct urb *urb)
 // Notes:
 //
 //---------------------------------------------------------------------------
-ULONG write_blk_fifo (struct ft1000_device *ft1000dev, USHORT
**pUsFile, UCHAR **pUcFile, long word_length)
+ULONG write_blk_fifo(struct ft1000_device *ft1000dev, USHORT ** pUsFile,
+		     UCHAR ** pUcFile, long word_length)
 {
-   ULONG Status = STATUS_SUCCESS;
-   int byte_length;
-   long aligncnt;
+	ULONG Status = STATUS_SUCCESS;
+	int byte_length;
+	long aligncnt;

-   byte_length = word_length * 4;
+	byte_length = word_length * 4;

-   if (byte_length % 4)
-      aligncnt = 4 - (byte_length % 4);
-   else
-      aligncnt = 0;
-   byte_length += aligncnt;
+	if (byte_length % 4)
+		aligncnt = 4 - (byte_length % 4);
+	else
+		aligncnt = 0;
+	byte_length += aligncnt;

-   if (byte_length && ((byte_length % 64) == 0)) {
-      byte_length += 4;
-   }
+	if (byte_length && ((byte_length % 64) == 0)) {
+		byte_length += 4;
+	}

-   if (byte_length < 64)
-       byte_length = 68;
+	if (byte_length < 64)
+		byte_length = 68;

 #if 0
-   pblk = kzalloc(byte_length, GFP_KERNEL);
-   memcpy (pblk, *pUcFile, byte_length);
+	pblk = kzalloc(byte_length, GFP_KERNEL);
+	memcpy(pblk, *pUcFile, byte_length);

-   pipe = usb_sndbulkpipe (ft1000dev->dev, ft1000dev->bulk_out_endpointAddr);
+	pipe =
+	    usb_sndbulkpipe(ft1000dev->dev, ft1000dev->bulk_out_endpointAddr);

-   Status = usb_bulk_msg (ft1000dev->dev,
-                          pipe,
-                          pblk,
-                          byte_length,
-                          &cnt,
-                          10);
-   DEBUG("write_blk_fifo Status = 0x%8x Bytes Transfer = %d Data =
0x%x\n", Status, cnt, *pblk);
+	Status = usb_bulk_msg(ft1000dev->dev,
+			      pipe, pblk, byte_length, &cnt, 10);
+	DEBUG("write_blk_fifo Status = 0x%8x Bytes Transfer = %d Data = 0x%x\n",
+	      Status, cnt, *pblk);

-   kfree(pblk);
+	kfree(pblk);
 #else
-    usb_init_urb(ft1000dev->tx_urb);
-    memcpy (ft1000dev->tx_buf, *pUcFile, byte_length);
-    usb_fill_bulk_urb(ft1000dev->tx_urb,
-                      ft1000dev->dev,
-                      usb_sndbulkpipe(ft1000dev->dev,
ft1000dev->bulk_out_endpointAddr),
-                      ft1000dev->tx_buf,
-                      byte_length,
-                      usb_dnld_complete,
-                      (void*)ft1000dev);
-
-    usb_submit_urb(ft1000dev->tx_urb, GFP_ATOMIC);
+	usb_init_urb(ft1000dev->tx_urb);
+	memcpy(ft1000dev->tx_buf, *pUcFile, byte_length);
+	usb_fill_bulk_urb(ft1000dev->tx_urb,
+			  ft1000dev->dev,
+			  usb_sndbulkpipe(ft1000dev->dev,
+					  ft1000dev->bulk_out_endpointAddr),
+			  ft1000dev->tx_buf, byte_length, usb_dnld_complete,
+			  (void *)ft1000dev);
+
+	usb_submit_urb(ft1000dev->tx_urb, GFP_ATOMIC);
 #endif

-   *pUsFile = *pUsFile + (word_length << 1);
-   *pUcFile = *pUcFile + (word_length << 2);
+	*pUsFile = *pUsFile + (word_length << 1);
+	*pUcFile = *pUcFile + (word_length << 2);

-   return Status;
+	return Status;
 }

 //---------------------------------------------------------------------------
@@ -929,469 +977,558 @@ ULONG write_blk_fifo (struct ft1000_device
*ft1000dev, USHORT **pUsFile, UCHAR *
 //  Returns:    status                  - return code
 //---------------------------------------------------------------------------

-u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
ULONG  FileLength)
+u16 scram_dnldr(struct ft1000_device * ft1000dev, void *pFileStart,
+		ULONG FileLength)
 {
-   u16                     Status = STATUS_SUCCESS;
-   UINT                    uiState;
-   USHORT                  handshake;
-   PPSEUDO_HDR             pHdr;
-   USHORT                  usHdrLength;
-   //PPROV_RECORD            pProvRecord;
-   PDSP_FILE_HDR           pFileHdr;
-   long                    word_length;
-   USHORT                  request;
-   USHORT                  temp;
-   USHORT                  tempword;
-
-   PDSP_FILE_HDR_5         pFileHdr5;
-   PDSP_IMAGE_INFO_V6      pDspImageInfoV6 = NULL;
-   long                    requested_version;
-   BOOLEAN                 bGoodVersion;
-   PDRVMSG                 pMailBoxData;
-   USHORT                  *pUsData = NULL;
-   USHORT                  *pUsFile = NULL;
-   UCHAR                   *pUcFile = NULL;
-   UCHAR                   *pBootEnd = NULL, *pCodeEnd= NULL;
-   int                     imageN;
-   long                    loader_code_address, loader_code_size = 0;
-   long                    run_address = 0, run_size = 0;
-
-   ULONG                   templong;
-   ULONG                   image_chksum = 0;
-
-   USHORT                  dpram = 0;
-   PUCHAR                  pbuffer;
-   PPROV_RECORD            pprov_record;
-   FT1000_INFO *pft1000info = netdev_priv(ft1000dev->net);
-
-   DEBUG("Entered   scram_dnldr...\n");
-
-   pft1000info->fcodeldr = 0;
-   pft1000info->usbboot = 0;
-   pft1000info->dspalive = 0xffff;
-
-
-   //
-   // Get version id of file, at first 4 bytes of file, for newer files.
-   //
-
-   uiState = STATE_START_DWNLD;
-
-   pFileHdr = (PDSP_FILE_HDR)pFileStart;
-   pFileHdr5 = (PDSP_FILE_HDR_5)pFileStart;
-
-   ft1000_write_register (ft1000dev, 0x800, FT1000_REG_MAG_WATERMARK);
-
-      pUsFile = (USHORT *)(pFileStart + pFileHdr5->loader_offset);
-      pUcFile = (UCHAR *)(pFileStart + pFileHdr5->loader_offset);
-
-      pBootEnd = (UCHAR *)(pFileStart + pFileHdr5->loader_code_end);
-
-      loader_code_address = pFileHdr5->loader_code_address;
-      loader_code_size = pFileHdr5->loader_code_size;
-      bGoodVersion = FALSE;
-
-   while ((Status == STATUS_SUCCESS) && (uiState != STATE_DONE_FILE))
-   {
-      switch (uiState)
-      {
-      case  STATE_START_DWNLD:
-         DEBUG("FT1000:STATE_START_DWNLD\n");
-         if (pft1000info->usbboot)
-             handshake = get_handshake_usb(ft1000dev, HANDSHAKE_DSP_BL_READY);
-         else
-             handshake = get_handshake(ft1000dev, HANDSHAKE_DSP_BL_READY);
-
-         if (handshake == HANDSHAKE_DSP_BL_READY)
-         {
-            DEBUG("scram_dnldr: handshake is HANDSHAKE_DSP_BL_READY,
call put_handshake(HANDSHAKE_DRIVER_READY)\n");
-            put_handshake(ft1000dev, HANDSHAKE_DRIVER_READY);
-         }
-         else
-         {
-            DEBUG("FT1000:download:Download error: Handshake failed\n");
-            Status = STATUS_FAILURE;
-         }
-
-         uiState = STATE_BOOT_DWNLD;
-
-         break;
-
-      case STATE_BOOT_DWNLD:
-         DEBUG("FT1000:STATE_BOOT_DWNLD\n");
-         pft1000info->bootmode = 1;
-         handshake = get_handshake(ft1000dev, HANDSHAKE_REQUEST);
-         if (handshake == HANDSHAKE_REQUEST)
-         {
-            /*
-             * Get type associated with the request.
-             */
-            request = get_request_type(ft1000dev);
-            switch (request)
-            {
-            case  REQUEST_RUN_ADDRESS:
-               DEBUG("FT1000:REQUEST_RUN_ADDRESS\n");
-               put_request_value(ft1000dev, loader_code_address);
-               break;
-            case  REQUEST_CODE_LENGTH:
-               DEBUG("FT1000:REQUEST_CODE_LENGTH\n");
-               put_request_value(ft1000dev, loader_code_size);
-               break;
-            case  REQUEST_DONE_BL:
-               DEBUG("FT1000:REQUEST_DONE_BL\n");
-               /* Reposition ptrs to beginning of code section */
-               pUsFile = (USHORT *)(pBootEnd);
-               pUcFile = (UCHAR *)(pBootEnd);
-               //DEBUG("FT1000:download:pUsFile = 0x%8x\n", (int)pUsFile);
-               //DEBUG("FT1000:download:pUcFile = 0x%8x\n", (int)pUcFile);
-               uiState = STATE_CODE_DWNLD;
-               pft1000info->fcodeldr = 1;
-               break;
-            case  REQUEST_CODE_SEGMENT:
-               //DEBUG("FT1000:REQUEST_CODE_SEGMENT\n");
-               word_length = get_request_value(ft1000dev);
-               //DEBUG("FT1000:word_length = 0x%x\n", (int)word_length);
-               //NdisMSleep (100);
-               if (word_length > MAX_LENGTH)
-               {
-                  DEBUG("FT1000:download:Download error: Max length
exceeded\n");
-                  Status = STATUS_FAILURE;
-                  break;
-               }
-               if ( (word_length*2 + pUcFile) > pBootEnd)
-               {
-                  /*
-                   * Error, beyond boot code range.
-                   */
-                  DEBUG("FT1000:download:Download error: Requested
len=%d exceeds BOOT code boundry.\n",
-                                                            (int)word_length);
-                  Status = STATUS_FAILURE;
-                  break;
-               }
-               /*
-                * Position ASIC DPRAM auto-increment pointer.
-                */
-				    dpram = (USHORT)DWNLD_MAG1_PS_HDR_LOC;
+	u16 Status = STATUS_SUCCESS;
+	UINT uiState;
+	USHORT handshake;
+	PPSEUDO_HDR pHdr;
+	USHORT usHdrLength;
+	//PPROV_RECORD            pProvRecord;
+	PDSP_FILE_HDR pFileHdr;
+	long word_length;
+	USHORT request;
+	USHORT temp;
+	USHORT tempword;
+
+	PDSP_FILE_HDR_5 pFileHdr5;
+	PDSP_IMAGE_INFO_V6 pDspImageInfoV6 = NULL;
+	long requested_version;
+	BOOLEAN bGoodVersion;
+	PDRVMSG pMailBoxData;
+	USHORT *pUsData = NULL;
+	USHORT *pUsFile = NULL;
+	UCHAR *pUcFile = NULL;
+	UCHAR *pBootEnd = NULL, *pCodeEnd = NULL;
+	int imageN;
+	long loader_code_address, loader_code_size = 0;
+	long run_address = 0, run_size = 0;
+
+	ULONG templong;
+	ULONG image_chksum = 0;
+
+	USHORT dpram = 0;
+	PUCHAR pbuffer;
+	PPROV_RECORD pprov_record;
+	FT1000_INFO *pft1000info = netdev_priv(ft1000dev->net);
+
+	DEBUG("Entered   scram_dnldr...\n");
+
+	pft1000info->fcodeldr = 0;
+	pft1000info->usbboot = 0;
+	pft1000info->dspalive = 0xffff;
+
+	//
+	// Get version id of file, at first 4 bytes of file, for newer files.
+	//
+
+	uiState = STATE_START_DWNLD;
+
+	pFileHdr = (PDSP_FILE_HDR) pFileStart;
+	pFileHdr5 = (PDSP_FILE_HDR_5) pFileStart;
+
+	ft1000_write_register(ft1000dev, 0x800, FT1000_REG_MAG_WATERMARK);
+
+	pUsFile = (USHORT *) (pFileStart + pFileHdr5->loader_offset);
+	pUcFile = (UCHAR *) (pFileStart + pFileHdr5->loader_offset);
+
+	pBootEnd = (UCHAR *) (pFileStart + pFileHdr5->loader_code_end);
+
+	loader_code_address = pFileHdr5->loader_code_address;
+	loader_code_size = pFileHdr5->loader_code_size;
+	bGoodVersion = FALSE;
+
+	while ((Status == STATUS_SUCCESS) && (uiState != STATE_DONE_FILE)) {
+		switch (uiState) {
+		case STATE_START_DWNLD:
+			DEBUG("FT1000:STATE_START_DWNLD\n");
+			if (pft1000info->usbboot)
+				handshake =
+				    get_handshake_usb(ft1000dev,
+						      HANDSHAKE_DSP_BL_READY);
+			else
+				handshake =
+				    get_handshake(ft1000dev,
+						  HANDSHAKE_DSP_BL_READY);
+
+			if (handshake == HANDSHAKE_DSP_BL_READY) {
+				DEBUG
+				    ("scram_dnldr: handshake is HANDSHAKE_DSP_BL_READY, call
put_handshake(HANDSHAKE_DRIVER_READY)\n");
+				put_handshake(ft1000dev,
+					      HANDSHAKE_DRIVER_READY);
+			} else {
+				DEBUG
+				    ("FT1000:download:Download error: Handshake failed\n");
+				Status = STATUS_FAILURE;
+			}
+
+			uiState = STATE_BOOT_DWNLD;
+
+			break;
+
+		case STATE_BOOT_DWNLD:
+			DEBUG("FT1000:STATE_BOOT_DWNLD\n");
+			pft1000info->bootmode = 1;
+			handshake = get_handshake(ft1000dev, HANDSHAKE_REQUEST);
+			if (handshake == HANDSHAKE_REQUEST) {
+				/*
+				 * Get type associated with the request.
+				 */
+				request = get_request_type(ft1000dev);
+				switch (request) {
+				case REQUEST_RUN_ADDRESS:
+					DEBUG("FT1000:REQUEST_RUN_ADDRESS\n");
+					put_request_value(ft1000dev,
+							  loader_code_address);
+					break;
+				case REQUEST_CODE_LENGTH:
+					DEBUG("FT1000:REQUEST_CODE_LENGTH\n");
+					put_request_value(ft1000dev,
+							  loader_code_size);
+					break;
+				case REQUEST_DONE_BL:
+					DEBUG("FT1000:REQUEST_DONE_BL\n");
+					/* Reposition ptrs to beginning of code section */
+					pUsFile = (USHORT *) (pBootEnd);
+					pUcFile = (UCHAR *) (pBootEnd);
+					//DEBUG("FT1000:download:pUsFile = 0x%8x\n", (int)pUsFile);
+					//DEBUG("FT1000:download:pUcFile = 0x%8x\n", (int)pUcFile);
+					uiState = STATE_CODE_DWNLD;
+					pft1000info->fcodeldr = 1;
+					break;
+				case REQUEST_CODE_SEGMENT:
+					//DEBUG("FT1000:REQUEST_CODE_SEGMENT\n");
+					word_length =
+					    get_request_value(ft1000dev);
+					//DEBUG("FT1000:word_length = 0x%x\n", (int)word_length);
+					//NdisMSleep (100);
+					if (word_length > MAX_LENGTH) {
+						DEBUG
+						    ("FT1000:download:Download error: Max length exceeded\n");
+						Status = STATUS_FAILURE;
+						break;
+					}
+					if ((word_length * 2 + pUcFile) >
+					    pBootEnd) {
+						/*
+						 * Error, beyond boot code range.
+						 */
+						DEBUG
+						    ("FT1000:download:Download error: Requested len=%d exceeds
BOOT code boundry.\n",
+						     (int)word_length);
+						Status = STATUS_FAILURE;
+						break;
+					}
+					/*
+					 * Position ASIC DPRAM auto-increment pointer.
+					 */
+					dpram = (USHORT) DWNLD_MAG1_PS_HDR_LOC;
 					if (word_length & 0x1)
 						word_length++;
 					word_length = word_length / 2;

-			Status =   write_blk(ft1000dev, &pUsFile, &pUcFile, word_length);
-			//DEBUG("write_blk returned %d\n", Status);
-               break;
-            default:
-               DEBUG("FT1000:download:Download error: Bad request
type=%d in BOOT download state.\n",request);
-               Status = STATUS_FAILURE;
-               break;
-            }
-            if (pft1000info->usbboot)
-                put_handshake_usb(ft1000dev, HANDSHAKE_RESPONSE);
-            else
-                put_handshake(ft1000dev, HANDSHAKE_RESPONSE);
-         }
-         else
-         {
-            DEBUG("FT1000:download:Download error: Handshake failed\n");
-            Status = STATUS_FAILURE;
-         }
-
-         break;
-
-      case STATE_CODE_DWNLD:
-         //DEBUG("FT1000:STATE_CODE_DWNLD\n");
-         pft1000info->bootmode = 0;
-         if (pft1000info->usbboot)
-            handshake = get_handshake_usb(ft1000dev, HANDSHAKE_REQUEST);
-         else
-            handshake = get_handshake(ft1000dev, HANDSHAKE_REQUEST);
-         if (handshake == HANDSHAKE_REQUEST)
-         {
-            /*
-             * Get type associated with the request.
-             */
-            if (pft1000info->usbboot)
-                request = get_request_type_usb(ft1000dev);
-            else
-                request = get_request_type(ft1000dev);
-            switch (request)
-            {
-            case REQUEST_FILE_CHECKSUM:
-                DEBUG("FT1000:download:image_chksum = 0x%8x\n", image_chksum);
-                put_request_value(ft1000dev, image_chksum);
-                break;
-            case  REQUEST_RUN_ADDRESS:
-               DEBUG("FT1000:download:  REQUEST_RUN_ADDRESS\n");
-               if (bGoodVersion)
-               {
-                  DEBUG("FT1000:download:run_address = 0x%8x\n",
(int)run_address);
-                  put_request_value(ft1000dev, run_address);
-               }
-               else
-               {
-                  DEBUG("FT1000:download:Download error: Got Run
address request before image offset request.\n");
-                  Status = STATUS_FAILURE;
-                  break;
-               }
-               break;
-            case  REQUEST_CODE_LENGTH:
-               DEBUG("FT1000:download:REQUEST_CODE_LENGTH\n");
-               if (bGoodVersion)
-               {
-                  DEBUG("FT1000:download:run_size = 0x%8x\n", (int)run_size);
-                  put_request_value(ft1000dev, run_size);
-               }
-               else
-               {
-                  DEBUG("FT1000:download:Download error: Got Size
request before image offset request.\n");
-                  Status = STATUS_FAILURE;
-                  break;
-               }
-               break;
-            case  REQUEST_DONE_CL:
+					Status =
+					    write_blk(ft1000dev, &pUsFile,
+						      &pUcFile, word_length);
+					//DEBUG("write_blk returned %d\n", Status);
+					break;
+				default:
+					DEBUG
+					    ("FT1000:download:Download error: Bad request type=%d in
BOOT download state.\n",
+					     request);
+					Status = STATUS_FAILURE;
+					break;
+				}
+				if (pft1000info->usbboot)
+					put_handshake_usb(ft1000dev,
+							  HANDSHAKE_RESPONSE);
+				else
+					put_handshake(ft1000dev,
+						      HANDSHAKE_RESPONSE);
+			} else {
+				DEBUG
+				    ("FT1000:download:Download error: Handshake failed\n");
+				Status = STATUS_FAILURE;
+			}
+
+			break;
+
+		case STATE_CODE_DWNLD:
+			//DEBUG("FT1000:STATE_CODE_DWNLD\n");
+			pft1000info->bootmode = 0;
+			if (pft1000info->usbboot)
+				handshake =
+				    get_handshake_usb(ft1000dev,
+						      HANDSHAKE_REQUEST);
+			else
+				handshake =
+				    get_handshake(ft1000dev, HANDSHAKE_REQUEST);
+			if (handshake == HANDSHAKE_REQUEST) {
+				/*
+				 * Get type associated with the request.
+				 */
+				if (pft1000info->usbboot)
+					request =
+					    get_request_type_usb(ft1000dev);
+				else
+					request = get_request_type(ft1000dev);
+				switch (request) {
+				case REQUEST_FILE_CHECKSUM:
+					DEBUG
+					    ("FT1000:download:image_chksum = 0x%8x\n",
+					     image_chksum);
+					put_request_value(ft1000dev,
+							  image_chksum);
+					break;
+				case REQUEST_RUN_ADDRESS:
+					DEBUG
+					    ("FT1000:download:  REQUEST_RUN_ADDRESS\n");
+					if (bGoodVersion) {
+						DEBUG
+						    ("FT1000:download:run_address = 0x%8x\n",
+						     (int)run_address);
+						put_request_value(ft1000dev,
+								  run_address);
+					} else {
+						DEBUG
+						    ("FT1000:download:Download error: Got Run address request
before image offset request.\n");
+						Status = STATUS_FAILURE;
+						break;
+					}
+					break;
+				case REQUEST_CODE_LENGTH:
+					DEBUG
+					    ("FT1000:download:REQUEST_CODE_LENGTH\n");
+					if (bGoodVersion) {
+						DEBUG
+						    ("FT1000:download:run_size = 0x%8x\n",
+						     (int)run_size);
+						put_request_value(ft1000dev,
+								  run_size);
+					} else {
+						DEBUG
+						    ("FT1000:download:Download error: Got Size request before
image offset request.\n");
+						Status = STATUS_FAILURE;
+						break;
+					}
+					break;
+				case REQUEST_DONE_CL:
 #if FIFO_DNLD
-               pft1000info->usbboot = 3;
+					pft1000info->usbboot = 3;
 #endif
-               /* Reposition ptrs to beginning of provisioning section */
-                  pUsFile = (USHORT *)(pFileStart +
pFileHdr5->commands_offset);
-                  pUcFile = (UCHAR *)(pFileStart + pFileHdr5->commands_offset);
-               uiState = STATE_DONE_DWNLD;
-               break;
-            case  REQUEST_CODE_SEGMENT:
-               //DEBUG("FT1000:download: REQUEST_CODE_SEGMENT - CODELOADER\n");
-               if (!bGoodVersion)
-               {
-                  DEBUG("FT1000:download:Download error: Got Code
Segment request before image offset request.\n");
-                  Status = STATUS_FAILURE;
-                  break;
-               }
+					/* Reposition ptrs to beginning of provisioning section */
+					pUsFile =
+					    (USHORT *) (pFileStart +
+							pFileHdr5->
+							commands_offset);
+					pUcFile =
+					    (UCHAR *) (pFileStart +
+						       pFileHdr5->
+						       commands_offset);
+					uiState = STATE_DONE_DWNLD;
+					break;
+				case REQUEST_CODE_SEGMENT:
+					//DEBUG("FT1000:download: REQUEST_CODE_SEGMENT - CODELOADER\n");
+					if (!bGoodVersion) {
+						DEBUG
+						    ("FT1000:download:Download error: Got Code Segment request
before image offset request.\n");
+						Status = STATUS_FAILURE;
+						break;
+					}
 #if 0
-               word_length = get_request_value_usb(ft1000dev);
-               //DEBUG("FT1000:download:word_length = %d\n", (int)word_length);
-               if (word_length > MAX_LENGTH/2)
+					word_length =
+					    get_request_value_usb(ft1000dev);
+					//DEBUG("FT1000:download:word_length = %d\n", (int)word_length);
+					if (word_length > MAX_LENGTH / 2)
 #else
-               word_length = get_request_value(ft1000dev);
-               //DEBUG("FT1000:download:word_length = %d\n", (int)word_length);
-               if (word_length > MAX_LENGTH)
+					word_length =
+					    get_request_value(ft1000dev);
+					//DEBUG("FT1000:download:word_length = %d\n", (int)word_length);
+					if (word_length > MAX_LENGTH)
 #endif
-               {
-                  DEBUG("FT1000:download:Download error: Max length
exceeded\n");
-                  Status = STATUS_FAILURE;
-                  break;
-               }
-               if ( (word_length*2 + pUcFile) > pCodeEnd)
-               {
-                  /*
-                   * Error, beyond boot code range.
-                   */
-                  DEBUG("FT1000:download:Download error: Requested
len=%d exceeds DSP code boundry.\n",
-                               (int)word_length);
-                  Status = STATUS_FAILURE;
-                  break;
-               }
-               /*
-                * Position ASIC DPRAM auto-increment pointer.
-                */
-		   dpram = (USHORT)DWNLD_MAG1_PS_HDR_LOC;
-		   if (word_length & 0x1)
-			word_length++;
-		   word_length = word_length / 2;
+					{
+						DEBUG
+						    ("FT1000:download:Download error: Max length exceeded\n");
+						Status = STATUS_FAILURE;
+						break;
+					}
+					if ((word_length * 2 + pUcFile) >
+					    pCodeEnd) {
+						/*
+						 * Error, beyond boot code range.
+						 */
+						DEBUG
+						    ("FT1000:download:Download error: Requested len=%d exceeds
DSP code boundry.\n",
+						     (int)word_length);
+						Status = STATUS_FAILURE;
+						break;
+					}
+					/*
+					 * Position ASIC DPRAM auto-increment pointer.
+					 */
+					dpram = (USHORT) DWNLD_MAG1_PS_HDR_LOC;
+					if (word_length & 0x1)
+						word_length++;
+					word_length = word_length / 2;

 #if FIFO_DNLD
-   	       write_blk_fifo (ft1000dev, &pUsFile, &pUcFile, word_length);
-               if (pft1000info->usbboot == 0)
-                   pft1000info->usbboot++;
-               if (pft1000info->usbboot == 1) {
-                   tempword = 0;
-                   ft1000_write_dpram16 (ft1000dev,
DWNLD_MAG1_PS_HDR_LOC, tempword, 0);
-               }
+					write_blk_fifo(ft1000dev, &pUsFile,
+						       &pUcFile, word_length);
+					if (pft1000info->usbboot == 0)
+						pft1000info->usbboot++;
+					if (pft1000info->usbboot == 1) {
+						tempword = 0;
+						ft1000_write_dpram16(ft1000dev,
+								     DWNLD_MAG1_PS_HDR_LOC,
+								     tempword,
+								     0);
+					}
 #else
-   	       write_blk (ft1000dev, &pUsFile, &pUcFile, word_length);
-   	       //ft1000_write_dpram32 (ft1000dev, dpram, (PUCHAR)pUcFile,
word_length);
+					write_blk(ft1000dev, &pUsFile, &pUcFile,
+						  word_length);
+					//ft1000_write_dpram32 (ft1000dev, dpram, (PUCHAR)pUcFile, word_length);
 #endif
-               break;
+					break;
+
+				case REQUEST_MAILBOX_DATA:
+					DEBUG
+					    ("FT1000:download: REQUEST_MAILBOX_DATA\n");
+					// Convert length from byte count to word count. Make sure we round up.
+					word_length =
+					    (long)(pft1000info->DSPInfoBlklen +
+						   1) / 2;
+					put_request_value(ft1000dev,
+							  word_length);
+					pMailBoxData =
+					    (PDRVMSG) & (pft1000info->
+							 DSPInfoBlk[0]);
+					/*
+					 * Position ASIC DPRAM auto-increment pointer.
+					 */
+
+					pUsData =
+					    (USHORT *) & pMailBoxData->data[0];
+					dpram = (USHORT) DWNLD_MAG1_PS_HDR_LOC;
+					if (word_length & 0x1)
+						word_length++;

-            case  REQUEST_MAILBOX_DATA:
-               DEBUG("FT1000:download: REQUEST_MAILBOX_DATA\n");
-               // Convert length from byte count to word count. Make
sure we round up.
-               word_length = (long)(pft1000info->DSPInfoBlklen + 1)/2;
-               put_request_value(ft1000dev, word_length);
-               pMailBoxData = (PDRVMSG)&(pft1000info->DSPInfoBlk[0]);
-               /*
-                * Position ASIC DPRAM auto-increment pointer.
-                */
-
-
-                   pUsData = (USHORT *)&pMailBoxData->data[0];
-                   dpram = (USHORT)DWNLD_MAG1_PS_HDR_LOC;
-                   if (word_length & 0x1)
-                       word_length++;
-
-                   word_length = (word_length / 2);
-
-
-               for (; word_length > 0; word_length--) /* In words */
-               {
-
-                      templong = *pUsData++;
-					  templong |= (*pUsData++ << 16);
-                      Status = fix_ft1000_write_dpram32 (ft1000dev,
dpram++, (PUCHAR)&templong);
-
-               }
-               break;
-
-            case  REQUEST_VERSION_INFO:
-               DEBUG("FT1000:download:REQUEST_VERSION_INFO\n");
-               word_length = pFileHdr5->version_data_size;
-               put_request_value(ft1000dev, word_length);
-               /*
-                * Position ASIC DPRAM auto-increment pointer.
-                */
-
-               pUsFile = (USHORT *)(pFileStart +
pFileHdr5->version_data_offset);
-
-
-                   dpram = (USHORT)DWNLD_MAG1_PS_HDR_LOC;
-                   if (word_length & 0x1)
-                       word_length++;
-
-                   word_length = (word_length / 2);
-
-
-               for (; word_length > 0; word_length--) /* In words */
-               {
-
-                      templong = ntohs(*pUsFile++);
-					  temp = ntohs(*pUsFile++);
-					  templong |= (temp << 16);
-                      Status = fix_ft1000_write_dpram32 (ft1000dev,
dpram++, (PUCHAR)&templong);
-
-               }
-               break;
-
-            case  REQUEST_CODE_BY_VERSION:
-               DEBUG("FT1000:download:REQUEST_CODE_BY_VERSION\n");
-               bGoodVersion = FALSE;
-               requested_version = get_request_value(ft1000dev);
-
-                   pDspImageInfoV6 = (PDSP_IMAGE_INFO_V6)(pFileStart
+ sizeof(DSP_FILE_HDR_5));
-
-               for (imageN = 0; imageN < pFileHdr5->nDspImages; imageN++)
-               {
-
-                       temp = (USHORT)(pDspImageInfoV6->version);
-                       templong = temp;
-                       temp = (USHORT)(pDspImageInfoV6->version >> 16);
-                       templong |= (temp << 16);
-                   if (templong == (ULONG)requested_version)
-                       {
-                           bGoodVersion = TRUE;
-                           DEBUG("FT1000:download: bGoodVersion is TRUE\n");
-                           pUsFile = (USHORT *)(pFileStart +
pDspImageInfoV6->begin_offset);
-                           pUcFile = (UCHAR *)(pFileStart +
pDspImageInfoV6->begin_offset);
-                           pCodeEnd = (UCHAR *)(pFileStart +
pDspImageInfoV6->end_offset);
-                           run_address = pDspImageInfoV6->run_address;
-                           run_size = pDspImageInfoV6->image_size;
-                           image_chksum = (ULONG)pDspImageInfoV6->checksum;
-                           break;
-                        }
-                        pDspImageInfoV6++;
-
-
-               } //end of for
-
-               if (!bGoodVersion)
-               {
-                  /*
-                   * Error, beyond boot code range.
-                   */
-                  DEBUG("FT1000:download:Download error: Bad Version
Request = 0x%x.\n",(int)requested_version);
-                  Status = STATUS_FAILURE;
-                  break;
-               }
-               break;
-
-            default:
-               DEBUG("FT1000:download:Download error: Bad request
type=%d in CODE download state.\n",request);
-               Status = STATUS_FAILURE;
-               break;
-            }
-            if (pft1000info->usbboot)
-                put_handshake_usb(ft1000dev, HANDSHAKE_RESPONSE);
-            else
-                put_handshake(ft1000dev, HANDSHAKE_RESPONSE);
-         }
-         else
-         {
-            DEBUG("FT1000:download:Download error: Handshake failed\n");
-            Status = STATUS_FAILURE;
-         }
-
-         break;
-
-      case STATE_DONE_DWNLD:
-         DEBUG("FT1000:download:Code loader is done...\n");
-         uiState = STATE_SECTION_PROV;
-         break;
-
-      case  STATE_SECTION_PROV:
-         DEBUG("FT1000:download:STATE_SECTION_PROV\n");
-         pHdr = (PPSEUDO_HDR)pUcFile;
-
-         if (pHdr->checksum == hdr_checksum(pHdr))
-         {
-            if (pHdr->portdest != 0x80 /* Dsp OAM */)
-            {
-               uiState = STATE_DONE_PROV;
-               break;
-            }
-            usHdrLength = ntohs(pHdr->length);    /* Byte length for
PROV records */
-
-            // Get buffer for provisioning data
-            pbuffer = kmalloc ( (usHdrLength + sizeof(PSEUDO_HDR) ),
GFP_ATOMIC );
-            if (pbuffer) {
-                memcpy(pbuffer, (void *)pUcFile, (UINT)(usHdrLength +
sizeof(PSEUDO_HDR)));
-                // link provisioning data
-                pprov_record = kmalloc( sizeof(PROV_RECORD), GFP_ATOMIC );
-                if (pprov_record) {
-                    pprov_record->pprov_data = pbuffer;
-                    list_add_tail (&pprov_record->list,
&pft1000info->prov_list);
-                    // Move to next entry if available
-                    pUcFile = (UCHAR *)((UINT)pUcFile +
(UINT)((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR));
-                    if ( (UINT)(pUcFile) - (UINT)(pFileStart) >=
(UINT)FileLength) {
-                       uiState = STATE_DONE_FILE;
-                    }
-                }
-                else {
-                    kfree(pbuffer);
-                    Status = STATUS_FAILURE;
-                }
-            }
-            else {
-                Status = STATUS_FAILURE;
-            }
-         }
-         else
-         {
-            /* Checksum did not compute */
-            Status = STATUS_FAILURE;
-         }
-         DEBUG("ft1000:download: after STATE_SECTION_PROV, uiState =
%d, Status= %d\n", uiState, Status);
-         break;
-
-      case  STATE_DONE_PROV:
-         DEBUG("FT1000:download:STATE_DONE_PROV\n");
-         uiState = STATE_DONE_FILE;
-         break;
-
-
-      default:
-         Status = STATUS_FAILURE;
-         break;
-      } /* End Switch */
-
-      if (Status != STATUS_SUCCESS) {
-          break;
-      }
+					word_length = (word_length / 2);
+
+					for (; word_length > 0; word_length--) {	/* In words */
+
+						templong = *pUsData++;
+						templong |= (*pUsData++ << 16);
+						Status =
+						    fix_ft1000_write_dpram32
+						    (ft1000dev, dpram++,
+						     (PUCHAR) & templong);
+
+					}
+					break;
+
+				case REQUEST_VERSION_INFO:
+					DEBUG
+					    ("FT1000:download:REQUEST_VERSION_INFO\n");
+					word_length =
+					    pFileHdr5->version_data_size;
+					put_request_value(ft1000dev,
+							  word_length);
+					/*
+					 * Position ASIC DPRAM auto-increment pointer.
+					 */
+
+					pUsFile =
+					    (USHORT *) (pFileStart +
+							pFileHdr5->
+							version_data_offset);
+
+					dpram = (USHORT) DWNLD_MAG1_PS_HDR_LOC;
+					if (word_length & 0x1)
+						word_length++;
+
+					word_length = (word_length / 2);
+
+					for (; word_length > 0; word_length--) {	/* In words */
+
+						templong = ntohs(*pUsFile++);
+						temp = ntohs(*pUsFile++);
+						templong |= (temp << 16);
+						Status =
+						    fix_ft1000_write_dpram32
+						    (ft1000dev, dpram++,
+						     (PUCHAR) & templong);
+
+					}
+					break;
+
+				case REQUEST_CODE_BY_VERSION:
+					DEBUG
+					    ("FT1000:download:REQUEST_CODE_BY_VERSION\n");
+					bGoodVersion = FALSE;
+					requested_version =
+					    get_request_value(ft1000dev);
+
+					pDspImageInfoV6 =
+					    (PDSP_IMAGE_INFO_V6) (pFileStart +
+								  sizeof
+								  (DSP_FILE_HDR_5));
+
+					for (imageN = 0;
+					     imageN < pFileHdr5->nDspImages;
+					     imageN++) {
+
+						temp =
+						    (USHORT) (pDspImageInfoV6->
+							      version);
+						templong = temp;
+						temp =
+						    (USHORT) (pDspImageInfoV6->
+							      version >> 16);
+						templong |= (temp << 16);
+						if (templong ==
+						    (ULONG) requested_version) {
+							bGoodVersion = TRUE;
+							DEBUG
+							    ("FT1000:download: bGoodVersion is TRUE\n");
+							pUsFile =
+							    (USHORT
+							     *) (pFileStart +
+								 pDspImageInfoV6->
+								 begin_offset);
+							pUcFile =
+							    (UCHAR
+							     *) (pFileStart +
+								 pDspImageInfoV6->
+								 begin_offset);
+							pCodeEnd =
+							    (UCHAR
+							     *) (pFileStart +
+								 pDspImageInfoV6->
+								 end_offset);
+							run_address =
+							    pDspImageInfoV6->
+							    run_address;
+							run_size =
+							    pDspImageInfoV6->
+							    image_size;
+							image_chksum =
+							    (ULONG)
+							    pDspImageInfoV6->
+							    checksum;
+							break;
+						}
+						pDspImageInfoV6++;
+
+					}	//end of for
+
+					if (!bGoodVersion) {
+						/*
+						 * Error, beyond boot code range.
+						 */
+						DEBUG
+						    ("FT1000:download:Download error: Bad Version Request = 0x%x.\n",
+						     (int)requested_version);
+						Status = STATUS_FAILURE;
+						break;
+					}
+					break;
+
+				default:
+					DEBUG
+					    ("FT1000:download:Download error: Bad request type=%d in
CODE download state.\n",
+					     request);
+					Status = STATUS_FAILURE;
+					break;
+				}
+				if (pft1000info->usbboot)
+					put_handshake_usb(ft1000dev,
+							  HANDSHAKE_RESPONSE);
+				else
+					put_handshake(ft1000dev,
+						      HANDSHAKE_RESPONSE);
+			} else {
+				DEBUG
+				    ("FT1000:download:Download error: Handshake failed\n");
+				Status = STATUS_FAILURE;
+			}
+
+			break;
+
+		case STATE_DONE_DWNLD:
+			DEBUG("FT1000:download:Code loader is done...\n");
+			uiState = STATE_SECTION_PROV;
+			break;
+
+		case STATE_SECTION_PROV:
+			DEBUG("FT1000:download:STATE_SECTION_PROV\n");
+			pHdr = (PPSEUDO_HDR) pUcFile;
+
+			if (pHdr->checksum == hdr_checksum(pHdr)) {
+				if (pHdr->portdest != 0x80 /* Dsp OAM */ ) {
+					uiState = STATE_DONE_PROV;
+					break;
+				}
+				usHdrLength = ntohs(pHdr->length);	/* Byte length for PROV records */
+
+				// Get buffer for provisioning data
+				pbuffer =
+				    kmalloc((usHdrLength + sizeof(PSEUDO_HDR)),
+					    GFP_ATOMIC);
+				if (pbuffer) {
+					memcpy(pbuffer, (void *)pUcFile,
+					       (UINT) (usHdrLength +
+						       sizeof(PSEUDO_HDR)));
+					// link provisioning data
+					pprov_record =
+					    kmalloc(sizeof(PROV_RECORD),
+						    GFP_ATOMIC);
+					if (pprov_record) {
+						pprov_record->pprov_data =
+						    pbuffer;
+						list_add_tail(&pprov_record->
+							      list,
+							      &pft1000info->
+							      prov_list);
+						// Move to next entry if available
+						pUcFile =
+						    (UCHAR *) ((UINT) pUcFile +
+							       (UINT) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR));
+						if ((UINT) (pUcFile) -
+						    (UINT) (pFileStart) >=
+						    (UINT) FileLength) {
+							uiState =
+							    STATE_DONE_FILE;
+						}
+					} else {
+						kfree(pbuffer);
+						Status = STATUS_FAILURE;
+					}
+				} else {
+					Status = STATUS_FAILURE;
+				}
+			} else {
+				/* Checksum did not compute */
+				Status = STATUS_FAILURE;
+			}
+			DEBUG
+			    ("ft1000:download: after STATE_SECTION_PROV, uiState = %d,
Status= %d\n",
+			     uiState, Status);
+			break;
+
+		case STATE_DONE_PROV:
+			DEBUG("FT1000:download:STATE_DONE_PROV\n");
+			uiState = STATE_DONE_FILE;
+			break;
+
+		default:
+			Status = STATUS_FAILURE;
+			break;
+		}		/* End Switch */
+
+		if (Status != STATUS_SUCCESS) {
+			break;
+		}

 /****
       // Check if Card is present
@@ -1406,11 +1543,11 @@ u16 scram_dnldr(struct ft1000_device
*ft1000dev, void *pFileStart, ULONG  FileLe
       }
 ****/

-   } /* End while */
+	}			/* End while */

-   DEBUG("Download exiting with status = 0x%8x\n", Status);
-   ft1000_write_register(ft1000dev, FT1000_DB_DNLD_TX, FT1000_REG_DOORBELL);
+	DEBUG("Download exiting with status = 0x%8x\n", Status);
+	ft1000_write_register(ft1000dev, FT1000_DB_DNLD_TX,
+			      FT1000_REG_DOORBELL);

-   return Status;
+	return Status;
 }
-
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 51ed0dd..1d9a799 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -16,8 +16,8 @@
 #include <linux/usb.h>
 #include "ft1000_usb.h"
 #include <linux/types.h>
-//#include <asm/semaphore.h>		//aelias [-] reason : file moved
-//#include <linux/semaphore.h>		//aelias [+] reason : file moved
+//#include <asm/semaphore.h>            //aelias [-] reason : file moved
+//#include <linux/semaphore.h>          //aelias [+] reason : file moved
 //#include <asm/io.h>
 //#include <linux/kthread.h>

@@ -35,26 +35,24 @@

 //#define JDEBUG

-
 extern void *pFileStart;
 extern ULONG FileLength;

-
 extern int numofmsgbuf;

-
 int ft1000_poll_thread(void *arg);

 static void ft1000_hbchk(u_long data);
 int ft1000_reset(struct net_device *ft1000dev);
 static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev);
-static int ft1000_open (struct net_device *dev);
-int ft1000_close (struct net_device *dev);
+static int ft1000_open(struct net_device *dev);
+int ft1000_close(struct net_device *dev);
 static struct net_device_stats *ft1000_netdev_stats(struct net_device *dev);
-u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
ULONG  FileLength);
+u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
+		ULONG FileLength);
 int ft1000_submit_rx_urb(PFT1000_INFO info);
 static struct timer_list poll_timer[MAX_NUM_CARDS];
-static int ft1000_chkcard (struct ft1000_device *dev);
+static int ft1000_chkcard(struct ft1000_device *dev);
 /*
 static const struct net_device_ops ft1000net_ops = {
     .ndo_start_xmit = ft1000_start_xmit,
@@ -71,61 +69,55 @@ int gCardIndex;

 #define MAX_RCV_LOOP   100

-
 extern struct list_head freercvpool;
-extern spinlock_t free_buff_lock;   // lock to arbitrate free buffer
list for receive command data
+extern spinlock_t free_buff_lock;	// lock to arbitrate free buffer
list for receive command data

 //end of Jim

 extern int ft1000_CreateDevice(struct ft1000_device *dev);
-extern PDPRAM_BLK ft1000_get_buffer (struct list_head *bufflist);
-extern void ft1000_free_buffer (PDPRAM_BLK pdpram_blk, struct
list_head *plist);
-
+extern PDPRAM_BLK ft1000_get_buffer(struct list_head *bufflist);
+extern void ft1000_free_buffer(PDPRAM_BLK pdpram_blk, struct list_head *plist);

 static int atoi(const char *s)
 {
-        int k = 0;
-    int cnt;
-
-        k = 0;
-    cnt = 0;
-        while (*s != '\0' && *s >= '0' && *s <= '9') {
-                k = 10 * k + (*s - '0');
-                s++;
-        // Let's put a limit on this while loop to avoid deadlock scenario
-        if (cnt > 100)
-           break;
-        cnt++;
-        }
-        return k;
+	int k = 0;
+	int cnt;
+
+	k = 0;
+	cnt = 0;
+	while (*s != '\0' && *s >= '0' && *s <= '9') {
+		k = 10 * k + (*s - '0');
+		s++;
+		// Let's put a limit on this while loop to avoid deadlock scenario
+		if (cnt > 100)
+			break;
+		cnt++;
+	}
+	return k;
 }
+
 /****************************************************************
  *     ft1000_control_complete
  ****************************************************************/
 static void ft1000_control_complete(struct urb *urb)
 {
-    struct ft1000_device *ft1000dev = (struct ft1000_device *)urb->context;
-
-    //DEBUG("FT1000_CONTROL_COMPLETE ENTERED\n");
-    if (ft1000dev == NULL )
-    {
-        DEBUG("NULL ft1000dev, failure\n");
-        return ;
-    }
-    else if ( ft1000dev->dev == NULL )
-    {
-        DEBUG("NULL ft1000dev->dev, failure\n");
-        return ;
-    }
-    //spin_lock(&ft1000dev->device_lock);
-
-    if(waitqueue_active(&ft1000dev->control_wait))
-    {
-        wake_up(&ft1000dev->control_wait);
-    }
+	struct ft1000_device *ft1000dev = (struct ft1000_device *)urb->context;
+
+	//DEBUG("FT1000_CONTROL_COMPLETE ENTERED\n");
+	if (ft1000dev == NULL) {
+		DEBUG("NULL ft1000dev, failure\n");
+		return;
+	} else if (ft1000dev->dev == NULL) {
+		DEBUG("NULL ft1000dev->dev, failure\n");
+		return;
+	}
+	//spin_lock(&ft1000dev->device_lock);

-    //DEBUG("FT1000_CONTROL_COMPLETE RETURNED\n");
-    //spin_unlock(&ft1000dev->device_lock);
+	if (waitqueue_active(&ft1000dev->control_wait)) {
+		wake_up(&ft1000dev->control_wait);
+	}
+	//DEBUG("FT1000_CONTROL_COMPLETE RETURNED\n");
+	//spin_unlock(&ft1000dev->device_lock);
 }

 //---------------------------------------------------------------------------
@@ -149,48 +141,37 @@ static void ft1000_control_complete(struct urb *urb)
 // Notes:
 //
 //---------------------------------------------------------------------------
-static int ft1000_control(struct ft1000_device *ft1000dev,unsigned int pipe,
-                          u8 request,
-                          u8 requesttype,
-                          u16 value,
-                          u16 index,
-                          void *data,
-                          u16 size,
-                          int timeout)
+static int ft1000_control(struct ft1000_device *ft1000dev, unsigned int pipe,
+			  u8 request,
+			  u8 requesttype,
+			  u16 value,
+			  u16 index, void *data, u16 size, int timeout)
 {
 	u16 ret;

-    if (ft1000dev == NULL )
-    {
-        DEBUG("NULL ft1000dev, failure\n");
-        return STATUS_FAILURE;
-    }
-    else if ( ft1000dev->dev == NULL )
-    {
-        DEBUG("NULL ft1000dev->dev, failure\n");
-        return STATUS_FAILURE;
-    }
-
-    ret = usb_control_msg(ft1000dev->dev,
-                          pipe,
-                          request,
-                          requesttype,
-                          value,
-                          index,
-                          data,
-                          size,
-                          LARGE_TIMEOUT);
-
-    if (ret>0)
-        ret = STATUS_SUCCESS;
-    else
-        ret = STATUS_FAILURE;
+	if (ft1000dev == NULL) {
+		DEBUG("NULL ft1000dev, failure\n");
+		return STATUS_FAILURE;
+	} else if (ft1000dev->dev == NULL) {
+		DEBUG("NULL ft1000dev->dev, failure\n");
+		return STATUS_FAILURE;
+	}

+	ret = usb_control_msg(ft1000dev->dev,
+			      pipe,
+			      request,
+			      requesttype,
+			      value, index, data, size, LARGE_TIMEOUT);

-    return ret;
+	if (ret > 0)
+		ret = STATUS_SUCCESS;
+	else
+		ret = STATUS_FAILURE;

+	return ret;

 }
+
 //---------------------------------------------------------------------------
 // Function:    ft1000_read_register
 //
@@ -207,29 +188,28 @@ static int ft1000_control(struct ft1000_device
*ft1000dev,unsigned int pipe,
 //
 //---------------------------------------------------------------------------

-u16 ft1000_read_register(struct ft1000_device *ft1000dev, short*
Data, u16 nRegIndx)
+u16 ft1000_read_register(struct ft1000_device * ft1000dev, short *Data,
+			 u16 nRegIndx)
 {
-    u16 ret = STATUS_SUCCESS;
-
-    //DEBUG("ft1000_read_register: reg index is %d\n", nRegIndx);
-    //DEBUG("ft1000_read_register: spin_lock locked\n");
-    ret = ft1000_control(ft1000dev,
-                         usb_rcvctrlpipe(ft1000dev->dev,0),
-                         HARLEY_READ_REGISTER,   //request --READ_REGISTER
-                         HARLEY_READ_OPERATION,  //requestType
-                         0,                      //value
-                         nRegIndx,               //index
-                         Data,                   //data
-                         2,                      //data size
-                         LARGE_TIMEOUT );        //timeout
-
-   //DEBUG("ft1000_read_register: ret is  %d \n", ret);
-
-   //DEBUG("ft1000_read_register: data is  %x \n", *Data);
-   if ( ret != STATUS_SUCCESS )
-       return STATUS_FAILURE;
+	u16 ret = STATUS_SUCCESS;
+
+	//DEBUG("ft1000_read_register: reg index is %d\n", nRegIndx);
+	//DEBUG("ft1000_read_register: spin_lock locked\n");
+	ret = ft1000_control(ft1000dev, usb_rcvctrlpipe(ft1000dev->dev, 0),
HARLEY_READ_REGISTER,	//request --READ_REGISTER
+			     HARLEY_READ_OPERATION,	//requestType
+			     0,	//value
+			     nRegIndx,	//index
+			     Data,	//data
+			     2,	//data size
+			     LARGE_TIMEOUT);	//timeout
+
+	//DEBUG("ft1000_read_register: ret is  %d \n", ret);
+
+	//DEBUG("ft1000_read_register: data is  %x \n", *Data);
+	if (ret != STATUS_SUCCESS)
+		return STATUS_FAILURE;

-   return ret;
+	return ret;

 }

@@ -248,26 +228,21 @@ u16 ft1000_read_register(struct ft1000_device
*ft1000dev, short* Data, u16 nRegI
 // Notes:
 //
 //---------------------------------------------------------------------------
-u16 ft1000_write_register(struct ft1000_device *ft1000dev, USHORT
value, u16 nRegIndx)
+u16 ft1000_write_register(struct ft1000_device * ft1000dev, USHORT value,
+			  u16 nRegIndx)
 {
-     u16 ret = STATUS_SUCCESS;
+	u16 ret = STATUS_SUCCESS;

-     //DEBUG("ft1000_write_register: value is: %d, reg index is:
%d\n", value, nRegIndx);
+	//DEBUG("ft1000_write_register: value is: %d, reg index is: %d\n",
value, nRegIndx);

-     ret = ft1000_control(ft1000dev,
-                           usb_sndctrlpipe(ft1000dev->dev, 0),
-                           HARLEY_WRITE_REGISTER,       //request --
WRITE_REGISTER
-                           HARLEY_WRITE_OPERATION,      //requestType
-                           value,
-                           nRegIndx,
-                           NULL,
-                           0,
-                           LARGE_TIMEOUT );
+	ret = ft1000_control(ft1000dev, usb_sndctrlpipe(ft1000dev->dev, 0),
HARLEY_WRITE_REGISTER,	//request -- WRITE_REGISTER
+			     HARLEY_WRITE_OPERATION,	//requestType
+			     value, nRegIndx, NULL, 0, LARGE_TIMEOUT);

-   if ( ret != STATUS_SUCCESS )
-       return STATUS_FAILURE;
+	if (ret != STATUS_SUCCESS)
+		return STATUS_FAILURE;

-    return ret;
+	return ret;
 }

 //---------------------------------------------------------------------------
@@ -287,28 +262,27 @@ u16 ft1000_write_register(struct ft1000_device
*ft1000dev, USHORT value, u16 nRe
 //
 //---------------------------------------------------------------------------

-u16 ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx,
PUCHAR buffer, USHORT cnt)
+u16 ft1000_read_dpram32(struct ft1000_device * ft1000dev, USHORT indx,
+			PUCHAR buffer, USHORT cnt)
 {
-    u16 ret = STATUS_SUCCESS;
+	u16 ret = STATUS_SUCCESS;

-    //DEBUG("ft1000_read_dpram32: indx: %d  cnt: %d\n", indx, cnt);
-    ret =ft1000_control(ft1000dev,
-                         usb_rcvctrlpipe(ft1000dev->dev,0),
-                         HARLEY_READ_DPRAM_32,
//request --READ_DPRAM_32
-                         HARLEY_READ_OPERATION,               //requestType
-                         0,                                   //value
-                         indx,                                //index
-                         buffer,                              //data
-                         cnt,                                 //data size
-                         LARGE_TIMEOUT );                     //timeout
+	//DEBUG("ft1000_read_dpram32: indx: %d  cnt: %d\n", indx, cnt);
+	ret = ft1000_control(ft1000dev, usb_rcvctrlpipe(ft1000dev->dev, 0),
HARLEY_READ_DPRAM_32,	//request --READ_DPRAM_32
+			     HARLEY_READ_OPERATION,	//requestType
+			     0,	//value
+			     indx,	//index
+			     buffer,	//data
+			     cnt,	//data size
+			     LARGE_TIMEOUT);	//timeout

-   //DEBUG("ft1000_read_dpram32: ret is  %d \n", ret);
+	//DEBUG("ft1000_read_dpram32: ret is  %d \n", ret);

-   //DEBUG("ft1000_read_dpram32: ret=%d \n", ret);
-   if ( ret != STATUS_SUCCESS )
-       return STATUS_FAILURE;
+	//DEBUG("ft1000_read_dpram32: ret=%d \n", ret);
+	if (ret != STATUS_SUCCESS)
+		return STATUS_FAILURE;

-   return ret;
+	return ret;

 }

@@ -328,30 +302,27 @@ u16 ft1000_read_dpram32(struct ft1000_device
*ft1000dev, USHORT indx, PUCHAR buf
 // Notes:
 //
 //---------------------------------------------------------------------------
-u16 ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT
indx, PUCHAR buffer, USHORT cnt)
+u16 ft1000_write_dpram32(struct ft1000_device * ft1000dev, USHORT indx,
+			 PUCHAR buffer, USHORT cnt)
 {
-     u16 ret = STATUS_SUCCESS;
-
-     //DEBUG("ft1000_write_dpram32: indx: %d   buffer: %x cnt: %d\n",
indx, buffer, cnt);
-     if ( cnt % 4)
-         cnt += cnt - (cnt % 4);
+	u16 ret = STATUS_SUCCESS;

-     ret = ft1000_control(ft1000dev,
-                           usb_sndctrlpipe(ft1000dev->dev, 0),
-                           HARLEY_WRITE_DPRAM_32,
//request -- WRITE_DPRAM_32
-                           HARLEY_WRITE_OPERATION,             //requestType
-                           0,                                  //value
-                           indx,                               //index
-                           buffer,                             //buffer
-                           cnt,                                //buffer size
-                           LARGE_TIMEOUT );
+	//DEBUG("ft1000_write_dpram32: indx: %d   buffer: %x cnt: %d\n",
indx, buffer, cnt);
+	if (cnt % 4)
+		cnt += cnt - (cnt % 4);

+	ret = ft1000_control(ft1000dev, usb_sndctrlpipe(ft1000dev->dev, 0),
HARLEY_WRITE_DPRAM_32,	//request -- WRITE_DPRAM_32
+			     HARLEY_WRITE_OPERATION,	//requestType
+			     0,	//value
+			     indx,	//index
+			     buffer,	//buffer
+			     cnt,	//buffer size
+			     LARGE_TIMEOUT);

-   if ( ret != STATUS_SUCCESS )
-       return STATUS_FAILURE;
-
+	if (ret != STATUS_SUCCESS)
+		return STATUS_FAILURE;

-    return ret;
+	return ret;
 }

 //---------------------------------------------------------------------------
@@ -370,37 +341,35 @@ u16 ft1000_write_dpram32(struct ft1000_device
*ft1000dev, USHORT indx, PUCHAR bu
 // Notes:
 //
 //---------------------------------------------------------------------------
-u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx,
PUCHAR buffer, u8 highlow)
+u16 ft1000_read_dpram16(struct ft1000_device * ft1000dev, USHORT indx,
+			PUCHAR buffer, u8 highlow)
 {
-    u16 ret = STATUS_SUCCESS;
-
-    //DEBUG("ft1000_read_dpram16: indx: %d  hightlow: %d\n", indx, highlow);
+	u16 ret = STATUS_SUCCESS;

-    u8 request;
+	//DEBUG("ft1000_read_dpram16: indx: %d  hightlow: %d\n", indx, highlow);

-    if (highlow == 0 )
-        request = HARLEY_READ_DPRAM_LOW;
-    else
-        request = HARLEY_READ_DPRAM_HIGH;
+	u8 request;

-    ret = ft1000_control(ft1000dev,
-                         usb_rcvctrlpipe(ft1000dev->dev,0),
-                         request,                     //request
--READ_DPRAM_H/L
-                         HARLEY_READ_OPERATION,       //requestType
-                         0,                           //value
-                         indx,                        //index
-                         buffer,                      //data
-                         2,                           //data size
-                         LARGE_TIMEOUT );             //timeout
+	if (highlow == 0)
+		request = HARLEY_READ_DPRAM_LOW;
+	else
+		request = HARLEY_READ_DPRAM_HIGH;

-   //DEBUG("ft1000_read_dpram16: ret is  %d \n", ret);
+	ret = ft1000_control(ft1000dev, usb_rcvctrlpipe(ft1000dev->dev, 0),
request,	//request --READ_DPRAM_H/L
+			     HARLEY_READ_OPERATION,	//requestType
+			     0,	//value
+			     indx,	//index
+			     buffer,	//data
+			     2,	//data size
+			     LARGE_TIMEOUT);	//timeout

+	//DEBUG("ft1000_read_dpram16: ret is  %d \n", ret);

-   //DEBUG("ft1000_read_dpram16: data is  %x \n", *buffer);
-   if ( ret != STATUS_SUCCESS )
-       return STATUS_FAILURE;
+	//DEBUG("ft1000_read_dpram16: data is  %x \n", *buffer);
+	if (ret != STATUS_SUCCESS)
+		return STATUS_FAILURE;

-   return ret;
+	return ret;

 }

@@ -420,38 +389,32 @@ u16 ft1000_read_dpram16(struct ft1000_device
*ft1000dev, USHORT indx, PUCHAR buf
 // Notes:
 //
 //---------------------------------------------------------------------------
-u16 ft1000_write_dpram16(struct ft1000_device *ft1000dev, USHORT
indx, USHORT value, u8 highlow)
+u16 ft1000_write_dpram16(struct ft1000_device * ft1000dev, USHORT indx,
+			 USHORT value, u8 highlow)
 {
-     u16 ret = STATUS_SUCCESS;
-
-
+	u16 ret = STATUS_SUCCESS;

-     //DEBUG("ft1000_write_dpram16: indx: %d  value: %d  highlow:
%d\n", indx, value, highlow);
+	//DEBUG("ft1000_write_dpram16: indx: %d  value: %d  highlow: %d\n",
indx, value, highlow);

-     u8 request;
+	u8 request;

+	if (highlow == 0)
+		request = HARLEY_WRITE_DPRAM_LOW;
+	else
+		request = HARLEY_WRITE_DPRAM_HIGH;

-     if ( highlow == 0 )
-         request = HARLEY_WRITE_DPRAM_LOW;
-     else
-         request = HARLEY_WRITE_DPRAM_HIGH;
-
-     ret = ft1000_control(ft1000dev,
-                           usb_sndctrlpipe(ft1000dev->dev, 0),
-                           request,
//request -- WRITE_DPRAM_H/L
-                           HARLEY_WRITE_OPERATION,              //requestType
-                           value,                                   //value
-                           indx,                                //index
-                           NULL,                               //buffer
-                           0,                                   //buffer size
-                           LARGE_TIMEOUT );
-
-
-   if ( ret != STATUS_SUCCESS )
-       return STATUS_FAILURE;
+	ret = ft1000_control(ft1000dev, usb_sndctrlpipe(ft1000dev->dev, 0),
request,	//request -- WRITE_DPRAM_H/L
+			     HARLEY_WRITE_OPERATION,	//requestType
+			     value,	//value
+			     indx,	//index
+			     NULL,	//buffer
+			     0,	//buffer size
+			     LARGE_TIMEOUT);

+	if (ret != STATUS_SUCCESS)
+		return STATUS_FAILURE;

-    return ret;
+	return ret;
 }

 //---------------------------------------------------------------------------
@@ -470,39 +433,36 @@ u16 ft1000_write_dpram16(struct ft1000_device
*ft1000dev, USHORT indx, USHORT va
 // Notes:
 //
 //---------------------------------------------------------------------------
-u16 fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT
indx, PUCHAR buffer)
+u16 fix_ft1000_read_dpram32(struct ft1000_device * ft1000dev, USHORT indx,
+			    PUCHAR buffer)
 {
-    UCHAR tempbuffer[16];
-    USHORT pos;
-    u16 ret = STATUS_SUCCESS;
-
-    //DEBUG("fix_ft1000_read_dpram32: indx: %d  \n", indx);
-    pos = (indx / 4)*4;
-    ret = ft1000_read_dpram32(ft1000dev, pos, (PUCHAR)&tempbuffer[0], 16);
-    if (ret == STATUS_SUCCESS)
-    {
-        pos = (indx % 4)*4;
-        *buffer++ = tempbuffer[pos++];
-        *buffer++ = tempbuffer[pos++];
-        *buffer++ = tempbuffer[pos++];
-        *buffer++ = tempbuffer[pos++];
-    }
-    else
-    {
-        DEBUG("fix_ft1000_read_dpram32: DPRAM32 Read failed\n");
-        *buffer++ = 0;
-        *buffer++ = 0;
-        *buffer++ = 0;
-        *buffer++ = 0;
+	UCHAR tempbuffer[16];
+	USHORT pos;
+	u16 ret = STATUS_SUCCESS;
+
+	//DEBUG("fix_ft1000_read_dpram32: indx: %d  \n", indx);
+	pos = (indx / 4) * 4;
+	ret = ft1000_read_dpram32(ft1000dev, pos, (PUCHAR) & tempbuffer[0], 16);
+	if (ret == STATUS_SUCCESS) {
+		pos = (indx % 4) * 4;
+		*buffer++ = tempbuffer[pos++];
+		*buffer++ = tempbuffer[pos++];
+		*buffer++ = tempbuffer[pos++];
+		*buffer++ = tempbuffer[pos++];
+	} else {
+		DEBUG("fix_ft1000_read_dpram32: DPRAM32 Read failed\n");
+		*buffer++ = 0;
+		*buffer++ = 0;
+		*buffer++ = 0;
+		*buffer++ = 0;

-    }
+	}

-   //DEBUG("fix_ft1000_read_dpram32: data is  %x \n", *buffer);
-   return ret;
+	//DEBUG("fix_ft1000_read_dpram32: data is  %x \n", *buffer);
+	return ret;

 }

-
 //---------------------------------------------------------------------------
 // Function:    fix_ft1000_write_dpram32
 //
@@ -519,73 +479,74 @@ u16 fix_ft1000_read_dpram32(struct ft1000_device
*ft1000dev, USHORT indx, PUCHAR
 // Notes:
 //
 //---------------------------------------------------------------------------
-u16 fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT
indx, PUCHAR buffer)
+u16 fix_ft1000_write_dpram32(struct ft1000_device * ft1000dev, USHORT indx,
+			     PUCHAR buffer)
 {
-    USHORT pos1;
-    USHORT pos2;
-    USHORT i;
-    UCHAR tempbuffer[32];
-    UCHAR resultbuffer[32];
-    PUCHAR pdata;
-    u16 ret  = STATUS_SUCCESS;
-
-    //DEBUG("fix_ft1000_write_dpram32: Entered:\n");
-
-    pos1 = (indx / 4)*4;
-    pdata = buffer;
-    ret = ft1000_read_dpram32(ft1000dev, pos1, (PUCHAR)&tempbuffer[0], 16);
-    if (ret == STATUS_SUCCESS)
-    {
-        pos2 = (indx % 4)*4;
-        tempbuffer[pos2++] = *buffer++;
-        tempbuffer[pos2++] = *buffer++;
-        tempbuffer[pos2++] = *buffer++;
-        tempbuffer[pos2++] = *buffer++;
-        ret = ft1000_write_dpram32(ft1000dev, pos1,
(PUCHAR)&tempbuffer[0], 16);
-    }
-    else
-    {
-        DEBUG("fix_ft1000_write_dpram32: DPRAM32 Read failed\n");
-
-        return ret;
-    }
+	USHORT pos1;
+	USHORT pos2;
+	USHORT i;
+	UCHAR tempbuffer[32];
+	UCHAR resultbuffer[32];
+	PUCHAR pdata;
+	u16 ret = STATUS_SUCCESS;
+
+	//DEBUG("fix_ft1000_write_dpram32: Entered:\n");
+
+	pos1 = (indx / 4) * 4;
+	pdata = buffer;
+	ret =
+	    ft1000_read_dpram32(ft1000dev, pos1, (PUCHAR) & tempbuffer[0], 16);
+	if (ret == STATUS_SUCCESS) {
+		pos2 = (indx % 4) * 4;
+		tempbuffer[pos2++] = *buffer++;
+		tempbuffer[pos2++] = *buffer++;
+		tempbuffer[pos2++] = *buffer++;
+		tempbuffer[pos2++] = *buffer++;
+		ret =
+		    ft1000_write_dpram32(ft1000dev, pos1,
+					 (PUCHAR) & tempbuffer[0], 16);
+	} else {
+		DEBUG("fix_ft1000_write_dpram32: DPRAM32 Read failed\n");
+
+		return ret;
+	}

-    ret = ft1000_read_dpram32(ft1000dev, pos1, (PUCHAR)&resultbuffer[0], 16);
-    if (ret == STATUS_SUCCESS)
-    {
-        buffer = pdata;
-        for (i=0; i<16; i++)
-        {
-            if (tempbuffer[i] != resultbuffer[i]){
-
-                ret = STATUS_FAILURE;
-            }
-        }
-    }
+	ret =
+	    ft1000_read_dpram32(ft1000dev, pos1, (PUCHAR) & resultbuffer[0],
+				16);
+	if (ret == STATUS_SUCCESS) {
+		buffer = pdata;
+		for (i = 0; i < 16; i++) {
+			if (tempbuffer[i] != resultbuffer[i]) {
+
+				ret = STATUS_FAILURE;
+			}
+		}
+	}

-    if (ret == STATUS_FAILURE)
-    {
-        ret = ft1000_write_dpram32(ft1000dev, pos1,
(PUCHAR)&tempbuffer[0], 16);
-        ret = ft1000_read_dpram32(ft1000dev, pos1,
(PUCHAR)&resultbuffer[0], 16);
-        if (ret == STATUS_SUCCESS)
-        {
-            buffer = pdata;
-            for (i=0; i<16; i++)
-            {
-                if (tempbuffer[i] != resultbuffer[i])
-                {
-                    ret = STATUS_FAILURE;
-                    DEBUG("fix_ft1000_write_dpram32 Failed to write\n");
-                }
-            }
-         }
-    }
+	if (ret == STATUS_FAILURE) {
+		ret =
+		    ft1000_write_dpram32(ft1000dev, pos1,
+					 (PUCHAR) & tempbuffer[0], 16);
+		ret =
+		    ft1000_read_dpram32(ft1000dev, pos1,
+					(PUCHAR) & resultbuffer[0], 16);
+		if (ret == STATUS_SUCCESS) {
+			buffer = pdata;
+			for (i = 0; i < 16; i++) {
+				if (tempbuffer[i] != resultbuffer[i]) {
+					ret = STATUS_FAILURE;
+					DEBUG
+					    ("fix_ft1000_write_dpram32 Failed to write\n");
+				}
+			}
+		}
+	}

-    return ret;
+	return ret;

 }

-
 //------------------------------------------------------------------------
 //
 //  Function:   card_reset_dsp
@@ -596,38 +557,51 @@ u16 fix_ft1000_write_dpram32(struct
ft1000_device *ft1000dev, USHORT indx, PUCHA
 //
 //  Returns:    None
 //-----------------------------------------------------------------------
-void card_reset_dsp (struct ft1000_device *ft1000dev, BOOLEAN value)
+void card_reset_dsp(struct ft1000_device *ft1000dev, BOOLEAN value)
 {
-    u16 status = STATUS_SUCCESS;
-    USHORT tempword;
-
-    status = ft1000_write_register (ft1000dev, HOST_INTF_BE,
FT1000_REG_SUP_CTRL);
-    status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_SUP_CTRL);
-    if (value)
-    {
-        DEBUG("Reset DSP\n");
-        status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET);
-        tempword |= DSP_RESET_BIT;
-        status = ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET);
-    }
-    else
-    {
-        DEBUG("Activate DSP\n");
-        status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET);
+	u16 status = STATUS_SUCCESS;
+	USHORT tempword;
+
+	status =
+	    ft1000_write_register(ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL);
+	status =
+	    ft1000_read_register(ft1000dev, &tempword, FT1000_REG_SUP_CTRL);
+	if (value) {
+		DEBUG("Reset DSP\n");
+		status =
+		    ft1000_read_register(ft1000dev, &tempword,
+					 FT1000_REG_RESET);
+		tempword |= DSP_RESET_BIT;
+		status =
+		    ft1000_write_register(ft1000dev, tempword,
+					  FT1000_REG_RESET);
+	} else {
+		DEBUG("Activate DSP\n");
+		status =
+		    ft1000_read_register(ft1000dev, &tempword,
+					 FT1000_REG_RESET);
 #if 1
-        tempword |= DSP_ENCRYPTED;
-        tempword &= ~DSP_UNENCRYPTED;
+		tempword |= DSP_ENCRYPTED;
+		tempword &= ~DSP_UNENCRYPTED;
 #else
-        tempword |= DSP_UNENCRYPTED;
-        tempword &= ~DSP_ENCRYPTED;
+		tempword |= DSP_UNENCRYPTED;
+		tempword &= ~DSP_ENCRYPTED;
 #endif
-        status = ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET);
-        status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET);
-        tempword &= ~EFUSE_MEM_DISABLE;
-        tempword &= ~DSP_RESET_BIT;
-        status = ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET);
-        status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET);
-    }
+		status =
+		    ft1000_write_register(ft1000dev, tempword,
+					  FT1000_REG_RESET);
+		status =
+		    ft1000_read_register(ft1000dev, &tempword,
+					 FT1000_REG_RESET);
+		tempword &= ~EFUSE_MEM_DISABLE;
+		tempword &= ~DSP_RESET_BIT;
+		status =
+		    ft1000_write_register(ft1000dev, tempword,
+					  FT1000_REG_RESET);
+		status =
+		    ft1000_read_register(ft1000dev, &tempword,
+					 FT1000_REG_RESET);
+	}
 }

 //---------------------------------------------------------------------------
@@ -645,18 +619,19 @@ void card_reset_dsp (struct ft1000_device
*ft1000dev, BOOLEAN value)
 // Notes:
 //
 //---------------------------------------------------------------------------
-void CardSendCommand(struct ft1000_device *ft1000dev, unsigned char
*ptempbuffer, int size)
+void CardSendCommand(struct ft1000_device *ft1000dev,
+		     unsigned char *ptempbuffer, int size)
 {
-    unsigned short temp;
-    unsigned char *commandbuf;
+	unsigned short temp;
+	unsigned char *commandbuf;

-    DEBUG("CardSendCommand: enter CardSendCommand... size=%d\n", size);
+	DEBUG("CardSendCommand: enter CardSendCommand... size=%d\n", size);

-    commandbuf =(unsigned char*) kmalloc(size+2, GFP_KERNEL);
-    //memset((void*)commandbuf, 0, size+2);
-    memcpy((void*)commandbuf+2, (void*)ptempbuffer, size);
+	commandbuf = (unsigned char *)kmalloc(size + 2, GFP_KERNEL);
+	//memset((void*)commandbuf, 0, size+2);
+	memcpy((void *)commandbuf + 2, (void *)ptempbuffer, size);

-    //DEBUG("CardSendCommand: Command Send\n");
+	//DEBUG("CardSendCommand: Command Send\n");
     /***
     for (i=0; i<size+2; i++)
     {
@@ -664,39 +639,34 @@ void CardSendCommand(struct ft1000_device
*ft1000dev, unsigned char *ptempbuffer
     }
     ***/

-    ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL);
-
-    if (temp & 0x0100)
-    {
-       msleep(10);
-    }
+	ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL);

-    // check for odd word
-    size = size + 2;
-    if (size % 4)
-    {
-       // Must force to be 32 bit aligned
-       size += 4 - (size % 4);
-    }
-
-
-    //DEBUG("CardSendCommand: write dpram ... size=%d\n", size);
-    ft1000_write_dpram32(ft1000dev, 0,commandbuf, size);
-    msleep(1);
-    //DEBUG("CardSendCommand: write into doorbell ...\n");
-    ft1000_write_register(ft1000dev,  FT1000_DB_DPRAM_TX
,FT1000_REG_DOORBELL) ;
-    msleep(1);
+	if (temp & 0x0100) {
+		msleep(10);
+	}
+	// check for odd word
+	size = size + 2;
+	if (size % 4) {
+		// Must force to be 32 bit aligned
+		size += 4 - (size % 4);
+	}

-    ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL);
-    //DEBUG("CardSendCommand: read doorbell ...temp=%x\n", temp);
-    if ( (temp & 0x0100) == 0)
-    {
-       //DEBUG("CardSendCommand: Message sent\n");
-    }
+	//DEBUG("CardSendCommand: write dpram ... size=%d\n", size);
+	ft1000_write_dpram32(ft1000dev, 0, commandbuf, size);
+	msleep(1);
+	//DEBUG("CardSendCommand: write into doorbell ...\n");
+	ft1000_write_register(ft1000dev, FT1000_DB_DPRAM_TX,
+			      FT1000_REG_DOORBELL);
+	msleep(1);
+
+	ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL);
+	//DEBUG("CardSendCommand: read doorbell ...temp=%x\n", temp);
+	if ((temp & 0x0100) == 0) {
+		//DEBUG("CardSendCommand: Message sent\n");
+	}

 }

-
 //--------------------------------------------------------------------------
 //
 //  Function:   dsp_reload
@@ -707,52 +677,54 @@ void CardSendCommand(struct ft1000_device
*ft1000dev, unsigned char *ptempbuffer
 //
 //  Returns:    None
 //-----------------------------------------------------------------------
-void dsp_reload (struct ft1000_device *ft1000dev)
+void dsp_reload(struct ft1000_device *ft1000dev)
 {
-    u16 status;
-    USHORT tempword;
-    ULONG templong;
-
-    PFT1000_INFO pft1000info;
+	u16 status;
+	USHORT tempword;
+	ULONG templong;

-    pft1000info = netdev_priv(ft1000dev->net);
+	PFT1000_INFO pft1000info;

-    pft1000info->CardReady = 0;
-    pft1000info->DSP_loading= 1;
+	pft1000info = netdev_priv(ft1000dev->net);

-    // Program Interrupt Mask register
-    status = ft1000_write_register (ft1000dev, 0xffff, FT1000_REG_SUP_IMASK);
+	pft1000info->CardReady = 0;
+	pft1000info->DSP_loading = 1;

-    status = ft1000_read_register (ft1000dev, &tempword, FT1000_REG_RESET);
-    tempword |= ASIC_RESET_BIT;
-    status = ft1000_write_register (ft1000dev, tempword, FT1000_REG_RESET);
-    msleep(1000);
-    status = ft1000_read_register (ft1000dev, &tempword, FT1000_REG_RESET);
-    DEBUG("Reset Register = 0x%x\n", tempword);
+	// Program Interrupt Mask register
+	status = ft1000_write_register(ft1000dev, 0xffff, FT1000_REG_SUP_IMASK);

-    // Toggle DSP reset
-    card_reset_dsp (ft1000dev, 1);
-    msleep(1000);
-    card_reset_dsp (ft1000dev, 0);
-    msleep(1000);
+	status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET);
+	tempword |= ASIC_RESET_BIT;
+	status = ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET);
+	msleep(1000);
+	status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET);
+	DEBUG("Reset Register = 0x%x\n", tempword);

-    status = ft1000_write_register (ft1000dev, HOST_INTF_BE,
FT1000_REG_SUP_CTRL);
+	// Toggle DSP reset
+	card_reset_dsp(ft1000dev, 1);
+	msleep(1000);
+	card_reset_dsp(ft1000dev, 0);
+	msleep(1000);

-    // Let's check for FEFE
-    status = ft1000_read_dpram32 (ft1000dev,
FT1000_MAG_DPRAM_FEFE_INDX, (PUCHAR)&templong, 4);
-    DEBUG("templong (fefe) = 0x%8x\n", templong);
+	status =
+	    ft1000_write_register(ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL);

-    // call codeloader
-    status = scram_dnldr(ft1000dev, pFileStart, FileLength);
+	// Let's check for FEFE
+	status =
+	    ft1000_read_dpram32(ft1000dev, FT1000_MAG_DPRAM_FEFE_INDX,
+				(PUCHAR) & templong, 4);
+	DEBUG("templong (fefe) = 0x%8x\n", templong);

-    if ( status != STATUS_SUCCESS)
-       return;
+	// call codeloader
+	status = scram_dnldr(ft1000dev, pFileStart, FileLength);

-    msleep(1000);
-    pft1000info->DSP_loading= 0;
+	if (status != STATUS_SUCCESS)
+		return;

-    DEBUG("dsp_reload returned\n");
+	msleep(1000);
+	pft1000info->DSP_loading = 0;

+	DEBUG("dsp_reload returned\n");

 }

@@ -767,33 +739,35 @@ void dsp_reload (struct ft1000_device *ft1000dev)
 //     none
 //
 //---------------------------------------------------------------------------
-static void ft1000_reset_asic (struct net_device *dev)
+static void ft1000_reset_asic(struct net_device *dev)
 {
-    FT1000_INFO *info = netdev_priv(dev);
-    struct ft1000_device *ft1000dev = info->pFt1000Dev;
-    u16 tempword;
+	FT1000_INFO *info = netdev_priv(dev);
+	struct ft1000_device *ft1000dev = info->pFt1000Dev;
+	u16 tempword;

-    DEBUG("ft1000_hw:ft1000_reset_asic called\n");
+	DEBUG("ft1000_hw:ft1000_reset_asic called\n");

-    info->ASICResetNum++;
+	info->ASICResetNum++;

-    // Let's use the register provided by the Magnemite ASIC to reset the
-    // ASIC and DSP.
-    ft1000_write_register(ft1000dev,  (DSP_RESET_BIT |
ASIC_RESET_BIT), FT1000_REG_RESET );
+	// Let's use the register provided by the Magnemite ASIC to reset the
+	// ASIC and DSP.
+	ft1000_write_register(ft1000dev, (DSP_RESET_BIT | ASIC_RESET_BIT),
+			      FT1000_REG_RESET);

-    mdelay(1);
+	mdelay(1);

-    // set watermark to -1 in order to not generate an interrrupt
-    ft1000_write_register(ft1000dev, 0xffff, FT1000_REG_MAG_WATERMARK);
+	// set watermark to -1 in order to not generate an interrrupt
+	ft1000_write_register(ft1000dev, 0xffff, FT1000_REG_MAG_WATERMARK);

-    // clear interrupts
-    ft1000_read_register (ft1000dev, &tempword, FT1000_REG_SUP_ISR);
-    DEBUG("ft1000_hw: interrupt status register = 0x%x\n",tempword);
-    ft1000_write_register (ft1000dev,  tempword, FT1000_REG_SUP_ISR);
-    ft1000_read_register (ft1000dev, &tempword, FT1000_REG_SUP_ISR);
-    DEBUG("ft1000_hw: interrupt status register = 0x%x\n",tempword);
+	// clear interrupts
+	ft1000_read_register(ft1000dev, &tempword, FT1000_REG_SUP_ISR);
+	DEBUG("ft1000_hw: interrupt status register = 0x%x\n", tempword);
+	ft1000_write_register(ft1000dev, tempword, FT1000_REG_SUP_ISR);
+	ft1000_read_register(ft1000dev, &tempword, FT1000_REG_SUP_ISR);
+	DEBUG("ft1000_hw: interrupt status register = 0x%x\n", tempword);

 }
+
 /*
 //---------------------------------------------------------------------------
 //
@@ -851,148 +825,147 @@ static void ft1000_enable_interrupts(struct
net_device *dev) {
 //              TRUE  (card reset successful)
 //
 //---------------------------------------------------------------------------
-static int ft1000_reset_card (struct net_device *dev)
+static int ft1000_reset_card(struct net_device *dev)
 {
-    FT1000_INFO *info = netdev_priv(dev);
-    struct ft1000_device *ft1000dev = info->pFt1000Dev;
-    u16 tempword;
-    PPROV_RECORD ptr;
-
-    DEBUG("ft1000_hw:ft1000_reset_card called.....\n");
-
-    info->fCondResetPend = 1;
-    info->CardReady = 0;
-    info->fProvComplete = 0;
-    //ft1000_disable_interrupts(dev);
-
-    // Cancel heartbeat task since we are reloading the dsp
-    //del_timer(&poll_timer[info->CardNumber]);
-
-    // Make sure we free any memory reserve for provisioning
-    while (list_empty(&info->prov_list) == 0) {
-        DEBUG("ft1000_hw:ft1000_reset_card:deleting provisioning record\n");
-        ptr = list_entry(info->prov_list.next, PROV_RECORD, list);
-        list_del(&ptr->list);
-        kfree(ptr->pprov_data);
-        kfree(ptr);
-    }
+	FT1000_INFO *info = netdev_priv(dev);
+	struct ft1000_device *ft1000dev = info->pFt1000Dev;
+	u16 tempword;
+	PPROV_RECORD ptr;
+
+	DEBUG("ft1000_hw:ft1000_reset_card called.....\n");
+
+	info->fCondResetPend = 1;
+	info->CardReady = 0;
+	info->fProvComplete = 0;
+	//ft1000_disable_interrupts(dev);
+
+	// Cancel heartbeat task since we are reloading the dsp
+	//del_timer(&poll_timer[info->CardNumber]);
+
+	// Make sure we free any memory reserve for provisioning
+	while (list_empty(&info->prov_list) == 0) {
+		DEBUG
+		    ("ft1000_hw:ft1000_reset_card:deleting provisioning record\n");
+		ptr = list_entry(info->prov_list.next, PROV_RECORD, list);
+		list_del(&ptr->list);
+		kfree(ptr->pprov_data);
+		kfree(ptr);
+	}

-    DEBUG("ft1000_hw:ft1000_reset_card: reset asic\n");
-    //reset ASIC
-    ft1000_reset_asic(dev);
+	DEBUG("ft1000_hw:ft1000_reset_card: reset asic\n");
+	//reset ASIC
+	ft1000_reset_asic(dev);

-    info->DSPResetNum++;
+	info->DSPResetNum++;

 #if 0
-    DEBUG("ft1000_hw:ft1000_reset_card:resetting ASIC and DSP\n");
-    ft1000_write_register (ft1000dev, (DSP_RESET_BIT |
ASIC_RESET_BIT), FT1000_REG_RESET );
-
-
-    // Copy DSP session record into info block if this is not a coldstart
-    //if (ft1000_card_present == 1) {
-        spin_lock_irqsave(&info->dpram_lock, flags);
-
-            ft1000_write_register(ft1000dev,
FT1000_DPRAM_MAG_RX_BASE, FT1000_REG_DPRAM_ADDR);
-            for (i=0;i<MAX_DSP_SESS_REC/2; i++) {
-                //info->DSPSess.MagRec[i] =
inl(dev->base_addr+FT1000_REG_MAG_DPDATA);
-                ft1000_read_dpram32(ft1000dev, FT1000_REG_MAG_DPDATA,
(PCHAR)&(info->DSPSess.MagRec[i]), 4);
-            }
-
-        spin_unlock_irqrestore(&info->dpram_lock, flags);
-    //}
-    info->squeseqnum = 0;
-
-    DEBUG("ft1000_hw:ft1000_reset_card:resetting ASIC\n");
-    mdelay(10);
-    //reset ASIC
-    ft1000_reset_asic(dev);
-
-    info->DSPResetNum++;
-
-    DEBUG("ft1000_hw:ft1000_reset_card:downloading dsp image\n");
-
-
-        // Put dsp in reset and take ASIC out of reset
-        DEBUG("ft1000_hw:ft1000_reset_card:Put DSP in reset and take
ASIC out of reset\n");
-        ft1000_write_register (ft1000dev, DSP_RESET_BIT, FT1000_REG_RESET);
-
-        // Setting MAGNEMITE ASIC to big endian mode
-        ft1000_write_register (ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL);
-
-        // Take DSP out of reset
-
-           ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET);
-           tempword |= DSP_ENCRYPTED;
-           tempword &= ~DSP_UNENCRYPTED;
-           ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET);
-           tempword &= ~EFUSE_MEM_DISABLE;
-           ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET);
-           tempword &= ~DSP_RESET_BIT;
-           ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET);
-
-
-        // FLARION_DSP_ACTIVE;
-        mdelay(10);
-        DEBUG("ft1000_hw:ft1000_reset_card:Take DSP out of reset\n");
-
-        // Wait for 0xfefe indicating dsp ready before starting download
-        for (i=0; i<50; i++) {
-            //tempword = ft1000_read_dpram_mag_16(dev,
FT1000_MAG_DPRAM_FEFE, FT1000_MAG_DPRAM_FEFE_INDX);
-            ft1000_read_dpram32 (ft1000dev,
FT1000_MAG_DPRAM_FEFE_INDX, (PUCHAR)&templong, 4);
-            if (tempword == 0xfefe) {
-                break;
-            }
-            mdelay(20);
-        }
+	DEBUG("ft1000_hw:ft1000_reset_card:resetting ASIC and DSP\n");
+	ft1000_write_register(ft1000dev, (DSP_RESET_BIT | ASIC_RESET_BIT),
+			      FT1000_REG_RESET);
+
+	// Copy DSP session record into info block if this is not a coldstart
+	//if (ft1000_card_present == 1) {
+	spin_lock_irqsave(&info->dpram_lock, flags);
+
+	ft1000_write_register(ft1000dev, FT1000_DPRAM_MAG_RX_BASE,
+			      FT1000_REG_DPRAM_ADDR);
+	for (i = 0; i < MAX_DSP_SESS_REC / 2; i++) {
+		//info->DSPSess.MagRec[i] = inl(dev->base_addr+FT1000_REG_MAG_DPDATA);
+		ft1000_read_dpram32(ft1000dev, FT1000_REG_MAG_DPDATA,
+				    (PCHAR) & (info->DSPSess.MagRec[i]), 4);
+	}

-        if (i==50) {
-            DEBUG("ft1000_hw:ft1000_reset_card:No FEFE detected from DSP\n");
-            return FALSE;
-        }
+	spin_unlock_irqrestore(&info->dpram_lock, flags);
+	//}
+	info->squeseqnum = 0;
+
+	DEBUG("ft1000_hw:ft1000_reset_card:resetting ASIC\n");
+	mdelay(10);
+	//reset ASIC
+	ft1000_reset_asic(dev);
+
+	info->DSPResetNum++;
+
+	DEBUG("ft1000_hw:ft1000_reset_card:downloading dsp image\n");
+
+	// Put dsp in reset and take ASIC out of reset
+	DEBUG
+	    ("ft1000_hw:ft1000_reset_card:Put DSP in reset and take ASIC out
of reset\n");
+	ft1000_write_register(ft1000dev, DSP_RESET_BIT, FT1000_REG_RESET);
+
+	// Setting MAGNEMITE ASIC to big endian mode
+	ft1000_write_register(ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL);
+
+	// Take DSP out of reset
+
+	ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET);
+	tempword |= DSP_ENCRYPTED;
+	tempword &= ~DSP_UNENCRYPTED;
+	ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET);
+	tempword &= ~EFUSE_MEM_DISABLE;
+	ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET);
+	tempword &= ~DSP_RESET_BIT;
+	ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET);
+
+	// FLARION_DSP_ACTIVE;
+	mdelay(10);
+	DEBUG("ft1000_hw:ft1000_reset_card:Take DSP out of reset\n");
+
+	// Wait for 0xfefe indicating dsp ready before starting download
+	for (i = 0; i < 50; i++) {
+		//tempword = ft1000_read_dpram_mag_16(dev, FT1000_MAG_DPRAM_FEFE,
FT1000_MAG_DPRAM_FEFE_INDX);
+		ft1000_read_dpram32(ft1000dev, FT1000_MAG_DPRAM_FEFE_INDX,
+				    (PUCHAR) & templong, 4);
+		if (tempword == 0xfefe) {
+			break;
+		}
+		mdelay(20);
+	}

+	if (i == 50) {
+		DEBUG
+		    ("ft1000_hw:ft1000_reset_card:No FEFE detected from DSP\n");
+		return FALSE;
+	}

 #endif

-    DEBUG("ft1000_hw:ft1000_reset_card: call dsp_reload\n");
-    dsp_reload(ft1000dev);
-
-    DEBUG("dsp reload successful\n");
+	DEBUG("ft1000_hw:ft1000_reset_card: call dsp_reload\n");
+	dsp_reload(ft1000dev);

+	DEBUG("dsp reload successful\n");

-    mdelay(10);
+	mdelay(10);

-    // Initialize DSP heartbeat area to ho
-    ft1000_write_dpram16(ft1000dev, FT1000_MAG_HI_HO, ho_mag,
FT1000_MAG_HI_HO_INDX);
-    ft1000_read_dpram16(ft1000dev, FT1000_MAG_HI_HO,
(PCHAR)&tempword, FT1000_MAG_HI_HO_INDX);
-    DEBUG("ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n", tempword);
+	// Initialize DSP heartbeat area to ho
+	ft1000_write_dpram16(ft1000dev, FT1000_MAG_HI_HO, ho_mag,
+			     FT1000_MAG_HI_HO_INDX);
+	ft1000_read_dpram16(ft1000dev, FT1000_MAG_HI_HO, (PCHAR) & tempword,
+			    FT1000_MAG_HI_HO_INDX);
+	DEBUG("ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n", tempword);

+	info->CardReady = 1;
+	//ft1000_enable_interrupts(dev);
+	/* Schedule heartbeat process to run every 2 seconds */
+	//poll_timer[info->CardNumber].expires = jiffies + (2*HZ);
+	//poll_timer[info->CardNumber].data = (u_long)dev;
+	//add_timer(&poll_timer[info->CardNumber]);

-
-    info->CardReady = 1;
-    //ft1000_enable_interrupts(dev);
-    /* Schedule heartbeat process to run every 2 seconds */
-    //poll_timer[info->CardNumber].expires = jiffies + (2*HZ);
-    //poll_timer[info->CardNumber].data = (u_long)dev;
-    //add_timer(&poll_timer[info->CardNumber]);
-
-    info->fCondResetPend = 0;
-    return TRUE;
+	info->fCondResetPend = 0;
+	return TRUE;

 }

-
 //mbelian
 #ifdef HAVE_NET_DEVICE_OPS
-static const struct net_device_ops ftnet_ops =
-{
-.ndo_open = &ft1000_open,
-.ndo_stop = &ft1000_close,
-.ndo_start_xmit = &ft1000_start_xmit,
-.ndo_get_stats = &ft1000_netdev_stats,
+static const struct net_device_ops ftnet_ops = {
+	.ndo_open = &ft1000_open,
+	.ndo_stop = &ft1000_close,
+	.ndo_start_xmit = &ft1000_start_xmit,
+	.ndo_get_stats = &ft1000_netdev_stats,
 };
 #endif

-
 //---------------------------------------------------------------------------
 // Function:    init_ft1000_netdev
 //
@@ -1009,132 +982,119 @@ static const struct net_device_ops ftnet_ops =
 //---------------------------------------------------------------------------
 u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
 {
-    struct net_device *netdev;
-    FT1000_INFO *pInfo = NULL;
-    PDPRAM_BLK pdpram_blk;
-    int i;
-
-	gCardIndex=0; //mbelian
-
-    DEBUG("Enter init_ft1000_netdev...\n");
-
+	struct net_device *netdev;
+	FT1000_INFO *pInfo = NULL;
+	PDPRAM_BLK pdpram_blk;
+	int i;

-    netdev = alloc_etherdev( sizeof(FT1000_INFO));
-    if (!netdev )
-    {
-        DEBUG("init_ft1000_netdev: can not allocate network device\n");
-        return STATUS_FAILURE;
-    }
-
-    //pInfo = (PFT1000_INFO)netdev->priv;
-	pInfo = (FT1000_INFO *) netdev_priv (netdev);
+	gCardIndex = 0;		//mbelian

-    //DEBUG("init_ft1000_netdev: gFt1000Info=%x, netdev=%x,
ft1000dev=%x\n", gFt1000Info, netdev, ft1000dev);
+	DEBUG("Enter init_ft1000_netdev...\n");

-    memset (pInfo, 0, sizeof(FT1000_INFO));
-
-    dev_alloc_name(netdev, netdev->name);
-
-    //for the first inserted card, decide the card index beginning
number, in case there are existing network interfaces
-    if ( gCardIndex == 0 )
-    {
-        DEBUG("init_ft1000_netdev: network device name is %s\n", netdev->name);
-
-        if ( strncmp(netdev->name,"eth", 3) == 0) {
-            //pInfo->CardNumber = atoi(&netdev->name[3]);
-            gCardIndex = atoi(&netdev->name[3]);
-            pInfo->CardNumber = gCardIndex;
-            DEBUG("card number = %d\n", pInfo->CardNumber);
-        }
-        else {
-            printk(KERN_ERR "ft1000: Invalid device name\n");
-            kfree(netdev);
-            return STATUS_FAILURE;
-        }
-    }
-    else
-    {
-        //not the first inserted card, increase card number by 1
-        /*gCardIndex ++;*/
-        pInfo->CardNumber = gCardIndex;
-        /*DEBUG("card number = %d\n", pInfo->CardNumber);*/ //mbelian
-    }
+	netdev = alloc_etherdev(sizeof(FT1000_INFO));
+	if (!netdev) {
+		DEBUG("init_ft1000_netdev: can not allocate network device\n");
+		return STATUS_FAILURE;
+	}
+	//pInfo = (PFT1000_INFO)netdev->priv;
+	pInfo = (FT1000_INFO *) netdev_priv(netdev);
+
+	//DEBUG("init_ft1000_netdev: gFt1000Info=%x, netdev=%x,
ft1000dev=%x\n", gFt1000Info, netdev, ft1000dev);
+
+	memset(pInfo, 0, sizeof(FT1000_INFO));
+
+	dev_alloc_name(netdev, netdev->name);
+
+	//for the first inserted card, decide the card index beginning
number, in case there are existing network interfaces
+	if (gCardIndex == 0) {
+		DEBUG("init_ft1000_netdev: network device name is %s\n",
+		      netdev->name);
+
+		if (strncmp(netdev->name, "eth", 3) == 0) {
+			//pInfo->CardNumber = atoi(&netdev->name[3]);
+			gCardIndex = atoi(&netdev->name[3]);
+			pInfo->CardNumber = gCardIndex;
+			DEBUG("card number = %d\n", pInfo->CardNumber);
+		} else {
+			printk(KERN_ERR "ft1000: Invalid device name\n");
+			kfree(netdev);
+			return STATUS_FAILURE;
+		}
+	} else {
+		//not the first inserted card, increase card number by 1
+		/*gCardIndex ++; */
+		pInfo->CardNumber = gCardIndex;
+		/*DEBUG("card number = %d\n", pInfo->CardNumber); *///mbelian
+	}

-    memset(&pInfo->stats, 0, sizeof(struct net_device_stats) );
-
-   spin_lock_init(&pInfo->dpram_lock);
-    pInfo->pFt1000Dev = ft1000dev;
-    pInfo->DrvErrNum = 0;
-    pInfo->ASICResetNum = 0;
-    pInfo->registered = 1;
-    pInfo->ft1000_reset = ft1000_reset;
-    pInfo->mediastate = 0;
-    pInfo->fifo_cnt = 0;
-    pInfo->DeviceCreated = FALSE;
-    pInfo->DeviceMajor = 0;
-    pInfo->CurrentInterruptEnableMask = ISR_DEFAULT_MASK;
-    pInfo->InterruptsEnabled = FALSE;
-    pInfo->CardReady = 0;
-    pInfo->DSP_loading = 0;
-    pInfo->DSP_TIME[0] = 0;
-    pInfo->DSP_TIME[1] = 0;
-    pInfo->DSP_TIME[2] = 0;
-    pInfo->DSP_TIME[3] = 0;
-    pInfo->fAppMsgPend = 0;
-    pInfo->fCondResetPend = 0;
+	memset(&pInfo->stats, 0, sizeof(struct net_device_stats));
+
+	spin_lock_init(&pInfo->dpram_lock);
+	pInfo->pFt1000Dev = ft1000dev;
+	pInfo->DrvErrNum = 0;
+	pInfo->ASICResetNum = 0;
+	pInfo->registered = 1;
+	pInfo->ft1000_reset = ft1000_reset;
+	pInfo->mediastate = 0;
+	pInfo->fifo_cnt = 0;
+	pInfo->DeviceCreated = FALSE;
+	pInfo->DeviceMajor = 0;
+	pInfo->CurrentInterruptEnableMask = ISR_DEFAULT_MASK;
+	pInfo->InterruptsEnabled = FALSE;
+	pInfo->CardReady = 0;
+	pInfo->DSP_loading = 0;
+	pInfo->DSP_TIME[0] = 0;
+	pInfo->DSP_TIME[1] = 0;
+	pInfo->DSP_TIME[2] = 0;
+	pInfo->DSP_TIME[3] = 0;
+	pInfo->fAppMsgPend = 0;
+	pInfo->fCondResetPend = 0;
 	pInfo->usbboot = 0;
 	pInfo->dspalive = 0;
-	for (i=0;i<32 ;i++ )
-	{
+	for (i = 0; i < 32; i++) {
 		pInfo->tempbuf[i] = 0;
 	}

-    INIT_LIST_HEAD(&pInfo->prov_list);
+	INIT_LIST_HEAD(&pInfo->prov_list);

 //mbelian
 #ifdef HAVE_NET_DEVICE_OPS
 	netdev->netdev_ops = &ftnet_ops;
 #else
-    netdev->hard_start_xmit = &ft1000_start_xmit;
-    netdev->get_stats = &ft1000_netdev_stats;
-    netdev->open = &ft1000_open;
-    netdev->stop = &ft1000_close;
+	netdev->hard_start_xmit = &ft1000_start_xmit;
+	netdev->get_stats = &ft1000_netdev_stats;
+	netdev->open = &ft1000_open;
+	netdev->stop = &ft1000_close;
 #endif

-    //netif_stop_queue(netdev); //mbelian
-
-
-    ft1000dev->net = netdev;
-
+	//netif_stop_queue(netdev); //mbelian

+	ft1000dev->net = netdev;

 //init free_buff_lock, freercvpool, numofmsgbuf, pdpram_blk
 //only init once per card
 //Jim
-    	  DEBUG("Initialize free_buff_lock and freercvpool\n");
-        spin_lock_init(&free_buff_lock);
-
-        // initialize a list of buffers to be use for queuing up
receive command data
-        INIT_LIST_HEAD (&freercvpool);
-
-        // create list of free buffers
-        for (i=0; i<NUM_OF_FREE_BUFFERS; i++) {
-            // Get memory for DPRAM_DATA link list
-            pdpram_blk = kmalloc ( sizeof(DPRAM_BLK), GFP_KERNEL );
-            // Get a block of memory to store command data
-            pdpram_blk->pbuffer = kmalloc ( MAX_CMD_SQSIZE, GFP_KERNEL );
-            // link provisioning data
-            list_add_tail (&pdpram_blk->list, &freercvpool);
-        }
-        numofmsgbuf = NUM_OF_FREE_BUFFERS;
-
+	DEBUG("Initialize free_buff_lock and freercvpool\n");
+	spin_lock_init(&free_buff_lock);
+
+	// initialize a list of buffers to be use for queuing up receive command data
+	INIT_LIST_HEAD(&freercvpool);
+
+	// create list of free buffers
+	for (i = 0; i < NUM_OF_FREE_BUFFERS; i++) {
+		// Get memory for DPRAM_DATA link list
+		pdpram_blk = kmalloc(sizeof(DPRAM_BLK), GFP_KERNEL);
+		// Get a block of memory to store command data
+		pdpram_blk->pbuffer = kmalloc(MAX_CMD_SQSIZE, GFP_KERNEL);
+		// link provisioning data
+		list_add_tail(&pdpram_blk->list, &freercvpool);
+	}
+	numofmsgbuf = NUM_OF_FREE_BUFFERS;

-    return STATUS_SUCCESS;
+	return STATUS_SUCCESS;

 }

-
-
 //---------------------------------------------------------------------------
 // Function:    reg_ft1000_netdev
 //
@@ -1149,42 +1109,39 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
 // Notes:
 //
 //---------------------------------------------------------------------------
-u16 reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct
usb_interface *intf)
+u16 reg_ft1000_netdev(struct ft1000_device * ft1000dev,
+		      struct usb_interface * intf)
 {
-    struct net_device *netdev;
-    FT1000_INFO *pInfo;
-    int i, rc;
+	struct net_device *netdev;
+	FT1000_INFO *pInfo;
+	int i, rc;

-    netdev = ft1000dev->net;
-    pInfo = netdev_priv(ft1000dev->net);
-    DEBUG("Enter reg_ft1000_netdev...\n");
+	netdev = ft1000dev->net;
+	pInfo = netdev_priv(ft1000dev->net);
+	DEBUG("Enter reg_ft1000_netdev...\n");

+	ft1000_read_register(ft1000dev, &pInfo->AsicID, FT1000_REG_ASIC_ID);

-    ft1000_read_register(ft1000dev, &pInfo->AsicID, FT1000_REG_ASIC_ID);
+	usb_set_intfdata(intf, pInfo);
+	SET_NETDEV_DEV(netdev, &intf->dev);

-    usb_set_intfdata(intf, pInfo);
-    SET_NETDEV_DEV(netdev, &intf->dev);
-
-    rc = register_netdev(netdev);
-    if (rc)
-    {
-        DEBUG("reg_ft1000_netdev: could not register network device\n");
-        free_netdev(netdev);
-        return STATUS_FAILURE;
-    }
-
-
-    //Create character device, implemented by Jim
-    ft1000_CreateDevice(ft1000dev);
+	rc = register_netdev(netdev);
+	if (rc) {
+		DEBUG("reg_ft1000_netdev: could not register network device\n");
+		free_netdev(netdev);
+		return STATUS_FAILURE;
+	}

-    //INIT_LIST_HEAD(&pInfo->prov_list);
+	//Create character device, implemented by Jim
+	ft1000_CreateDevice(ft1000dev);

-    for (i=0; i<MAX_NUM_CARDS; i++) {
-        poll_timer[i].function = ft1000_hbchk;
-    }
+	//INIT_LIST_HEAD(&pInfo->prov_list);

+	for (i = 0; i < MAX_NUM_CARDS; i++) {
+		poll_timer[i].function = ft1000_hbchk;
+	}

-    //hard code MAC address for now
+	//hard code MAC address for now
 /**
     netdev->dev_addr[0] = 0;
     netdev->dev_addr[1] = 7;
@@ -1194,18 +1151,17 @@ u16 reg_ft1000_netdev(struct ft1000_device
*ft1000dev, struct usb_interface *int
     netdev->dev_addr[5] = 0x20 + pInfo->CardNumber;
 **/

-    DEBUG ("reg_ft1000_netdev returned\n");
+	DEBUG("reg_ft1000_netdev returned\n");

-    pInfo->CardReady = 1;
+	pInfo->CardReady = 1;

-
-   return STATUS_SUCCESS;
+	return STATUS_SUCCESS;
 }

 int ft1000_reset(struct net_device *dev)
 {
-    ft1000_reset_card(dev);
-    return 0;
+	ft1000_reset_card(dev);
+	return 0;
 }

 //---------------------------------------------------------------------------
@@ -1224,147 +1180,128 @@ int ft1000_reset(struct net_device *dev)
 static void ft1000_usb_transmit_complete(struct urb *urb)
 {

-    struct ft1000_device *ft1000dev = urb->context;
+	struct ft1000_device *ft1000dev = urb->context;

-    //DEBUG("ft1000_usb_transmit_complete entered\n");
+	//DEBUG("ft1000_usb_transmit_complete entered\n");
 // Jim   spin_lock(&ft1000dev->device_lock);

-    if (urb->status)
-        printk("%s: TX status %d\n", ft1000dev->net->name, urb->status);
+	if (urb->status)
+		printk("%s: TX status %d\n", ft1000dev->net->name, urb->status);

-    netif_wake_queue(ft1000dev->net);
+	netif_wake_queue(ft1000dev->net);

 //Jim    spin_unlock(&ft1000dev->device_lock);
-    //DEBUG("Return from ft1000_usb_transmit_complete\n");
+	//DEBUG("Return from ft1000_usb_transmit_complete\n");
 }

-
 /****************************************************************
  *     ft1000_control
  ****************************************************************/
-static int ft1000_read_fifo_reg(struct ft1000_device
*ft1000dev,unsigned int pipe,
-                          u8 request,
-                          u8 requesttype,
-                          u16 value,
-                          u16 index,
-                          void *data,
-                          u16 size,
-                          int timeout)
+static int ft1000_read_fifo_reg(struct ft1000_device *ft1000dev,
+				unsigned int pipe, u8 request, u8 requesttype,
+				u16 value, u16 index, void *data, u16 size,
+				int timeout)
 {
-    u16 ret;
-
-    DECLARE_WAITQUEUE(wait, current);
-    struct urb *urb;
-    struct usb_ctrlrequest *dr;
-    int status;
-
-    if (ft1000dev == NULL )
-    {
-        DEBUG("NULL ft1000dev, failure\n");
-        return STATUS_FAILURE;
-    }
-    else if ( ft1000dev->dev == NULL )
-    {
-        DEBUG("NULL ft1000dev->dev, failure\n");
-        return STATUS_FAILURE;
-    }
-
-    spin_lock(&ft1000dev->device_lock);
+	u16 ret;

-    /*DECLARE_WAITQUEUE(wait, current);
-    struct urb *urb;
-    struct usb_ctrlrequest *dr;
-    int status;*/
+	DECLARE_WAITQUEUE(wait, current);
+	struct urb *urb;
+	struct usb_ctrlrequest *dr;
+	int status;

-    if(in_interrupt())
-    {
-        spin_unlock(&ft1000dev->device_lock);
-        return -EBUSY;
-    }
+	if (ft1000dev == NULL) {
+		DEBUG("NULL ft1000dev, failure\n");
+		return STATUS_FAILURE;
+	} else if (ft1000dev->dev == NULL) {
+		DEBUG("NULL ft1000dev->dev, failure\n");
+		return STATUS_FAILURE;
+	}

-    urb = usb_alloc_urb(0, GFP_KERNEL);
-    dr = kmalloc(sizeof(struct usb_ctrlrequest), in_interrupt() ?
GFP_ATOMIC : GFP_KERNEL);
+	spin_lock(&ft1000dev->device_lock);

-    if(!urb || !dr)
-    {
-        if(urb) kfree(urb);
-        spin_unlock(&ft1000dev->device_lock);
-        return -ENOMEM;
-    }
+	/*DECLARE_WAITQUEUE(wait, current);
+	   struct urb *urb;
+	   struct usb_ctrlrequest *dr;
+	   int status; */

+	if (in_interrupt()) {
+		spin_unlock(&ft1000dev->device_lock);
+		return -EBUSY;
+	}

+	urb = usb_alloc_urb(0, GFP_KERNEL);
+	dr = kmalloc(sizeof(struct usb_ctrlrequest),
+		     in_interrupt()? GFP_ATOMIC : GFP_KERNEL);

-    dr->bRequestType = requesttype;
-    dr->bRequest = request;
-    dr->wValue = value;
-    dr->wIndex = index;
-    dr->wLength = size;
+	if (!urb || !dr) {
+		if (urb)
+			kfree(urb);
+		spin_unlock(&ft1000dev->device_lock);
+		return -ENOMEM;
+	}

-    usb_fill_control_urb(urb, ft1000dev->dev, pipe, (char*)dr,
(void*)data, size, (void *)ft1000_control_complete, (void*)ft1000dev);
+	dr->bRequestType = requesttype;
+	dr->bRequest = request;
+	dr->wValue = value;
+	dr->wIndex = index;
+	dr->wLength = size;

+	usb_fill_control_urb(urb, ft1000dev->dev, pipe, (char *)dr,
+			     (void *)data, size,
+			     (void *)ft1000_control_complete,
+			     (void *)ft1000dev);

-    init_waitqueue_head(&ft1000dev->control_wait);
+	init_waitqueue_head(&ft1000dev->control_wait);

-    //current->state = TASK_INTERRUPTIBLE; //mbelian
+	//current->state = TASK_INTERRUPTIBLE; //mbelian
 	set_current_state(TASK_INTERRUPTIBLE);

-    add_wait_queue(&ft1000dev->control_wait, &wait);
+	add_wait_queue(&ft1000dev->control_wait, &wait);

+	status = usb_submit_urb(urb, GFP_KERNEL);

+	if (status) {
+		usb_free_urb(urb);
+		kfree(dr);
+		remove_wait_queue(&ft1000dev->control_wait, &wait);
+		spin_unlock(&ft1000dev->device_lock);
+		return status;
+	}

+	if (urb->status == -EINPROGRESS) {
+		while (timeout && urb->status == -EINPROGRESS) {
+			status = timeout = schedule_timeout(timeout);
+		}
+	} else {
+		status = 1;
+	}

-    status = usb_submit_urb(urb, GFP_KERNEL);
-
-    if(status)
-    {
-        usb_free_urb(urb);
-        kfree(dr);
-        remove_wait_queue(&ft1000dev->control_wait, &wait);
-        spin_unlock(&ft1000dev->device_lock);
-        return status;
-    }
-
-    if(urb->status == -EINPROGRESS)
-    {
-        while(timeout && urb->status == -EINPROGRESS)
-        {
-            status = timeout = schedule_timeout(timeout);
-        }
-    }
-    else
-    {
-        status = 1;
-    }
-
-    remove_wait_queue(&ft1000dev->control_wait, &wait);
-
-    if(!status)
-    {
-        usb_unlink_urb(urb);
-        printk("ft1000 timeout\n");
-        status = -ETIMEDOUT;
-    }
-    else
-    {
-        status = urb->status;
-
-        if(urb->status)
-        {
-            printk("ft1000 control message failed (urb addr: %x) with
error number: %i\n", (int)urb, (int)status);
-
-            usb_clear_halt(ft1000dev->dev, usb_rcvctrlpipe(ft1000dev->dev, 0));
-            usb_clear_halt(ft1000dev->dev, usb_sndctrlpipe(ft1000dev->dev, 0));
-            usb_unlink_urb(urb);
-        }
-    }
-
-
-
-    usb_free_urb(urb);
-    kfree(dr);
-    spin_unlock(&ft1000dev->device_lock);
-    return ret;
+	remove_wait_queue(&ft1000dev->control_wait, &wait);
+
+	if (!status) {
+		usb_unlink_urb(urb);
+		printk("ft1000 timeout\n");
+		status = -ETIMEDOUT;
+	} else {
+		status = urb->status;
+
+		if (urb->status) {
+			printk
+			    ("ft1000 control message failed (urb addr: %x) with error number: %i\n",
+			     (int)urb, (int)status);
+
+			usb_clear_halt(ft1000dev->dev,
+				       usb_rcvctrlpipe(ft1000dev->dev, 0));
+			usb_clear_halt(ft1000dev->dev,
+				       usb_sndctrlpipe(ft1000dev->dev, 0));
+			usb_unlink_urb(urb);
+		}
+	}

+	usb_free_urb(urb);
+	kfree(dr);
+	spin_unlock(&ft1000dev->device_lock);
+	return ret;

 }

@@ -1381,42 +1318,39 @@ static int ft1000_read_fifo_reg(struct
ft1000_device *ft1000dev,unsigned int pip
 // Notes:
 //
 //---------------------------------------------------------------------------
-static inline u16 ft1000_read_fifo_len (struct net_device *dev)
+static inline u16 ft1000_read_fifo_len(struct net_device *dev)
 {
-    u16 temp;
-    u16 ret;
+	u16 temp;
+	u16 ret;

-    //FT1000_INFO *info = (PFT1000_INFO)dev->priv;
-	FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev);
-    struct ft1000_device *ft1000dev = info->pFt1000Dev;
-//    DEBUG("ft1000_read_fifo_len: enter ft1000dev %x\n",
ft1000dev);			//aelias [-] reason: warning: format ???%x??? expects
type ???unsigned int???, but argument 2 has type ???struct
ft1000_device *???
-    DEBUG("ft1000_read_fifo_len: enter ft1000dev %x\n", (unsigned
int)ft1000dev);	//aelias [+] reason: up
-    //ft1000_read_register(ft1000dev, &temp, FT1000_REG_MAG_UFSR);
+	//FT1000_INFO *info = (PFT1000_INFO)dev->priv;
+	FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev);
+	struct ft1000_device *ft1000dev = info->pFt1000Dev;
+//    DEBUG("ft1000_read_fifo_len: enter ft1000dev %x\n", ft1000dev);
                  //aelias [-] reason: warning: format ???%x???
expects type ???unsigned int???, but argument 2 has type ???struct
ft1000_device *???
+	DEBUG("ft1000_read_fifo_len: enter ft1000dev %x\n", (unsigned
int)ft1000dev);	//aelias [+] reason: up
+	//ft1000_read_register(ft1000dev, &temp, FT1000_REG_MAG_UFSR);

-    ret = STATUS_SUCCESS;
+	ret = STATUS_SUCCESS;

-    ret = ft1000_read_fifo_reg(ft1000dev,
-                          usb_rcvctrlpipe(ft1000dev->dev,0),
-                          HARLEY_READ_REGISTER,
-                          HARLEY_READ_OPERATION,
-                          0,
-                          FT1000_REG_MAG_UFSR,
-                          &temp,
-                          2,
-                          LARGE_TIMEOUT);
+	ret = ft1000_read_fifo_reg(ft1000dev,
+				   usb_rcvctrlpipe(ft1000dev->dev, 0),
+				   HARLEY_READ_REGISTER,
+				   HARLEY_READ_OPERATION,
+				   0,
+				   FT1000_REG_MAG_UFSR,
+				   &temp, 2, LARGE_TIMEOUT);

-    if (ret>0)
-        ret = STATUS_SUCCESS;
-    else
-        ret = STATUS_FAILURE;
+	if (ret > 0)
+		ret = STATUS_SUCCESS;
+	else
+		ret = STATUS_FAILURE;

-    DEBUG("ft1000_read_fifo_len: returned %d\n", temp);
+	DEBUG("ft1000_read_fifo_len: returned %d\n", temp);

-    return (temp- 16);
+	return (temp - 16);

 }

-
 //---------------------------------------------------------------------------
 //
 // Function:   ft1000_copy_down_pkt
@@ -1432,139 +1366,123 @@ static inline u16 ft1000_read_fifo_len
(struct net_device *dev)
 //              SUCCESS
 //
 //---------------------------------------------------------------------------
-int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len)
+int ft1000_copy_down_pkt(struct net_device *netdev, u8 * packet, u16 len)
 {
-    FT1000_INFO *pInfo = netdev_priv(netdev);
-    struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev;
-
+	FT1000_INFO *pInfo = netdev_priv(netdev);
+	struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev;

-    int i, count, ret;
-    USHORT *pTemp;
-    USHORT checksum;
-    u8 *t;
-
-    if (!pInfo->CardReady)
-    {
+	int i, count, ret;
+	USHORT *pTemp;
+	USHORT checksum;
+	u8 *t;

-        DEBUG("ft1000_copy_down_pkt::Card Not Ready\n");
-    	return STATUS_FAILURE;
+	if (!pInfo->CardReady) {

-    }
+		DEBUG("ft1000_copy_down_pkt::Card Not Ready\n");
+		return STATUS_FAILURE;

+	}

-    //DEBUG("ft1000_copy_down_pkt() entered, len = %d\n", len);
+	//DEBUG("ft1000_copy_down_pkt() entered, len = %d\n", len);

 #if 0
-    // Check if there is room on the FIFO
-    if ( len > ft1000_read_fifo_len (netdev) )
-    {
-         udelay(10);
-         if ( len > ft1000_read_fifo_len (netdev) )
-         {
-             udelay(20);
-         }
-
-         if ( len > ft1000_read_fifo_len (netdev) )
-         {
-             udelay(20);
-         }
-
-         if ( len > ft1000_read_fifo_len (netdev) )
-         {
-             udelay(20);
-         }
-
-         if ( len > ft1000_read_fifo_len (netdev) )
-         {
-             udelay(20);
-         }
-
-         if ( len > ft1000_read_fifo_len (netdev) )
-         {
-             udelay(20);
-         }
-
-         if ( len > ft1000_read_fifo_len (netdev) )
-         {
-            DEBUG("ft1000_hw:ft1000_copy_down_pkt:Transmit FIFO is
fulli - pkt drop\n");
-            pInfo->stats.tx_errors++;
-            return STATUS_SUCCESS;
-         }
-    }
+	// Check if there is room on the FIFO
+	if (len > ft1000_read_fifo_len(netdev)) {
+		udelay(10);
+		if (len > ft1000_read_fifo_len(netdev)) {
+			udelay(20);
+		}
+
+		if (len > ft1000_read_fifo_len(netdev)) {
+			udelay(20);
+		}
+
+		if (len > ft1000_read_fifo_len(netdev)) {
+			udelay(20);
+		}
+
+		if (len > ft1000_read_fifo_len(netdev)) {
+			udelay(20);
+		}
+
+		if (len > ft1000_read_fifo_len(netdev)) {
+			udelay(20);
+		}
+
+		if (len > ft1000_read_fifo_len(netdev)) {
+			DEBUG
+			    ("ft1000_hw:ft1000_copy_down_pkt:Transmit FIFO is fulli - pkt drop\n");
+			pInfo->stats.tx_errors++;
+			return STATUS_SUCCESS;
+		}
+	}
 #endif

-    count = sizeof (PSEUDO_HDR) + len;
-    if(count > MAX_BUF_SIZE)
-    {
-        DEBUG("Error:ft1000_copy_down_pkt:Message Size Overflow!\n");
-    	DEBUG("size = %d\n", count);
-    	return STATUS_FAILURE;
-    }
-
-    if ( count % 4)
-        count = count + (4- (count %4) );
-
-    pTemp = (PUSHORT)&(pFt1000Dev->tx_buf[0]);
-    *pTemp ++ = ntohs(count);
-    *pTemp ++ = 0x1020;
-    *pTemp ++ = 0x2010;
-    *pTemp ++ = 0x9100;
-    *pTemp ++ = 0;
-    *pTemp ++ = 0;
-    *pTemp ++ = 0;
-    pTemp = (PUSHORT)&(pFt1000Dev->tx_buf[0]);
-    checksum = *pTemp ++;
-    for (i=1; i<7; i++)
-    {
-        checksum ^= *pTemp ++;
-    }
-    *pTemp++ = checksum;
-    memcpy (&(pFt1000Dev->tx_buf[sizeof(PSEUDO_HDR)]), packet, len);
+	count = sizeof(PSEUDO_HDR) + len;
+	if (count > MAX_BUF_SIZE) {
+		DEBUG("Error:ft1000_copy_down_pkt:Message Size Overflow!\n");
+		DEBUG("size = %d\n", count);
+		return STATUS_FAILURE;
+	}

-    //usb_init_urb(pFt1000Dev->tx_urb); //mbelian
+	if (count % 4)
+		count = count + (4 - (count % 4));
+
+	pTemp = (PUSHORT) & (pFt1000Dev->tx_buf[0]);
+	*pTemp++ = ntohs(count);
+	*pTemp++ = 0x1020;
+	*pTemp++ = 0x2010;
+	*pTemp++ = 0x9100;
+	*pTemp++ = 0;
+	*pTemp++ = 0;
+	*pTemp++ = 0;
+	pTemp = (PUSHORT) & (pFt1000Dev->tx_buf[0]);
+	checksum = *pTemp++;
+	for (i = 1; i < 7; i++) {
+		checksum ^= *pTemp++;
+	}
+	*pTemp++ = checksum;
+	memcpy(&(pFt1000Dev->tx_buf[sizeof(PSEUDO_HDR)]), packet, len);

-    netif_stop_queue(netdev);
+	//usb_init_urb(pFt1000Dev->tx_urb); //mbelian

-    //DEBUG ("ft1000_copy_down_pkt: count = %d\n", count);
+	netif_stop_queue(netdev);

-    usb_fill_bulk_urb(pFt1000Dev->tx_urb,
-                      pFt1000Dev->dev,
-                      usb_sndbulkpipe(pFt1000Dev->dev,
pFt1000Dev->bulk_out_endpointAddr),
-                      pFt1000Dev->tx_buf,
-                      count,
-                      ft1000_usb_transmit_complete,
-                      (void*)pFt1000Dev);
+	//DEBUG ("ft1000_copy_down_pkt: count = %d\n", count);

-    t = (u8 *)pFt1000Dev->tx_urb->transfer_buffer;
-    //DEBUG("transfer_length=%d\n",
pFt1000Dev->tx_urb->transfer_buffer_length);
-    /*for (i=0; i<count; i++ )
-    {
-       DEBUG("%x    ", *t++ );
-    }*/
+	usb_fill_bulk_urb(pFt1000Dev->tx_urb,
+			  pFt1000Dev->dev,
+			  usb_sndbulkpipe(pFt1000Dev->dev,
+					  pFt1000Dev->bulk_out_endpointAddr),
+			  pFt1000Dev->tx_buf, count,
+			  ft1000_usb_transmit_complete, (void *)pFt1000Dev);

+	t = (u8 *) pFt1000Dev->tx_urb->transfer_buffer;
+	//DEBUG("transfer_length=%d\n", pFt1000Dev->tx_urb->transfer_buffer_length);
+	/*for (i=0; i<count; i++ )
+	   {
+	   DEBUG("%x    ", *t++ );
+	   } */

-    ret = usb_submit_urb(pFt1000Dev->tx_urb, GFP_ATOMIC);
-    if(ret)
-    {
+	ret = usb_submit_urb(pFt1000Dev->tx_urb, GFP_ATOMIC);
+	if (ret) {
 		DEBUG("ft1000 failed tx_urb %d\n", ret);

-   /*     pInfo->stats.tx_errors++;
+		/*     pInfo->stats.tx_errors++;

-        netif_start_queue(netdev);  */  //mbelian
+		   netif_start_queue(netdev);  *///mbelian
 		return STATUS_FAILURE;

-    }
-    else
-    {
-        //DEBUG("ft1000 sucess tx_urb %d\n", ret);
+	} else {
+		//DEBUG("ft1000 sucess tx_urb %d\n", ret);

-        pInfo->stats.tx_packets++;
-        pInfo->stats.tx_bytes += (len+14);
-    }
+		pInfo->stats.tx_packets++;
+		pInfo->stats.tx_bytes += (len + 14);
+	}

-    //DEBUG("ft1000_copy_down_pkt() exit\n");
+	//DEBUG("ft1000_copy_down_pkt() exit\n");

-    return STATUS_SUCCESS;
+	return STATUS_SUCCESS;
 }

 //---------------------------------------------------------------------------
@@ -1583,66 +1501,61 @@ int ft1000_copy_down_pkt (struct net_device
*netdev, u8 *packet, u16 len)
 //---------------------------------------------------------------------------
 static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-    FT1000_INFO *pInfo = netdev_priv(dev);
-    struct ft1000_device *pFt1000Dev= pInfo->pFt1000Dev;
-    u8 *pdata;
-    int maxlen, pipe;
+	FT1000_INFO *pInfo = netdev_priv(dev);
+	struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev;
+	u8 *pdata;
+	int maxlen, pipe;

+	//DEBUG(" ft1000_start_xmit() entered\n");

-    //DEBUG(" ft1000_start_xmit() entered\n");
-
-    if ( skb == NULL )
-    {
-        DEBUG ("ft1000_hw: ft1000_start_xmit:skb == NULL!!!\n" );
-        return STATUS_FAILURE;
-    }
-
-    if ( pFt1000Dev->status & FT1000_STATUS_CLOSING)
-    {
-        DEBUG("network driver is closed, return\n");
-        dev_kfree_skb(skb);
-        //usb_kill_urb(pFt1000Dev->tx_urb); //mbelian
-        return STATUS_SUCCESS;
-    }
-
-    //DEBUG("ft1000_start_xmit 1:length of packet = %d\n", skb->len);
-    pipe = usb_sndbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_out_endpointAddr);
-    maxlen = usb_maxpacket(pFt1000Dev->dev, pipe, usb_pipeout(pipe));
-    //DEBUG("ft1000_start_xmit 2: pipe=%d dev->maxpacket  = %d\n",
pipe, maxlen);
-
-    pdata = (u8 *)skb->data;
-    /*for (i=0; i<skb->len; i++)
-        DEBUG("skb->data[%d]=%x    ", i, *(skb->data+i));
-
-    DEBUG("\n");*/
-
+	if (skb == NULL) {
+		DEBUG("ft1000_hw: ft1000_start_xmit:skb == NULL!!!\n");
+		return STATUS_FAILURE;
+	}

-    if (pInfo->mediastate == 0)
-    {
-        /* Drop packet is mediastate is down */
-        DEBUG("ft1000_hw:ft1000_start_xmit:mediastate is down\n");
-        dev_kfree_skb(skb);
-        return STATUS_SUCCESS;
-    }
+	if (pFt1000Dev->status & FT1000_STATUS_CLOSING) {
+		DEBUG("network driver is closed, return\n");
+		dev_kfree_skb(skb);
+		//usb_kill_urb(pFt1000Dev->tx_urb); //mbelian
+		return STATUS_SUCCESS;
+	}
+	//DEBUG("ft1000_start_xmit 1:length of packet = %d\n", skb->len);
+	pipe =
+	    usb_sndbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_out_endpointAddr);
+	maxlen = usb_maxpacket(pFt1000Dev->dev, pipe, usb_pipeout(pipe));
+	//DEBUG("ft1000_start_xmit 2: pipe=%d dev->maxpacket  = %d\n", pipe, maxlen);
+
+	pdata = (u8 *) skb->data;
+	/*for (i=0; i<skb->len; i++)
+	   DEBUG("skb->data[%d]=%x    ", i, *(skb->data+i));
+
+	   DEBUG("\n"); */
+
+	if (pInfo->mediastate == 0) {
+		/* Drop packet is mediastate is down */
+		DEBUG("ft1000_hw:ft1000_start_xmit:mediastate is down\n");
+		dev_kfree_skb(skb);
+		return STATUS_SUCCESS;
+	}

-    if ( (skb->len < ENET_HEADER_SIZE) || (skb->len > ENET_MAX_SIZE) )
-    {
-        /* Drop packet which has invalid size */
-        DEBUG("ft1000_hw:ft1000_start_xmit:invalid ethernet length\n");
-        dev_kfree_skb(skb);
-        return STATUS_SUCCESS;
-    }
+	if ((skb->len < ENET_HEADER_SIZE) || (skb->len > ENET_MAX_SIZE)) {
+		/* Drop packet which has invalid size */
+		DEBUG("ft1000_hw:ft1000_start_xmit:invalid ethernet length\n");
+		dev_kfree_skb(skb);
+		return STATUS_SUCCESS;
+	}
 //mbelian
-    if(ft1000_copy_down_pkt (dev, (pdata+ENET_HEADER_SIZE-2),
skb->len - ENET_HEADER_SIZE + 2) == STATUS_FAILURE)
-	{
-    	dev_kfree_skb(skb);
+	if (ft1000_copy_down_pkt
+	    (dev, (pdata + ENET_HEADER_SIZE - 2),
+	     skb->len - ENET_HEADER_SIZE + 2) == STATUS_FAILURE) {
+		dev_kfree_skb(skb);
 		return STATUS_SUCCESS;
 	}

-    dev_kfree_skb(skb);
-    //DEBUG(" ft1000_start_xmit() exit\n");
+	dev_kfree_skb(skb);
+	//DEBUG(" ft1000_start_xmit() exit\n");

-    return 0;
+	return 0;
 }

 //---------------------------------------------------------------------------
@@ -1658,107 +1571,98 @@ static int ft1000_start_xmit(struct sk_buff
*skb, struct net_device *dev)
 //              SUCCESS
 //
 //---------------------------------------------------------------------------
-int ft1000_copy_up_pkt (struct urb *urb)
+int ft1000_copy_up_pkt(struct urb *urb)
 {
-    PFT1000_INFO info = urb->context;
-    struct ft1000_device *ft1000dev = info->pFt1000Dev;
-    struct net_device *net = ft1000dev->net;
-
-    u16 tempword;
-    u16 len;
-    u16 lena; //mbelian
-    struct sk_buff *skb;
-    u16 i;
-    u8 *pbuffer=NULL;
-    u8 *ptemp=NULL;
-    u16 *chksum;
-
-
-    //DEBUG("ft1000_copy_up_pkt entered\n");
-
-    if ( ft1000dev->status & FT1000_STATUS_CLOSING)
-    {
-        DEBUG("network driver is closed, return\n");
-        return STATUS_SUCCESS;
-    }
-
-    // Read length
-    len = urb->transfer_buffer_length;
-    lena = urb->actual_length; //mbelian
-    //DEBUG("ft1000_copy_up_pkt: transfer_buffer_length=%d,
actual_buffer_len=%d\n",
-      //       urb->transfer_buffer_length, urb->actual_length);
-
-    chksum = (PUSHORT)ft1000dev->rx_buf;
-
-    tempword = *chksum++;
-    for (i=1; i<7; i++)
-    {
-        tempword ^= *chksum++;
-    }
-
-    if  (tempword != *chksum)
-    {
-        info->stats.rx_errors ++;
-        ft1000_submit_rx_urb(info);
-        return STATUS_FAILURE;
-    }
-
-
-    //DEBUG("ft1000_copy_up_pkt: checksum is correct %x\n", *chksum);
-
-    skb = dev_alloc_skb(len+12+2);
-
-    if (skb == NULL)
-    {
-        DEBUG("ft1000_copy_up_pkt: No Network buffers available\n");
-        info->stats.rx_errors++;
-        ft1000_submit_rx_urb(info);
-        return STATUS_FAILURE;
-    }
-
-    pbuffer = (u8 *)skb_put(skb, len+12);
-
-    //subtract the number of bytes read already
-    ptemp = pbuffer;
-
-    // fake MAC address
-    *pbuffer++ = net->dev_addr[0];
-    *pbuffer++ = net->dev_addr[1];
-    *pbuffer++ = net->dev_addr[2];
-    *pbuffer++ = net->dev_addr[3];
-    *pbuffer++ = net->dev_addr[4];
-    *pbuffer++ = net->dev_addr[5];
-    *pbuffer++ = 0x00;
-    *pbuffer++ = 0x07;
-    *pbuffer++ = 0x35;
-    *pbuffer++ = 0xff;
-    *pbuffer++ = 0xff;
-    *pbuffer++ = 0xfe;
-
-
+	PFT1000_INFO info = urb->context;
+	struct ft1000_device *ft1000dev = info->pFt1000Dev;
+	struct net_device *net = ft1000dev->net;
+
+	u16 tempword;
+	u16 len;
+	u16 lena;		//mbelian
+	struct sk_buff *skb;
+	u16 i;
+	u8 *pbuffer = NULL;
+	u8 *ptemp = NULL;
+	u16 *chksum;
+
+	//DEBUG("ft1000_copy_up_pkt entered\n");
+
+	if (ft1000dev->status & FT1000_STATUS_CLOSING) {
+		DEBUG("network driver is closed, return\n");
+		return STATUS_SUCCESS;
+	}
+	// Read length
+	len = urb->transfer_buffer_length;
+	lena = urb->actual_length;	//mbelian
+	//DEBUG("ft1000_copy_up_pkt: transfer_buffer_length=%d,
actual_buffer_len=%d\n",
+	//       urb->transfer_buffer_length, urb->actual_length);

+	chksum = (PUSHORT) ft1000dev->rx_buf;

-    memcpy(pbuffer, ft1000dev->rx_buf+sizeof(PSEUDO_HDR),
len-sizeof(PSEUDO_HDR));
+	tempword = *chksum++;
+	for (i = 1; i < 7; i++) {
+		tempword ^= *chksum++;
+	}

-    //DEBUG("ft1000_copy_up_pkt: Data passed to Protocol layer\n");
-    /*for (i=0; i<len+12; i++)
-    {
-        DEBUG("ft1000_copy_up_pkt: Protocol Data: 0x%x\n ", *ptemp++);
-    }*/
+	if (tempword != *chksum) {
+		info->stats.rx_errors++;
+		ft1000_submit_rx_urb(info);
+		return STATUS_FAILURE;
+	}

-    skb->dev = net;
+	//DEBUG("ft1000_copy_up_pkt: checksum is correct %x\n", *chksum);

-    skb->protocol = eth_type_trans(skb, net);
-    skb->ip_summed = CHECKSUM_UNNECESSARY;
-    netif_rx(skb);
+	skb = dev_alloc_skb(len + 12 + 2);

-    info->stats.rx_packets++;
-    // Add on 12 bytes for MAC address which was removed
-    info->stats.rx_bytes += (lena+12); //mbelian
+	if (skb == NULL) {
+		DEBUG("ft1000_copy_up_pkt: No Network buffers available\n");
+		info->stats.rx_errors++;
+		ft1000_submit_rx_urb(info);
+		return STATUS_FAILURE;
+	}

-    ft1000_submit_rx_urb(info);
-    //DEBUG("ft1000_copy_up_pkt exited\n");
-    return SUCCESS;
+	pbuffer = (u8 *) skb_put(skb, len + 12);
+
+	//subtract the number of bytes read already
+	ptemp = pbuffer;
+
+	// fake MAC address
+	*pbuffer++ = net->dev_addr[0];
+	*pbuffer++ = net->dev_addr[1];
+	*pbuffer++ = net->dev_addr[2];
+	*pbuffer++ = net->dev_addr[3];
+	*pbuffer++ = net->dev_addr[4];
+	*pbuffer++ = net->dev_addr[5];
+	*pbuffer++ = 0x00;
+	*pbuffer++ = 0x07;
+	*pbuffer++ = 0x35;
+	*pbuffer++ = 0xff;
+	*pbuffer++ = 0xff;
+	*pbuffer++ = 0xfe;
+
+	memcpy(pbuffer, ft1000dev->rx_buf + sizeof(PSEUDO_HDR),
+	       len - sizeof(PSEUDO_HDR));
+
+	//DEBUG("ft1000_copy_up_pkt: Data passed to Protocol layer\n");
+	/*for (i=0; i<len+12; i++)
+	   {
+	   DEBUG("ft1000_copy_up_pkt: Protocol Data: 0x%x\n ", *ptemp++);
+	   } */
+
+	skb->dev = net;
+
+	skb->protocol = eth_type_trans(skb, net);
+	skb->ip_summed = CHECKSUM_UNNECESSARY;
+	netif_rx(skb);
+
+	info->stats.rx_packets++;
+	// Add on 12 bytes for MAC address which was removed
+	info->stats.rx_bytes += (lena + 12);	//mbelian
+
+	ft1000_submit_rx_urb(info);
+	//DEBUG("ft1000_copy_up_pkt exited\n");
+	return SUCCESS;
 }

 //---------------------------------------------------------------------------
@@ -1776,41 +1680,37 @@ int ft1000_copy_up_pkt (struct urb *urb)
 //---------------------------------------------------------------------------
 int ft1000_submit_rx_urb(PFT1000_INFO info)
 {
-    int result;
-    struct ft1000_device *pFt1000Dev = info->pFt1000Dev;
-
-    //netif_carrier_on(pFt1000Dev->net);
-
-    //DEBUG ("ft1000_submit_rx_urb entered: sizeof rx_urb is %d\n",
sizeof(*pFt1000Dev->rx_urb));
-    if ( pFt1000Dev->status & FT1000_STATUS_CLOSING)
-    {
-        DEBUG("network driver is closed, return\n");
-        //usb_kill_urb(pFt1000Dev->rx_urb); //mbelian
-        return STATUS_SUCCESS;
-    }
-    //memset(pFt1000Dev->rx_urb, 0, sizeof(*pFt1000Dev->rx_urb));
-    //usb_init_urb(pFt1000Dev->rx_urb);//mbelian
+	int result;
+	struct ft1000_device *pFt1000Dev = info->pFt1000Dev;

-    //spin_lock_init(&pFt1000Dev->rx_urb->lock);
+	//netif_carrier_on(pFt1000Dev->net);

-    usb_fill_bulk_urb(pFt1000Dev->rx_urb,
-            pFt1000Dev->dev,
-            usb_rcvbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_in_endpointAddr),
-            pFt1000Dev->rx_buf,
-            MAX_BUF_SIZE,
-            (usb_complete_t)ft1000_copy_up_pkt,
-            info);
+	//DEBUG ("ft1000_submit_rx_urb entered: sizeof rx_urb is %d\n",
sizeof(*pFt1000Dev->rx_urb));
+	if (pFt1000Dev->status & FT1000_STATUS_CLOSING) {
+		DEBUG("network driver is closed, return\n");
+		//usb_kill_urb(pFt1000Dev->rx_urb); //mbelian
+		return STATUS_SUCCESS;
+	}
+	//memset(pFt1000Dev->rx_urb, 0, sizeof(*pFt1000Dev->rx_urb));
+	//usb_init_urb(pFt1000Dev->rx_urb);//mbelian

+	//spin_lock_init(&pFt1000Dev->rx_urb->lock);

-    if((result = usb_submit_urb(pFt1000Dev->rx_urb, GFP_ATOMIC)))
-    {
-        printk("ft1000_submit_rx_urb: submitting rx_urb %d failed\n", result);
-        return STATUS_FAILURE;
-    }
+	usb_fill_bulk_urb(pFt1000Dev->rx_urb,
+			  pFt1000Dev->dev,
+			  usb_rcvbulkpipe(pFt1000Dev->dev,
+					  pFt1000Dev->bulk_in_endpointAddr),
+			  pFt1000Dev->rx_buf, MAX_BUF_SIZE,
+			  (usb_complete_t) ft1000_copy_up_pkt, info);

-    //DEBUG("ft1000_submit_rx_urb exit: result=%d\n", result);
+	if ((result = usb_submit_urb(pFt1000Dev->rx_urb, GFP_ATOMIC))) {
+		printk("ft1000_submit_rx_urb: submitting rx_urb %d failed\n",
+		       result);
+		return STATUS_FAILURE;
+	}
+	//DEBUG("ft1000_submit_rx_urb exit: result=%d\n", result);

-    return STATUS_SUCCESS;
+	return STATUS_SUCCESS;
 }

 //---------------------------------------------------------------------------
@@ -1827,31 +1727,30 @@ int ft1000_submit_rx_urb(PFT1000_INFO info)
 // Notes:
 //
 //---------------------------------------------------------------------------
-static int ft1000_open (struct net_device *dev)
+static int ft1000_open(struct net_device *dev)
 {
-	FT1000_INFO *pInfo = (FT1000_INFO *)netdev_priv(dev);
-    struct timeval tv; //mbelian
+	FT1000_INFO *pInfo = (FT1000_INFO *) netdev_priv(dev);
+	struct timeval tv;	//mbelian

-    DEBUG("ft1000_open is called for card %d\n", pInfo->CardNumber);
-    //DEBUG("ft1000_open: dev->addr=%x, dev->addr_len=%d\n",
dev->addr, dev->addr_len);
+	DEBUG("ft1000_open is called for card %d\n", pInfo->CardNumber);
+	//DEBUG("ft1000_open: dev->addr=%x, dev->addr_len=%d\n", dev->addr,
dev->addr_len);

-	pInfo->stats.rx_bytes = 0; //mbelian
-	pInfo->stats.tx_bytes = 0; //mbelian
-	pInfo->stats.rx_packets = 0; //mbelian
-	pInfo->stats.tx_packets = 0; //mbelian
+	pInfo->stats.rx_bytes = 0;	//mbelian
+	pInfo->stats.tx_bytes = 0;	//mbelian
+	pInfo->stats.rx_packets = 0;	//mbelian
+	pInfo->stats.tx_packets = 0;	//mbelian
 	do_gettimeofday(&tv);
-    pInfo->ConTm = tv.tv_sec;
-	pInfo->ProgConStat = 0; //mbelian
+	pInfo->ConTm = tv.tv_sec;
+	pInfo->ProgConStat = 0;	//mbelian

+	netif_start_queue(dev);

-    netif_start_queue(dev);
+	//netif_device_attach(dev);

-    //netif_device_attach(dev);
+	netif_carrier_on(dev);	//mbelian

-    netif_carrier_on(dev); //mbelian
-
-    ft1000_submit_rx_urb(pInfo);
-    return 0;
+	ft1000_submit_rx_urb(pInfo);
+	return 0;
 }

 //---------------------------------------------------------------------------
@@ -1870,45 +1769,42 @@ static int ft1000_open (struct net_device *dev)
 //---------------------------------------------------------------------------
 int ft1000_close(struct net_device *net)
 {
-	FT1000_INFO *pInfo = (FT1000_INFO *) netdev_priv (net);
-    struct ft1000_device *ft1000dev = pInfo->pFt1000Dev;
-
-    //DEBUG ("ft1000_close: netdev->refcnt=%d\n", net->refcnt);
-
-    ft1000dev->status |= FT1000_STATUS_CLOSING;
+	FT1000_INFO *pInfo = (FT1000_INFO *) netdev_priv(net);
+	struct ft1000_device *ft1000dev = pInfo->pFt1000Dev;

-    //DEBUG("ft1000_close: calling usb_kill_urb \n");
-    //usb_kill_urb(ft1000dev->rx_urb);
-    //usb_kill_urb(ft1000dev->tx_urb);
+	//DEBUG ("ft1000_close: netdev->refcnt=%d\n", net->refcnt);

+	ft1000dev->status |= FT1000_STATUS_CLOSING;

-    DEBUG("ft1000_close: pInfo=%x, ft1000dev=%x\n", (int)pInfo,
(int)ft1000dev);
-    netif_carrier_off(net);//mbelian
-    netif_stop_queue(net);
-    //DEBUG("ft1000_close: netif_stop_queue called\n");
-    ft1000dev->status &= ~FT1000_STATUS_CLOSING;
+	//DEBUG("ft1000_close: calling usb_kill_urb \n");
+	//usb_kill_urb(ft1000dev->rx_urb);
+	//usb_kill_urb(ft1000dev->tx_urb);

-   pInfo->ProgConStat = 0xff; //mbelian
+	DEBUG("ft1000_close: pInfo=%x, ft1000dev=%x\n", (int)pInfo,
+	      (int)ft1000dev);
+	netif_carrier_off(net);	//mbelian
+	netif_stop_queue(net);
+	//DEBUG("ft1000_close: netif_stop_queue called\n");
+	ft1000dev->status &= ~FT1000_STATUS_CLOSING;

+	pInfo->ProgConStat = 0xff;	//mbelian

-    return 0;
+	return 0;
 }

 static struct net_device_stats *ft1000_netdev_stats(struct net_device *dev)
 {
-	FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev);
-    //struct ft1000_device *ft1000dev = info->pFt1000Dev;
+	FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev);
+	//struct ft1000_device *ft1000dev = info->pFt1000Dev;

-    //return &(ft1000dev->stats);//mbelian
-	return &(info->stats); //mbelian
+	//return &(ft1000dev->stats);//mbelian
+	return &(info->stats);	//mbelian
 }

-
 /*********************************************************************************
 Jim
 */

-
 //---------------------------------------------------------------------------
 //
 // Function:   ft1000_chkcard
@@ -1921,37 +1817,38 @@ Jim
 //              TRUE  (device is present)
 //
 //---------------------------------------------------------------------------
-static int ft1000_chkcard (struct ft1000_device *dev) {
-    u16 tempword;
-    u16 status;
-	FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev->net);
-
-    if (info->fCondResetPend)
-    {
-        DEBUG("ft1000_hw:ft1000_chkcard:Card is being reset, return FALSE\n");
-        return TRUE;
-    }
-
-    // Mask register is used to check for device presence since it is never
-    // set to zero.
-    status = ft1000_read_register(dev, &tempword, FT1000_REG_SUP_IMASK);
-    //DEBUG("ft1000_hw:ft1000_chkcard: read FT1000_REG_SUP_IMASK =
%x\n", tempword);
-    if (tempword == 0) {
-        DEBUG("ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n");
-        return FALSE;
-    }
-
-    // The system will return the value of 0xffff for the version register
-    // if the device is not present.
-    status = ft1000_read_register(dev, &tempword, FT1000_REG_ASIC_ID);
-    //DEBUG("ft1000_hw:ft1000_chkcard: read FT1000_REG_ASIC_ID =
%x\n", tempword);
-    //pxu if (tempword == 0xffff) {
-    if (tempword != 0x1b01 ){
-	dev->status |= FT1000_STATUS_CLOSING; //mbelian
-        DEBUG("ft1000_hw:ft1000_chkcard: Version = 0xffff Card not
detected\n");
-        return FALSE;
-    }
-    return TRUE;
+static int ft1000_chkcard(struct ft1000_device *dev)
+{
+	u16 tempword;
+	u16 status;
+	FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev->net);
+
+	if (info->fCondResetPend) {
+		DEBUG
+		    ("ft1000_hw:ft1000_chkcard:Card is being reset, return FALSE\n");
+		return TRUE;
+	}
+	// Mask register is used to check for device presence since it is never
+	// set to zero.
+	status = ft1000_read_register(dev, &tempword, FT1000_REG_SUP_IMASK);
+	//DEBUG("ft1000_hw:ft1000_chkcard: read FT1000_REG_SUP_IMASK =
%x\n", tempword);
+	if (tempword == 0) {
+		DEBUG
+		    ("ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n");
+		return FALSE;
+	}
+	// The system will return the value of 0xffff for the version register
+	// if the device is not present.
+	status = ft1000_read_register(dev, &tempword, FT1000_REG_ASIC_ID);
+	//DEBUG("ft1000_hw:ft1000_chkcard: read FT1000_REG_ASIC_ID = %x\n", tempword);
+	//pxu if (tempword == 0xffff) {
+	if (tempword != 0x1b01) {
+		dev->status |= FT1000_STATUS_CLOSING;	//mbelian
+		DEBUG
+		    ("ft1000_hw:ft1000_chkcard: Version = 0xffff Card not detected\n");
+		return FALSE;
+	}
+	return TRUE;
 }

 //---------------------------------------------------------------------------
@@ -1967,126 +1864,198 @@ static int ft1000_chkcard (struct
ft1000_device *dev) {
 //---------------------------------------------------------------------------
 static void ft1000_hbchk(u_long data)
 {
-    struct ft1000_device *dev = (struct ft1000_device *)data;
-
-    FT1000_INFO *info;
-    USHORT tempword;
-        u16 status;
-	info = (FT1000_INFO *) netdev_priv (dev->net);
-
-    DEBUG("ft1000_hbchk called for CardNumber = %d CardReady = %d\n",
info->CardNumber, info->CardReady);
-
-    if (info->fCondResetPend == 1) {
-        // Reset ASIC and DSP
-        status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0,
(PUCHAR)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX);
-        status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1,
(PUCHAR)&(info->DSP_TIME[1]), FT1000_MAG_DSP_TIMER1_INDX);
-        status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2,
(PUCHAR)&(info->DSP_TIME[2]), FT1000_MAG_DSP_TIMER2_INDX);
-        status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3,
(PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX);
-
-        info->DrvErrNum = DSP_CONDRESET_INFO;
-        DEBUG("ft1000_hw:DSP conditional reset requested\n");
-        ft1000_reset_card(dev->net);
-        info->fCondResetPend = 0;
-        /* Schedule this module to run every 2 seconds */
-
-        poll_timer[info->CardNumber].expires = jiffies + (2*HZ);
-        poll_timer[info->CardNumber].data = (u_long)dev;
-        add_timer(&poll_timer[info->CardNumber]);
-
-
-
-        return;
-    }
+	struct ft1000_device *dev = (struct ft1000_device *)data;
+
+	FT1000_INFO *info;
+	USHORT tempword;
+	u16 status;
+	info = (FT1000_INFO *) netdev_priv(dev->net);
+
+	DEBUG("ft1000_hbchk called for CardNumber = %d CardReady = %d\n",
+	      info->CardNumber, info->CardReady);
+
+	if (info->fCondResetPend == 1) {
+		// Reset ASIC and DSP
+		status =
+		    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0,
+					(PUCHAR) & (info->DSP_TIME[0]),
+					FT1000_MAG_DSP_TIMER0_INDX);
+		status =
+		    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1,
+					(PUCHAR) & (info->DSP_TIME[1]),
+					FT1000_MAG_DSP_TIMER1_INDX);
+		status =
+		    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2,
+					(PUCHAR) & (info->DSP_TIME[2]),
+					FT1000_MAG_DSP_TIMER2_INDX);
+		status =
+		    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3,
+					(PUCHAR) & (info->DSP_TIME[3]),
+					FT1000_MAG_DSP_TIMER3_INDX);
+
+		info->DrvErrNum = DSP_CONDRESET_INFO;
+		DEBUG("ft1000_hw:DSP conditional reset requested\n");
+		ft1000_reset_card(dev->net);
+		info->fCondResetPend = 0;
+		/* Schedule this module to run every 2 seconds */
+
+		poll_timer[info->CardNumber].expires = jiffies + (2 * HZ);
+		poll_timer[info->CardNumber].data = (u_long) dev;
+		add_timer(&poll_timer[info->CardNumber]);
+
+		return;
+	}

-    if (info->CardReady == 1) {
-        // Perform dsp heartbeat check
-            status = ntohs(ft1000_read_dpram16(dev, FT1000_MAG_HI_HO,
(PUCHAR)&tempword, FT1000_MAG_HI_HO_INDX));
-        DEBUG("ft1000_hw:ft1000_hbchk:hi_ho value = 0x%x\n", tempword);
-        // Let's perform another check if ho is not detected
-        if (tempword != ho) {
-              status  = ntohs(ft1000_read_dpram16(dev,
FT1000_MAG_HI_HO, (PUCHAR)&tempword,FT1000_MAG_HI_HO_INDX));
-        }
-        if (tempword != ho) {
-            printk(KERN_INFO "ft1000: heartbeat failed - no ho detected\n");
-                status = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER0, (PUCHAR)&(info->DSP_TIME[0]),
FT1000_MAG_DSP_TIMER0_INDX);
-                status = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER1, (PUCHAR)&(info->DSP_TIME[1]),
FT1000_MAG_DSP_TIMER1_INDX);
-                status = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER2, (PUCHAR)&(info->DSP_TIME[2]),
FT1000_MAG_DSP_TIMER2_INDX);
-                status = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER3, (PUCHAR)&(info->DSP_TIME[3]),
FT1000_MAG_DSP_TIMER3_INDX);
-            info->DrvErrNum = DSP_HB_INFO;
-            if (ft1000_reset_card(dev->net) == 0) {
-               printk(KERN_INFO "ft1000: Hardware Failure Detected -
PC Card disabled\n");
-               info->ProgConStat = 0xff;
-               return;
-            }
-            /* Schedule this module to run every 2 seconds */
-            poll_timer[info->CardNumber].expires = jiffies + (2*HZ);
-            poll_timer[info->CardNumber].data = (u_long)dev;
-            add_timer(&poll_timer[info->CardNumber]);
-            return;
-        }
-
-        status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
-        // Let's check doorbell again if fail
-        if (tempword & FT1000_DB_HB) {
-                status = ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL);
-        }
-        if (tempword & FT1000_DB_HB) {
-            printk(KERN_INFO "ft1000: heartbeat doorbell not clear by
firmware\n");
-            status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0,
(PUCHAR)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX);
-            status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1,
(PUCHAR)&(info->DSP_TIME[1]), FT1000_MAG_DSP_TIMER1_INDX);
-            status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2,
(PUCHAR)&(info->DSP_TIME[2]), FT1000_MAG_DSP_TIMER2_INDX);
-            status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3,
(PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX);
-            info->DrvErrNum = DSP_HB_INFO;
-            if (ft1000_reset_card(dev->net) == 0) {
-               printk(KERN_INFO "ft1000: Hardware Failure Detected -
PC Card disabled\n");
-               info->ProgConStat = 0xff;
-               return;
-            }
-            /* Schedule this module to run every 2 seconds */
-            poll_timer[info->CardNumber].expires = jiffies + (2*HZ);
-            poll_timer[info->CardNumber].data = (u_long)dev;
-            add_timer(&poll_timer[info->CardNumber]);
-            return;
-        }
-
-        // Set dedicated area to hi and ring appropriate doorbell according
-        // to hi/ho heartbeat protocol
-        ft1000_write_dpram16(dev, FT1000_MAG_HI_HO, hi_mag,
FT1000_MAG_HI_HO_INDX);
-
-        status = ntohs(ft1000_read_dpram16(dev, FT1000_MAG_HI_HO,
(PUCHAR)&tempword, FT1000_MAG_HI_HO_INDX));
-        // Let's write hi again if fail
-        if (tempword != hi) {
-               ft1000_write_dpram16(dev, FT1000_MAG_HI_HO, hi_mag,
FT1000_MAG_HI_HO_INDX);
-                   status = ntohs(ft1000_read_dpram16(dev,
FT1000_MAG_HI_HO, (PUCHAR)&tempword, FT1000_MAG_HI_HO_INDX));
-
-        }
-        if (tempword != hi) {
-            printk(KERN_INFO "ft1000: heartbeat failed - cannot write
hi into DPRAM\n");
-            status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0,
(PUCHAR)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX);
-            status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1,
(PUCHAR)&(info->DSP_TIME[1]), FT1000_MAG_DSP_TIMER1_INDX);
-            status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2,
(PUCHAR)&(info->DSP_TIME[2]), FT1000_MAG_DSP_TIMER2_INDX);
-            status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3,
(PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX);
-
-            info->DrvErrNum = DSP_HB_INFO;
-            if (ft1000_reset_card(dev->net) == 0) {
-               printk(KERN_INFO "ft1000: Hardware Failure Detected -
PC Card disabled\n");
-               info->ProgConStat = 0xff;
-               return;
-            }
-            /* Schedule this module to run every 2 seconds */
-            poll_timer[info->CardNumber].expires = jiffies + (2*HZ);
-            poll_timer[info->CardNumber].data = (u_long)dev;
-            add_timer(&poll_timer[info->CardNumber]);
-            return;
-        }
-        ft1000_write_register(dev, FT1000_DB_HB, FT1000_REG_DOORBELL);
+	if (info->CardReady == 1) {
+		// Perform dsp heartbeat check
+		status =
+		    ntohs(ft1000_read_dpram16
+			  (dev, FT1000_MAG_HI_HO, (PUCHAR) & tempword,
+			   FT1000_MAG_HI_HO_INDX));
+		DEBUG("ft1000_hw:ft1000_hbchk:hi_ho value = 0x%x\n", tempword);
+		// Let's perform another check if ho is not detected
+		if (tempword != ho) {
+			status =
+			    ntohs(ft1000_read_dpram16
+				  (dev, FT1000_MAG_HI_HO, (PUCHAR) & tempword,
+				   FT1000_MAG_HI_HO_INDX));
+		}
+		if (tempword != ho) {
+			printk(KERN_INFO
+			       "ft1000: heartbeat failed - no ho detected\n");
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0,
+						(PUCHAR) & (info->DSP_TIME[0]),
+						FT1000_MAG_DSP_TIMER0_INDX);
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1,
+						(PUCHAR) & (info->DSP_TIME[1]),
+						FT1000_MAG_DSP_TIMER1_INDX);
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2,
+						(PUCHAR) & (info->DSP_TIME[2]),
+						FT1000_MAG_DSP_TIMER2_INDX);
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3,
+						(PUCHAR) & (info->DSP_TIME[3]),
+						FT1000_MAG_DSP_TIMER3_INDX);
+			info->DrvErrNum = DSP_HB_INFO;
+			if (ft1000_reset_card(dev->net) == 0) {
+				printk(KERN_INFO
+				       "ft1000: Hardware Failure Detected - PC Card disabled\n");
+				info->ProgConStat = 0xff;
+				return;
+			}
+			/* Schedule this module to run every 2 seconds */
+			poll_timer[info->CardNumber].expires =
+			    jiffies + (2 * HZ);
+			poll_timer[info->CardNumber].data = (u_long) dev;
+			add_timer(&poll_timer[info->CardNumber]);
+			return;
+		}
+
+		status =
+		    ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
+		// Let's check doorbell again if fail
+		if (tempword & FT1000_DB_HB) {
+			status =
+			    ft1000_read_register(dev, &tempword,
+						 FT1000_REG_DOORBELL);
+		}
+		if (tempword & FT1000_DB_HB) {
+			printk(KERN_INFO
+			       "ft1000: heartbeat doorbell not clear by firmware\n");
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0,
+						(PUCHAR) & (info->DSP_TIME[0]),
+						FT1000_MAG_DSP_TIMER0_INDX);
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1,
+						(PUCHAR) & (info->DSP_TIME[1]),
+						FT1000_MAG_DSP_TIMER1_INDX);
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2,
+						(PUCHAR) & (info->DSP_TIME[2]),
+						FT1000_MAG_DSP_TIMER2_INDX);
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3,
+						(PUCHAR) & (info->DSP_TIME[3]),
+						FT1000_MAG_DSP_TIMER3_INDX);
+			info->DrvErrNum = DSP_HB_INFO;
+			if (ft1000_reset_card(dev->net) == 0) {
+				printk(KERN_INFO
+				       "ft1000: Hardware Failure Detected - PC Card disabled\n");
+				info->ProgConStat = 0xff;
+				return;
+			}
+			/* Schedule this module to run every 2 seconds */
+			poll_timer[info->CardNumber].expires =
+			    jiffies + (2 * HZ);
+			poll_timer[info->CardNumber].data = (u_long) dev;
+			add_timer(&poll_timer[info->CardNumber]);
+			return;
+		}
+		// Set dedicated area to hi and ring appropriate doorbell according
+		// to hi/ho heartbeat protocol
+		ft1000_write_dpram16(dev, FT1000_MAG_HI_HO, hi_mag,
+				     FT1000_MAG_HI_HO_INDX);
+
+		status =
+		    ntohs(ft1000_read_dpram16
+			  (dev, FT1000_MAG_HI_HO, (PUCHAR) & tempword,
+			   FT1000_MAG_HI_HO_INDX));
+		// Let's write hi again if fail
+		if (tempword != hi) {
+			ft1000_write_dpram16(dev, FT1000_MAG_HI_HO, hi_mag,
+					     FT1000_MAG_HI_HO_INDX);
+			status =
+			    ntohs(ft1000_read_dpram16
+				  (dev, FT1000_MAG_HI_HO, (PUCHAR) & tempword,
+				   FT1000_MAG_HI_HO_INDX));
+
+		}
+		if (tempword != hi) {
+			printk(KERN_INFO
+			       "ft1000: heartbeat failed - cannot write hi into DPRAM\n");
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0,
+						(PUCHAR) & (info->DSP_TIME[0]),
+						FT1000_MAG_DSP_TIMER0_INDX);
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1,
+						(PUCHAR) & (info->DSP_TIME[1]),
+						FT1000_MAG_DSP_TIMER1_INDX);
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2,
+						(PUCHAR) & (info->DSP_TIME[2]),
+						FT1000_MAG_DSP_TIMER2_INDX);
+			status =
+			    ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3,
+						(PUCHAR) & (info->DSP_TIME[3]),
+						FT1000_MAG_DSP_TIMER3_INDX);
+
+			info->DrvErrNum = DSP_HB_INFO;
+			if (ft1000_reset_card(dev->net) == 0) {
+				printk(KERN_INFO
+				       "ft1000: Hardware Failure Detected - PC Card disabled\n");
+				info->ProgConStat = 0xff;
+				return;
+			}
+			/* Schedule this module to run every 2 seconds */
+			poll_timer[info->CardNumber].expires =
+			    jiffies + (2 * HZ);
+			poll_timer[info->CardNumber].data = (u_long) dev;
+			add_timer(&poll_timer[info->CardNumber]);
+			return;
+		}
+		ft1000_write_register(dev, FT1000_DB_HB, FT1000_REG_DOORBELL);

-    }
+	}

-    /* Schedule this module to run every 2 seconds */
-    poll_timer[info->CardNumber].expires = jiffies + (2*HZ);
-    poll_timer[info->CardNumber].data = (u_long)dev;
-    add_timer(&poll_timer[info->CardNumber]);
+	/* Schedule this module to run every 2 seconds */
+	poll_timer[info->CardNumber].expires = jiffies + (2 * HZ);
+	poll_timer[info->CardNumber].data = (u_long) dev;
+	add_timer(&poll_timer[info->CardNumber]);
 }

 //---------------------------------------------------------------------------
@@ -2102,660 +2071,861 @@ static void ft1000_hbchk(u_long data)
 //          = 1 (successful)
 //
 //---------------------------------------------------------------------------
-BOOLEAN ft1000_receive_cmd (struct ft1000_device *dev, u16 *pbuffer,
int maxsz, u16 *pnxtph) {
-    u16 size, ret;
-    u16 *ppseudohdr;
-    int i;
-    u16 tempword;
-
-    ret = ft1000_read_dpram16(dev, FT1000_MAG_PH_LEN, (PUCHAR)&size,
FT1000_MAG_PH_LEN_INDX);
-    size = ntohs(size) + PSEUDOSZ;
-    if (size > maxsz) {
-        DEBUG("FT1000:ft1000_receive_cmd:Invalid command length = %d\n", size);
-        return FALSE;
-    }
-    else {
-        ppseudohdr = (u16 *)pbuffer;
-        //spin_lock_irqsave (&info->dpram_lock, flags);
-        ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE,
FT1000_REG_DPRAM_ADDR);
-        ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH);
-        //DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer);
-        pbuffer++;
-        ft1000_write_register(dev,  FT1000_DPRAM_MAG_RX_BASE+1,
FT1000_REG_DPRAM_ADDR);
-        for (i=0; i<=(size>>2); i++) {
-            ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAL);
-            pbuffer++;
-            ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH);
-            pbuffer++;
-        }
-        //copy odd aligned word
-        ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAL);
-        //DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer);
-        pbuffer++;
-        ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH);
-        //DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer);
-        pbuffer++;
-        if (size & 0x0001) {
-            //copy odd byte from fifo
-            ret = ft1000_read_register(dev, &tempword, FT1000_REG_DPRAM_DATA);
-            *pbuffer = ntohs(tempword);
-        }
-        //spin_unlock_irqrestore(&info->dpram_lock, flags);
-
-        // Check if pseudo header checksum is good
-        // Calculate pseudo header checksum
-        tempword = *ppseudohdr++;
-        for (i=1; i<7; i++) {
-            tempword ^= *ppseudohdr++;
-        }
-        if ( (tempword != *ppseudohdr) ) {
-            return FALSE;
-        }
-
+BOOLEAN ft1000_receive_cmd(struct ft1000_device * dev, u16 * pbuffer,
int maxsz,
+			   u16 * pnxtph)
+{
+	u16 size, ret;
+	u16 *ppseudohdr;
+	int i;
+	u16 tempword;
+
+	ret =
+	    ft1000_read_dpram16(dev, FT1000_MAG_PH_LEN, (PUCHAR) & size,
+				FT1000_MAG_PH_LEN_INDX);
+	size = ntohs(size) + PSEUDOSZ;
+	if (size > maxsz) {
+		DEBUG("FT1000:ft1000_receive_cmd:Invalid command length = %d\n",
+		      size);
+		return FALSE;
+	} else {
+		ppseudohdr = (u16 *) pbuffer;
+		//spin_lock_irqsave (&info->dpram_lock, flags);
+		ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE,
+				      FT1000_REG_DPRAM_ADDR);
+		ret =
+		    ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH);
+		//DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer);
+		pbuffer++;
+		ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE + 1,
+				      FT1000_REG_DPRAM_ADDR);
+		for (i = 0; i <= (size >> 2); i++) {
+			ret =
+			    ft1000_read_register(dev, pbuffer,
+						 FT1000_REG_MAG_DPDATAL);
+			pbuffer++;
+			ret =
+			    ft1000_read_register(dev, pbuffer,
+						 FT1000_REG_MAG_DPDATAH);
+			pbuffer++;
+		}
+		//copy odd aligned word
+		ret =
+		    ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAL);
+		//DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer);
+		pbuffer++;
+		ret =
+		    ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH);
+		//DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer);
+		pbuffer++;
+		if (size & 0x0001) {
+			//copy odd byte from fifo
+			ret =
+			    ft1000_read_register(dev, &tempword,
+						 FT1000_REG_DPRAM_DATA);
+			*pbuffer = ntohs(tempword);
+		}
+		//spin_unlock_irqrestore(&info->dpram_lock, flags);
+
+		// Check if pseudo header checksum is good
+		// Calculate pseudo header checksum
+		tempword = *ppseudohdr++;
+		for (i = 1; i < 7; i++) {
+			tempword ^= *ppseudohdr++;
+		}
+		if ((tempword != *ppseudohdr)) {
+			return FALSE;
+		}

 #if 0
-        DEBUG("ft1000_receive_cmd:pbuffer\n");
-        for(i = 0; i < size; i+=5)
-        {
-            if( (i + 5) < size )
-                DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
tempbuffer[i], tempbuffer[i+1], tempbuffer[i+2], tempbuffer[i+3],
tempbuffer[i+4]);
-            else
-            {
-                for (j = i; j < size; j++)
-                DEBUG("0x%x ", tempbuffer[j]);
-                DEBUG("\n");
-                break;
-            }
-        }
+		DEBUG("ft1000_receive_cmd:pbuffer\n");
+		for (i = 0; i < size; i += 5) {
+			if ((i + 5) < size)
+				DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
+				      tempbuffer[i], tempbuffer[i + 1],
+				      tempbuffer[i + 2], tempbuffer[i + 3],
+				      tempbuffer[i + 4]);
+			else {
+				for (j = i; j < size; j++)
+					DEBUG("0x%x ", tempbuffer[j]);
+				DEBUG("\n");
+				break;
+			}
+		}

 #endif

-        return TRUE;
-    }
+		return TRUE;
+	}
 }

-
 int ft1000_dsp_prov(void *arg)
 {
-    struct ft1000_device *dev = (struct ft1000_device *)arg;
-	FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev->net);
-    u16 tempword;
-    u16 len;
-    u16 i=0;
-    PPROV_RECORD ptr;
-    PPSEUDO_HDR ppseudo_hdr;
-    PUSHORT pmsg;
-    u16 status;
-    USHORT TempShortBuf [256];
-
-    DEBUG("*** DspProv Entered\n");
-
-    while (         list_empty(&info->prov_list) == 0
-                   /*&&  !kthread_should_stop()  */)
-    {
-	DEBUG("DSP Provisioning List Entry\n");
-
-        // Check if doorbell is available
-        DEBUG("check if doorbell is cleared\n");
-        status = ft1000_read_register (dev, &tempword, FT1000_REG_DOORBELL);
-        if (status)
-	{
-		DEBUG("ft1000_dsp_prov::ft1000_read_register error\n");
-            break;
-        }
-
-        while (tempword & FT1000_DB_DPRAM_TX) {
-            mdelay(10);
-            i++;
-            if (i==10) {
-               DEBUG("FT1000:ft1000_dsp_prov:message drop\n");
-               return STATUS_FAILURE;
-            }
-            ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
-        }
-
-        if ( !(tempword & FT1000_DB_DPRAM_TX) ) {
-            DEBUG("*** Provision Data Sent to DSP\n");
-
-            // Send provisioning data
-            ptr = list_entry(info->prov_list.next, PROV_RECORD, list);
-            len = *(u16 *)ptr->pprov_data;
-            len = htons(len);
-            len += PSEUDOSZ;
-            //len = htons(len);
-
-            pmsg = (PUSHORT)ptr->pprov_data;
-            ppseudo_hdr = (PPSEUDO_HDR)pmsg;
-            // Insert slow queue sequence number
-            ppseudo_hdr->seq_num = info->squeseqnum++;
-            ppseudo_hdr->portsrc = 0;
-            // Calculate new checksum
-            ppseudo_hdr->checksum = *pmsg++;
-            //DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum);
-            for (i=1; i<7; i++) {
-                ppseudo_hdr->checksum ^= *pmsg++;
-                //DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum);
-            }
-
-            TempShortBuf[0] = 0;
-            TempShortBuf[1] = htons (len);
-            memcpy(&TempShortBuf[2], ppseudo_hdr, len);
-
-            status = ft1000_write_dpram32 (dev, 0,
(PUCHAR)&TempShortBuf[0], (unsigned short)(len+2));
-            status = ft1000_write_register (dev, FT1000_DB_DPRAM_TX,
FT1000_REG_DOORBELL);
-
-            list_del(&ptr->list);
-            kfree(ptr->pprov_data);
-            kfree(ptr);
-        }
-        msleep(10);
-    }
+	struct ft1000_device *dev = (struct ft1000_device *)arg;
+	FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev->net);
+	u16 tempword;
+	u16 len;
+	u16 i = 0;
+	PPROV_RECORD ptr;
+	PPSEUDO_HDR ppseudo_hdr;
+	PUSHORT pmsg;
+	u16 status;
+	USHORT TempShortBuf[256];
+
+	DEBUG("*** DspProv Entered\n");
+
+	while (list_empty(&info->prov_list) == 0
+	       /*&&  !kthread_should_stop()  */ ) {
+		DEBUG("DSP Provisioning List Entry\n");
+
+		// Check if doorbell is available
+		DEBUG("check if doorbell is cleared\n");
+		status =
+		    ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
+		if (status) {
+			DEBUG("ft1000_dsp_prov::ft1000_read_register error\n");
+			break;
+		}
+
+		while (tempword & FT1000_DB_DPRAM_TX) {
+			mdelay(10);
+			i++;
+			if (i == 10) {
+				DEBUG("FT1000:ft1000_dsp_prov:message drop\n");
+				return STATUS_FAILURE;
+			}
+			ft1000_read_register(dev, &tempword,
+					     FT1000_REG_DOORBELL);
+		}
+
+		if (!(tempword & FT1000_DB_DPRAM_TX)) {
+			DEBUG("*** Provision Data Sent to DSP\n");
+
+			// Send provisioning data
+			ptr =
+			    list_entry(info->prov_list.next, PROV_RECORD, list);
+			len = *(u16 *) ptr->pprov_data;
+			len = htons(len);
+			len += PSEUDOSZ;
+			//len = htons(len);
+
+			pmsg = (PUSHORT) ptr->pprov_data;
+			ppseudo_hdr = (PPSEUDO_HDR) pmsg;
+			// Insert slow queue sequence number
+			ppseudo_hdr->seq_num = info->squeseqnum++;
+			ppseudo_hdr->portsrc = 0;
+			// Calculate new checksum
+			ppseudo_hdr->checksum = *pmsg++;
+			//DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum);
+			for (i = 1; i < 7; i++) {
+				ppseudo_hdr->checksum ^= *pmsg++;
+				//DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum);
+			}
+
+			TempShortBuf[0] = 0;
+			TempShortBuf[1] = htons(len);
+			memcpy(&TempShortBuf[2], ppseudo_hdr, len);
+
+			status =
+			    ft1000_write_dpram32(dev, 0,
+						 (PUCHAR) & TempShortBuf[0],
+						 (unsigned short)(len + 2));
+			status =
+			    ft1000_write_register(dev, FT1000_DB_DPRAM_TX,
+						  FT1000_REG_DOORBELL);
+
+			list_del(&ptr->list);
+			kfree(ptr->pprov_data);
+			kfree(ptr);
+		}
+		msleep(10);
+	}

-    DEBUG("DSP Provisioning List Entry finished\n");
+	DEBUG("DSP Provisioning List Entry finished\n");

-    msleep(100);
+	msleep(100);

-    info->fProvComplete = 1;
-    info->CardReady = 1;
-    info->DSP_loading= 0;
-    return STATUS_SUCCESS;
+	info->fProvComplete = 1;
+	info->CardReady = 1;
+	info->DSP_loading = 0;
+	return STATUS_SUCCESS;

 }

-
-int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
-	FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev->net);
-    u16 msgtype;
-    u16 tempword;
-    PMEDIAMSG pmediamsg;
-    PDSPINITMSG pdspinitmsg;
-    PDRVMSG pdrvmsg;
-    u16 i;
-    PPSEUDO_HDR ppseudo_hdr;
-    PUSHORT pmsg;
-    u16 status;
-    //struct timeval tv; //mbelian
-    union {
-        u8  byte[2];
-        u16 wrd;
-    } convert;
-
-
-    char cmdbuffer[1600];
-
-    status = ft1000_read_dpram32(dev, 0x200, (PUCHAR)&cmdbuffer[0], size);
-
-
-    //if (ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword))
-    {
+int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size)
+{
+	FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev->net);
+	u16 msgtype;
+	u16 tempword;
+	PMEDIAMSG pmediamsg;
+	PDSPINITMSG pdspinitmsg;
+	PDRVMSG pdrvmsg;
+	u16 i;
+	PPSEUDO_HDR ppseudo_hdr;
+	PUSHORT pmsg;
+	u16 status;
+	//struct timeval tv; //mbelian
+	union {
+		u8 byte[2];
+		u16 wrd;
+	} convert;
+
+	char cmdbuffer[1600];
+
+	status = ft1000_read_dpram32(dev, 0x200, (PUCHAR) & cmdbuffer[0], size);
+
+	//if (ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword))
+	{

 #ifdef JDEBUG
-        DEBUG("ft1000_proc_drvmsg:cmdbuffer\n");
-        for(i = 0; i < size; i+=5)
-        {
-            if( (i + 5) < size )
-                DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", cmdbuffer[i],
cmdbuffer[i+1], cmdbuffer[i+2], cmdbuffer[i+3], cmdbuffer[i+4]);
-            else
-            {
-                for (j = i; j < size; j++)
-                DEBUG("0x%x ", cmdbuffer[j]);
-                DEBUG("\n");
-                break;
-            }
-        }
+		DEBUG("ft1000_proc_drvmsg:cmdbuffer\n");
+		for (i = 0; i < size; i += 5) {
+			if ((i + 5) < size)
+				DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
+				      cmdbuffer[i], cmdbuffer[i + 1],
+				      cmdbuffer[i + 2], cmdbuffer[i + 3],
+				      cmdbuffer[i + 4]);
+			else {
+				for (j = i; j < size; j++)
+					DEBUG("0x%x ", cmdbuffer[j]);
+				DEBUG("\n");
+				break;
+			}
+		}
 #endif
-        pdrvmsg = (PDRVMSG)&cmdbuffer[2];
-        msgtype = ntohs(pdrvmsg->type);
-        DEBUG("ft1000_proc_drvmsg:Command message type = 0x%x\n", msgtype);
-        switch (msgtype) {
-            case MEDIA_STATE: {
-                DEBUG("ft1000_proc_drvmsg:Command message type = MEDIA_STATE");
-
-                pmediamsg = (PMEDIAMSG)&cmdbuffer[0];
-                if (info->ProgConStat != 0xFF) {
-                    if (pmediamsg->state) {
-                        DEBUG("Media is up\n");
-                        if (info->mediastate == 0) {
-                            if ( info->NetDevRegDone )
-                            {
-                                //netif_carrier_on(dev->net);//mbelian
-                                netif_wake_queue(dev->net);
-                            }
-                            info->mediastate = 1;
-                            /*do_gettimeofday(&tv);
-                            info->ConTm = tv.tv_sec;*/ //mbelian
-                        }
-                    }
-                    else {
-                        DEBUG("Media is down\n");
-                        if (info->mediastate == 1) {
-                            info->mediastate = 0;
-                            if ( info->NetDevRegDone )
-                            {
-                                //netif_carrier_off(dev->net); mbelian
-                                //netif_stop_queue(dev->net);
-                            }
-                            info->ConTm = 0;
-                        }
-                    }
-                }
-                else {
-                    DEBUG("Media is down\n");
-                    if (info->mediastate == 1) {
-                        info->mediastate = 0;
-                        if ( info->NetDevRegDone)
-                        {
-                            //netif_carrier_off(dev->net); //mbelian
-                            //netif_stop_queue(dev->net);
-                        }
-                        info->ConTm = 0;
-                    }
-                }
-                break;
-            }
-            case DSP_INIT_MSG: {
-                DEBUG("ft1000_proc_drvmsg:Command message type =
DSP_INIT_MSG");
-
-                pdspinitmsg = (PDSPINITMSG)&cmdbuffer[2];
-                memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ);
-                DEBUG("DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n",
info->DspVer[0], info->DspVer[1], info->DspVer[2], info->DspVer[3]);
-                memcpy(info->HwSerNum, pdspinitmsg->HwSerNum, HWSERNUMSZ);
-                memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ);
-                memcpy(info->eui64, pdspinitmsg->eui64, EUISZ);
-                DEBUG("EUI64=%2x.%2x.%2x.%2x.%2x.%2x.%2x.%2x\n",
info->eui64[0],info->eui64[1], info->eui64[2], info->eui64[3],
info->eui64[4], info->eui64[5],info->eui64[6], info->eui64[7]);
-                dev->net->dev_addr[0] = info->eui64[0];
-                dev->net->dev_addr[1] = info->eui64[1];
-                dev->net->dev_addr[2] = info->eui64[2];
-                dev->net->dev_addr[3] = info->eui64[5];
-                dev->net->dev_addr[4] = info->eui64[6];
-                dev->net->dev_addr[5] = info->eui64[7];
-
-                if (ntohs(pdspinitmsg->length) == (sizeof(DSPINITMSG) - 20) ) {
-                    memcpy(info->ProductMode,
pdspinitmsg->ProductMode, MODESZ);
-                    memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, CALVERSZ);
-                    memcpy(info->RfCalDate, pdspinitmsg->RfCalDate, CALDATESZ);
-                    DEBUG("RFCalVer = 0x%2x 0x%2x\n",
info->RfCalVer[0], info->RfCalVer[1]);
-                }
-                break;
-            }
-            case DSP_PROVISION: {
-                DEBUG("ft1000_proc_drvmsg:Command message type =
DSP_PROVISION\n");
-
-                // kick off dspprov routine to start provisioning
-                // Send provisioning data to DSP
-                if (list_empty(&info->prov_list) == 0)
-                {
-		    info->fProvComplete = 0;
-		    status = ft1000_dsp_prov(dev);
-		    if (status != STATUS_SUCCESS)
-		        return status;
-                }
-                else {
-                    info->fProvComplete = 1;
-                    status = ft1000_write_register (dev,
FT1000_DB_HB, FT1000_REG_DOORBELL);
-                    DEBUG("FT1000:drivermsg:No more DSP provisioning
data in dsp image\n");
-                }
-                DEBUG("ft1000_proc_drvmsg:DSP PROVISION is done\n");
-                break;
-            }
-            case DSP_STORE_INFO: {
-                DEBUG("ft1000_proc_drvmsg:Command message type =
DSP_STORE_INFO");
-
-                DEBUG("FT1000:drivermsg:Got DSP_STORE_INFO\n");
-                tempword = ntohs(pdrvmsg->length);
-                info->DSPInfoBlklen = tempword;
-                if (tempword < (MAX_DSP_SESS_REC-4) ) {
-                    pmsg = (PUSHORT)&pdrvmsg->data[0];
-                    for (i=0; i<((tempword+1)/2); i++) {
-                        DEBUG("FT1000:drivermsg:dsp info data =
0x%x\n", *pmsg);
-                        info->DSPInfoBlk[i+10] = *pmsg++;
-                    }
-                }
-                else {
-                    info->DSPInfoBlklen = 0;
-                }
-                break;
-            }
-            case DSP_GET_INFO: {
-                DEBUG("FT1000:drivermsg:Got DSP_GET_INFO\n");
-                // copy dsp info block to dsp
-                info->DrvMsgPend = 1;
-                // allow any outstanding ioctl to finish
-                mdelay(10);
-                status = ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL);
-                if (tempword & FT1000_DB_DPRAM_TX) {
-                    mdelay(10);
-                    status = ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL);
-                    if (tempword & FT1000_DB_DPRAM_TX) {
-                        mdelay(10);
-                            status = ft1000_read_register(dev,
&tempword, FT1000_REG_DOORBELL);
-                            if (tempword & FT1000_DB_DPRAM_TX) {
-                                break;
-                            }
-                    }
-                }
-
-                // Put message into Slow Queue
-                // Form Pseudo header
-                pmsg = (PUSHORT)info->DSPInfoBlk;
-                *pmsg++ = 0;
-                *pmsg++ = htons(info->DSPInfoBlklen+20+info->DSPInfoBlklen);
-                ppseudo_hdr = (PPSEUDO_HDR)(PUSHORT)&info->DSPInfoBlk[2];
-                ppseudo_hdr->length =
htons(info->DSPInfoBlklen+4+info->DSPInfoBlklen);
-                ppseudo_hdr->source = 0x10;
-                ppseudo_hdr->destination = 0x20;
-                ppseudo_hdr->portdest = 0;
-                ppseudo_hdr->portsrc = 0;
-                ppseudo_hdr->sh_str_id = 0;
-                ppseudo_hdr->control = 0;
-                ppseudo_hdr->rsvd1 = 0;
-                ppseudo_hdr->rsvd2 = 0;
-                ppseudo_hdr->qos_class = 0;
-                // Insert slow queue sequence number
-                ppseudo_hdr->seq_num = info->squeseqnum++;
-                // Insert application id
-                ppseudo_hdr->portsrc = 0;
-                // Calculate new checksum
-                ppseudo_hdr->checksum = *pmsg++;
-                for (i=1; i<7; i++) {
-                    ppseudo_hdr->checksum ^= *pmsg++;
-                }
-                info->DSPInfoBlk[10] = 0x7200;
-                info->DSPInfoBlk[11] = htons(info->DSPInfoBlklen);
-                status = ft1000_write_dpram32 (dev, 0,
(PUCHAR)&info->DSPInfoBlk[0], (unsigned
short)(info->DSPInfoBlklen+22));
-                status = ft1000_write_register (dev,
FT1000_DB_DPRAM_TX, FT1000_REG_DOORBELL);
-                info->DrvMsgPend = 0;
-
-                break;
-            }
-
-          case GET_DRV_ERR_RPT_MSG: {
-              DEBUG("FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n");
-              // copy driver error message to dsp
-              info->DrvMsgPend = 1;
-              // allow any outstanding ioctl to finish
-              mdelay(10);
-              status = ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL);
-              if (tempword & FT1000_DB_DPRAM_TX) {
-                  mdelay(10);
-                  status = ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL);
-                  if (tempword & FT1000_DB_DPRAM_TX) {
-                      mdelay(10);
-                  }
-              }
-
-              if ( (tempword & FT1000_DB_DPRAM_TX) == 0) {
-                  // Put message into Slow Queue
-                  // Form Pseudo header
-                  pmsg = (PUSHORT)&tempbuffer[0];
-                  ppseudo_hdr = (PPSEUDO_HDR)pmsg;
-                  ppseudo_hdr->length = htons(0x0012);
-                  ppseudo_hdr->source = 0x10;
-                  ppseudo_hdr->destination = 0x20;
-                  ppseudo_hdr->portdest = 0;
-                  ppseudo_hdr->portsrc = 0;
-                  ppseudo_hdr->sh_str_id = 0;
-                  ppseudo_hdr->control = 0;
-                  ppseudo_hdr->rsvd1 = 0;
-                  ppseudo_hdr->rsvd2 = 0;
-                  ppseudo_hdr->qos_class = 0;
-                  // Insert slow queue sequence number
-                  ppseudo_hdr->seq_num = info->squeseqnum++;
-                  // Insert application id
-                  ppseudo_hdr->portsrc = 0;
-                  // Calculate new checksum
-                  ppseudo_hdr->checksum = *pmsg++;
-                  for (i=1; i<7; i++) {
-                      ppseudo_hdr->checksum ^= *pmsg++;
-                  }
-                  pmsg = (PUSHORT)&tempbuffer[16];
-                  *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG);
-                  *pmsg++ = htons(0x000e);
-                  *pmsg++ = htons(info->DSP_TIME[0]);
-                  *pmsg++ = htons(info->DSP_TIME[1]);
-                  *pmsg++ = htons(info->DSP_TIME[2]);
-                  *pmsg++ = htons(info->DSP_TIME[3]);
-                  convert.byte[0] = info->DspVer[0];
-                  convert.byte[1] = info->DspVer[1];
-                  *pmsg++ = convert.wrd;
-                  convert.byte[0] = info->DspVer[2];
-                  convert.byte[1] = info->DspVer[3];
-                  *pmsg++ = convert.wrd;
-                  *pmsg++ = htons(info->DrvErrNum);
-
-                  CardSendCommand (dev, (unsigned
char*)&tempbuffer[0], (USHORT)(0x0012 + PSEUDOSZ));
-                  info->DrvErrNum = 0;
-              }
-              info->DrvMsgPend = 0;
-
-          break;
-      }
-
-      default:
-          break;
-        }
+		pdrvmsg = (PDRVMSG) & cmdbuffer[2];
+		msgtype = ntohs(pdrvmsg->type);
+		DEBUG("ft1000_proc_drvmsg:Command message type = 0x%x\n",
+		      msgtype);
+		switch (msgtype) {
+		case MEDIA_STATE:{
+				DEBUG
+				    ("ft1000_proc_drvmsg:Command message type = MEDIA_STATE");
+
+				pmediamsg = (PMEDIAMSG) & cmdbuffer[0];
+				if (info->ProgConStat != 0xFF) {
+					if (pmediamsg->state) {
+						DEBUG("Media is up\n");
+						if (info->mediastate == 0) {
+							if (info->NetDevRegDone) {
+								//netif_carrier_on(dev->net);//mbelian
+								netif_wake_queue
+								    (dev->net);
+							}
+							info->mediastate = 1;
+							/*do_gettimeofday(&tv);
+							   info->ConTm = tv.tv_sec; *///mbelian
+						}
+					} else {
+						DEBUG("Media is down\n");
+						if (info->mediastate == 1) {
+							info->mediastate = 0;
+							if (info->NetDevRegDone) {
+								//netif_carrier_off(dev->net); mbelian
+								//netif_stop_queue(dev->net);
+							}
+							info->ConTm = 0;
+						}
+					}
+				} else {
+					DEBUG("Media is down\n");
+					if (info->mediastate == 1) {
+						info->mediastate = 0;
+						if (info->NetDevRegDone) {
+							//netif_carrier_off(dev->net); //mbelian
+							//netif_stop_queue(dev->net);
+						}
+						info->ConTm = 0;
+					}
+				}
+				break;
+			}
+		case DSP_INIT_MSG:{
+				DEBUG
+				    ("ft1000_proc_drvmsg:Command message type = DSP_INIT_MSG");
+
+				pdspinitmsg = (PDSPINITMSG) & cmdbuffer[2];
+				memcpy(info->DspVer, pdspinitmsg->DspVer,
+				       DSPVERSZ);
+				DEBUG("DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n",
+				      info->DspVer[0], info->DspVer[1],
+				      info->DspVer[2], info->DspVer[3]);
+				memcpy(info->HwSerNum, pdspinitmsg->HwSerNum,
+				       HWSERNUMSZ);
+				memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ);
+				memcpy(info->eui64, pdspinitmsg->eui64, EUISZ);
+				DEBUG("EUI64=%2x.%2x.%2x.%2x.%2x.%2x.%2x.%2x\n",
+				      info->eui64[0], info->eui64[1],
+				      info->eui64[2], info->eui64[3],
+				      info->eui64[4], info->eui64[5],
+				      info->eui64[6], info->eui64[7]);
+				dev->net->dev_addr[0] = info->eui64[0];
+				dev->net->dev_addr[1] = info->eui64[1];
+				dev->net->dev_addr[2] = info->eui64[2];
+				dev->net->dev_addr[3] = info->eui64[5];
+				dev->net->dev_addr[4] = info->eui64[6];
+				dev->net->dev_addr[5] = info->eui64[7];
+
+				if (ntohs(pdspinitmsg->length) ==
+				    (sizeof(DSPINITMSG) - 20)) {
+					memcpy(info->ProductMode,
+					       pdspinitmsg->ProductMode,
+					       MODESZ);
+					memcpy(info->RfCalVer,
+					       pdspinitmsg->RfCalVer, CALVERSZ);
+					memcpy(info->RfCalDate,
+					       pdspinitmsg->RfCalDate,
+					       CALDATESZ);
+					DEBUG("RFCalVer = 0x%2x 0x%2x\n",
+					      info->RfCalVer[0],
+					      info->RfCalVer[1]);
+				}
+				break;
+			}
+		case DSP_PROVISION:{
+				DEBUG
+				    ("ft1000_proc_drvmsg:Command message type = DSP_PROVISION\n");
+
+				// kick off dspprov routine to start provisioning
+				// Send provisioning data to DSP
+				if (list_empty(&info->prov_list) == 0) {
+					info->fProvComplete = 0;
+					status = ft1000_dsp_prov(dev);
+					if (status != STATUS_SUCCESS)
+						return status;
+				} else {
+					info->fProvComplete = 1;
+					status =
+					    ft1000_write_register(dev,
+								  FT1000_DB_HB,
+								  FT1000_REG_DOORBELL);
+					DEBUG
+					    ("FT1000:drivermsg:No more DSP provisioning data in dsp image\n");
+				}
+				DEBUG
+				    ("ft1000_proc_drvmsg:DSP PROVISION is done\n");
+				break;
+			}
+		case DSP_STORE_INFO:{
+				DEBUG
+				    ("ft1000_proc_drvmsg:Command message type = DSP_STORE_INFO");
+
+				DEBUG("FT1000:drivermsg:Got DSP_STORE_INFO\n");
+				tempword = ntohs(pdrvmsg->length);
+				info->DSPInfoBlklen = tempword;
+				if (tempword < (MAX_DSP_SESS_REC - 4)) {
+					pmsg = (PUSHORT) & pdrvmsg->data[0];
+					for (i = 0; i < ((tempword + 1) / 2);
+					     i++) {
+						DEBUG
+						    ("FT1000:drivermsg:dsp info data = 0x%x\n",
+						     *pmsg);
+						info->DSPInfoBlk[i + 10] =
+						    *pmsg++;
+					}
+				} else {
+					info->DSPInfoBlklen = 0;
+				}
+				break;
+			}
+		case DSP_GET_INFO:{
+				DEBUG("FT1000:drivermsg:Got DSP_GET_INFO\n");
+				// copy dsp info block to dsp
+				info->DrvMsgPend = 1;
+				// allow any outstanding ioctl to finish
+				mdelay(10);
+				status =
+				    ft1000_read_register(dev, &tempword,
+							 FT1000_REG_DOORBELL);
+				if (tempword & FT1000_DB_DPRAM_TX) {
+					mdelay(10);
+					status =
+					    ft1000_read_register(dev, &tempword,
+								 FT1000_REG_DOORBELL);
+					if (tempword & FT1000_DB_DPRAM_TX) {
+						mdelay(10);
+						status =
+						    ft1000_read_register(dev,
+									 &tempword,
+									 FT1000_REG_DOORBELL);
+						if (tempword &
+						    FT1000_DB_DPRAM_TX) {
+							break;
+						}
+					}
+				}
+				// Put message into Slow Queue
+				// Form Pseudo header
+				pmsg = (PUSHORT) info->DSPInfoBlk;
+				*pmsg++ = 0;
+				*pmsg++ =
+				    htons(info->DSPInfoBlklen + 20 +
+					  info->DSPInfoBlklen);
+				ppseudo_hdr =
+				    (PPSEUDO_HDR) (PUSHORT) & info->
+				    DSPInfoBlk[2];
+				ppseudo_hdr->length =
+				    htons(info->DSPInfoBlklen + 4 +
+					  info->DSPInfoBlklen);
+				ppseudo_hdr->source = 0x10;
+				ppseudo_hdr->destination = 0x20;
+				ppseudo_hdr->portdest = 0;
+				ppseudo_hdr->portsrc = 0;
+				ppseudo_hdr->sh_str_id = 0;
+				ppseudo_hdr->control = 0;
+				ppseudo_hdr->rsvd1 = 0;
+				ppseudo_hdr->rsvd2 = 0;
+				ppseudo_hdr->qos_class = 0;
+				// Insert slow queue sequence number
+				ppseudo_hdr->seq_num = info->squeseqnum++;
+				// Insert application id
+				ppseudo_hdr->portsrc = 0;
+				// Calculate new checksum
+				ppseudo_hdr->checksum = *pmsg++;
+				for (i = 1; i < 7; i++) {
+					ppseudo_hdr->checksum ^= *pmsg++;
+				}
+				info->DSPInfoBlk[10] = 0x7200;
+				info->DSPInfoBlk[11] =
+				    htons(info->DSPInfoBlklen);
+				status =
+				    ft1000_write_dpram32(dev, 0,
+							 (PUCHAR) & info->
+							 DSPInfoBlk[0],
+							 (unsigned short)(info->
+									  DSPInfoBlklen
+									  +
+									  22));
+				status =
+				    ft1000_write_register(dev,
+							  FT1000_DB_DPRAM_TX,
+							  FT1000_REG_DOORBELL);
+				info->DrvMsgPend = 0;
+
+				break;
+			}
+
+		case GET_DRV_ERR_RPT_MSG:{
+				DEBUG
+				    ("FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n");
+				// copy driver error message to dsp
+				info->DrvMsgPend = 1;
+				// allow any outstanding ioctl to finish
+				mdelay(10);
+				status =
+				    ft1000_read_register(dev, &tempword,
+							 FT1000_REG_DOORBELL);
+				if (tempword & FT1000_DB_DPRAM_TX) {
+					mdelay(10);
+					status =
+					    ft1000_read_register(dev, &tempword,
+								 FT1000_REG_DOORBELL);
+					if (tempword & FT1000_DB_DPRAM_TX) {
+						mdelay(10);
+					}
+				}
+
+				if ((tempword & FT1000_DB_DPRAM_TX) == 0) {
+					// Put message into Slow Queue
+					// Form Pseudo header
+					pmsg = (PUSHORT) & tempbuffer[0];
+					ppseudo_hdr = (PPSEUDO_HDR) pmsg;
+					ppseudo_hdr->length = htons(0x0012);
+					ppseudo_hdr->source = 0x10;
+					ppseudo_hdr->destination = 0x20;
+					ppseudo_hdr->portdest = 0;
+					ppseudo_hdr->portsrc = 0;
+					ppseudo_hdr->sh_str_id = 0;
+					ppseudo_hdr->control = 0;
+					ppseudo_hdr->rsvd1 = 0;
+					ppseudo_hdr->rsvd2 = 0;
+					ppseudo_hdr->qos_class = 0;
+					// Insert slow queue sequence number
+					ppseudo_hdr->seq_num =
+					    info->squeseqnum++;
+					// Insert application id
+					ppseudo_hdr->portsrc = 0;
+					// Calculate new checksum
+					ppseudo_hdr->checksum = *pmsg++;
+					for (i = 1; i < 7; i++) {
+						ppseudo_hdr->checksum ^=
+						    *pmsg++;
+					}
+					pmsg = (PUSHORT) & tempbuffer[16];
+					*pmsg++ = htons(RSP_DRV_ERR_RPT_MSG);
+					*pmsg++ = htons(0x000e);
+					*pmsg++ = htons(info->DSP_TIME[0]);
+					*pmsg++ = htons(info->DSP_TIME[1]);
+					*pmsg++ = htons(info->DSP_TIME[2]);
+					*pmsg++ = htons(info->DSP_TIME[3]);
+					convert.byte[0] = info->DspVer[0];
+					convert.byte[1] = info->DspVer[1];
+					*pmsg++ = convert.wrd;
+					convert.byte[0] = info->DspVer[2];
+					convert.byte[1] = info->DspVer[3];
+					*pmsg++ = convert.wrd;
+					*pmsg++ = htons(info->DrvErrNum);
+
+					CardSendCommand(dev,
+							(unsigned char *)
+							&tempbuffer[0],
+							(USHORT) (0x0012 +
+								  PSEUDOSZ));
+					info->DrvErrNum = 0;
+				}
+				info->DrvMsgPend = 0;
+
+				break;
+			}
+
+		default:
+			break;
+		}

-    }
+	}

-    DEBUG("return from ft1000_proc_drvmsg\n");
-    return STATUS_SUCCESS;
+	DEBUG("return from ft1000_proc_drvmsg\n");
+	return STATUS_SUCCESS;
 }

+int ft1000_poll(void *dev_id)
+{

+	//FT1000_INFO *info = (PFT1000_INFO)((struct net_device *)dev_id)->priv;
+	//struct ft1000_device *dev = (struct ft1000_device *)info->pFt1000Dev;
+	struct ft1000_device *dev = (struct ft1000_device *)dev_id;
+	FT1000_INFO *info = (FT1000_INFO *) netdev_priv(dev->net);
+
+	u16 tempword;
+	u16 status;
+	u16 size;
+	int i;
+	USHORT data;
+	USHORT modulo;
+	USHORT portid;
+	u16 nxtph;
+	PDPRAM_BLK pdpram_blk;
+	PPSEUDO_HDR ppseudo_hdr;
+	unsigned long flags;
+
+	//DEBUG("Enter ft1000_poll...\n");
+	if (ft1000_chkcard(dev) == FALSE) {
+		DEBUG("ft1000_poll::ft1000_chkcard: failed\n");
+		return STATUS_FAILURE;
+	}

-int ft1000_poll(void* dev_id) {
-
-    //FT1000_INFO *info = (PFT1000_INFO)((struct net_device *)dev_id)->priv;
-    //struct ft1000_device *dev = (struct ft1000_device *)info->pFt1000Dev;
-    struct ft1000_device *dev = (struct ft1000_device *)dev_id;
-	FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev->net);
-
-    u16 tempword;
-    u16 status;
-    u16 size;
-    int i;
-    USHORT data;
-    USHORT modulo;
-    USHORT portid;
-    u16 nxtph;
-    PDPRAM_BLK pdpram_blk;
-    PPSEUDO_HDR ppseudo_hdr;
-    unsigned long flags;
-
-    //DEBUG("Enter ft1000_poll...\n");
-    if (ft1000_chkcard(dev) == FALSE) {
-        DEBUG("ft1000_poll::ft1000_chkcard: failed\n");
-        return STATUS_FAILURE;
-    }
-
-    status = ft1000_read_register (dev, &tempword, FT1000_REG_DOORBELL);
-   // DEBUG("ft1000_poll: read FT1000_REG_DOORBELL message 0x%x\n", tempword);
-
-    //while ( (tempword) && (!status) ) {
-    if ( !status )
-    {
-
-        if (tempword & FT1000_DB_DPRAM_RX) {
-            //DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_DB_DPRAM_RX\n");
-
-            status = ft1000_read_dpram16(dev, 0x200, (PUCHAR)&data, 0);
-            //DEBUG("ft1000_poll:FT1000_DB_DPRAM_RX:ft1000_read_dpram16:size
= 0x%x\n", data);
-            size = ntohs(data) + 16 + 2; //wai
-            if (size % 4) {
-                modulo = 4 - (size % 4);
-                size = size + modulo;
-            }
-            status = ft1000_read_dpram16(dev, 0x201, (PUCHAR)&portid, 1);
-            portid &= 0xff;
-            //DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_DB_DPRAM_RX : portid 0x%x\n", portid);
-
-            if (size < MAX_CMD_SQSIZE) {
-                switch (portid)
-                {
-                    case DRIVERID:
-                        DEBUG("ft1000_poll: FT1000_REG_DOORBELL
message type: FT1000_DB_DPRAM_RX : portid DRIVERID\n");
-
-                        status = ft1000_proc_drvmsg (dev, size);
-                        if (status != STATUS_SUCCESS )
-                            return status;
-                        break;
-                    case DSPBCMSGID:
-                        // This is a dsp broadcast message
-                        // Check which application has registered for
dsp broadcast messages
-                        //DEBUG("ft1000_poll: FT1000_REG_DOORBELL
message type: FT1000_DB_DPRAM_RX : portid DSPBCMSGID\n");
-
-    	    	        for (i=0; i<MAX_NUM_APP; i++) {
-        	           if ( (info->app_info[i].DspBCMsgFlag) &&
(info->app_info[i].fileobject) &&
-                                         (info->app_info[i].NumOfMsg
< MAX_MSG_LIMIT)  )
-			   {
-			       //DEBUG("Dsp broadcast message detected for app id %d\n", i);
-			       nxtph = FT1000_DPRAM_RX_BASE + 2;
-			       pdpram_blk = ft1000_get_buffer (&freercvpool);
-			       if (pdpram_blk != NULL) {
-			           if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer,
MAX_CMD_SQSIZE, &nxtph) ) {
-				       ppseudo_hdr = (PPSEUDO_HDR)pdpram_blk->pbuffer;
-				       // Put message into the appropriate application block
-				       info->app_info[i].nRxMsg++;
-				       spin_lock_irqsave(&free_buff_lock, flags);
-				       list_add_tail(&pdpram_blk->list, &info->app_info[i].app_sqlist);
-				       info->app_info[i].NumOfMsg++;
-				       spin_unlock_irqrestore(&free_buff_lock, flags);
-				       wake_up_interruptible(&info->app_info[i].wait_dpram_msg);
-                                   }
-                                   else {
-				       info->app_info[i].nRxMsgMiss++;
-				       // Put memory back to free pool
-				       ft1000_free_buffer(pdpram_blk, &freercvpool);
-				       DEBUG("pdpram_blk::ft1000_get_buffer NULL\n");
-                                   }
-                               }
-                               else {
-                                   DEBUG("Out of memory in free
receive command pool\n");
-                                   info->app_info[i].nRxMsgMiss++;
-                               }//endof if (pdpram_blk != NULL)
-                           }//endof if
-    		           //else
-    		           //    DEBUG("app_info mismatch\n");
-	                }// endof for
-                        break;
-                    default:
-                        pdpram_blk = ft1000_get_buffer (&freercvpool);
-                        //DEBUG("Memory allocated = 0x%8x\n", (u32)pdpram_blk);
-                        if (pdpram_blk != NULL) {
-                           if ( ft1000_receive_cmd(dev,
pdpram_blk->pbuffer, MAX_CMD_SQSIZE, &nxtph) ) {
-                               ppseudo_hdr = (PPSEUDO_HDR)pdpram_blk->pbuffer;
-                               // Search for correct application block
-                               for (i=0; i<MAX_NUM_APP; i++) {
-                                   if (info->app_info[i].app_id ==
ppseudo_hdr->portdest) {
-                                       break;
-                                   }
-                               }
-
-                               if (i==(MAX_NUM_APP-1)) {		// aelias
[+] reason: was out of array boundary
-                                   info->app_info[i].nRxMsgMiss++;
-
DEBUG("FT1000:ft1000_parse_dpram_msg: No application matching id =
%d\n", ppseudo_hdr->portdest);
-                                   // Put memory back to free pool
-                                   ft1000_free_buffer(pdpram_blk,
&freercvpool);
-                               }
-                               else {
-                                   if (info->app_info[i].NumOfMsg >
MAX_MSG_LIMIT) {
-	                               // Put memory back to free pool
-	                               ft1000_free_buffer(pdpram_blk, &freercvpool);
-                                   }
-                                   else {
-                                       info->app_info[i].nRxMsg++;
-                                       // Put message into the
appropriate application block
-                                       //pxu
spin_lock_irqsave(&free_buff_lock, flags);
-
list_add_tail(&pdpram_blk->list, &info->app_info[i].app_sqlist);
-            			       info->app_info[i].NumOfMsg++;
-                                       //pxu
spin_unlock_irqrestore(&free_buff_lock, flags);
-                                       //pxu
wake_up_interruptible(&info->app_info[i].wait_dpram_msg);
-                                   }
-                               }
-                           }
-                           else {
-                               // Put memory back to free pool
-                               ft1000_free_buffer(pdpram_blk, &freercvpool);
-                           }
-                        }
-                        else {
-                            DEBUG("Out of memory in free receive
command pool\n");
-                        }
-                        break;
-                } //end of switch
-            } //endof if (size < MAX_CMD_SQSIZE)
-            else {
-                DEBUG("FT1000:dpc:Invalid total length for SlowQ =
%d\n", size);
-            }
-            status = ft1000_write_register (dev, FT1000_DB_DPRAM_RX,
FT1000_REG_DOORBELL);
-        }
-        else if (tempword & FT1000_DSP_ASIC_RESET) {
-            //DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_DSP_ASIC_RESET\n");
-
-            // Let's reset the ASIC from the Host side as well
-            status = ft1000_write_register (dev, ASIC_RESET_BIT,
FT1000_REG_RESET);
-            status = ft1000_read_register (dev, &tempword, FT1000_REG_RESET);
-            i = 0;
-            while (tempword & ASIC_RESET_BIT) {
-                status = ft1000_read_register (dev, &tempword,
FT1000_REG_RESET);
-                msleep(10);
-                i++;
-                if (i==100)
-                    break;
-            }
-            if (i==100) {
-                DEBUG("Unable to reset ASIC\n");
-                return STATUS_SUCCESS;
-            }
-            msleep(10);
-            // Program WMARK register
-            status = ft1000_write_register (dev, 0x600,
FT1000_REG_MAG_WATERMARK);
-            // clear ASIC reset doorbell
-            status = ft1000_write_register (dev,
FT1000_DSP_ASIC_RESET, FT1000_REG_DOORBELL);
-            msleep(10);
-        }
-        else if (tempword & FT1000_ASIC_RESET_REQ) {
-            DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_ASIC_RESET_REQ\n");
-
-            // clear ASIC reset request from DSP
-            status = ft1000_write_register (dev,
FT1000_ASIC_RESET_REQ, FT1000_REG_DOORBELL);
-            status = ft1000_write_register (dev, HOST_INTF_BE,
FT1000_REG_SUP_CTRL);
-            // copy dsp session record from Adapter block
-            status = ft1000_write_dpram32 (dev, 0,
(PUCHAR)&info->DSPSess.Rec[0], 1024);
-            // Program WMARK register
-            status = ft1000_write_register (dev, 0x600,
FT1000_REG_MAG_WATERMARK);
-            // ring doorbell to tell DSP that ASIC is out of reset
-            status = ft1000_write_register (dev,
FT1000_ASIC_RESET_DSP, FT1000_REG_DOORBELL);
-        }
-        else if (tempword & FT1000_DB_COND_RESET) {
-            DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_DB_COND_RESET\n");
+	status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
+	// DEBUG("ft1000_poll: read FT1000_REG_DOORBELL message 0x%x\n", tempword);
+
+	//while ( (tempword) && (!status) ) {
+	if (!status) {
+
+		if (tempword & FT1000_DB_DPRAM_RX) {
+			//DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_DB_DPRAM_RX\n");
+
+			status =
+			    ft1000_read_dpram16(dev, 0x200, (PUCHAR) & data, 0);
+			//DEBUG("ft1000_poll:FT1000_DB_DPRAM_RX:ft1000_read_dpram16:size =
0x%x\n", data);
+			size = ntohs(data) + 16 + 2;	//wai
+			if (size % 4) {
+				modulo = 4 - (size % 4);
+				size = size + modulo;
+			}
+			status =
+			    ft1000_read_dpram16(dev, 0x201, (PUCHAR) & portid,
+						1);
+			portid &= 0xff;
+			//DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_DB_DPRAM_RX : portid 0x%x\n", portid);
+
+			if (size < MAX_CMD_SQSIZE) {
+				switch (portid) {
+				case DRIVERID:
+					DEBUG
+					    ("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_DB_DPRAM_RX : portid DRIVERID\n");
+
+					status = ft1000_proc_drvmsg(dev, size);
+					if (status != STATUS_SUCCESS)
+						return status;
+					break;
+				case DSPBCMSGID:
+					// This is a dsp broadcast message
+					// Check which application has registered for dsp broadcast messages
+					//DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_DB_DPRAM_RX : portid DSPBCMSGID\n");
+
+					for (i = 0; i < MAX_NUM_APP; i++) {
+						if ((info->app_info[i].
+						     DspBCMsgFlag)
+						    && (info->app_info[i].
+							fileobject)
+						    && (info->app_info[i].
+							NumOfMsg <
+							MAX_MSG_LIMIT)) {
+							//DEBUG("Dsp broadcast message detected for app id %d\n", i);
+							nxtph =
+							    FT1000_DPRAM_RX_BASE
+							    + 2;
+							pdpram_blk =
+							    ft1000_get_buffer
+							    (&freercvpool);
+							if (pdpram_blk != NULL) {
+								if (ft1000_receive_cmd(dev, pdpram_blk->pbuffer,
MAX_CMD_SQSIZE, &nxtph)) {
+									ppseudo_hdr
+									    =
+									    (PPSEUDO_HDR)
+									    pdpram_blk->
+									    pbuffer;
+									// Put message into the appropriate application block
+									info->
+									    app_info
+									    [i].
+									    nRxMsg++;
+									spin_lock_irqsave
+									    (&free_buff_lock,
+									     flags);
+									list_add_tail
+									    (&pdpram_blk->
+									     list,
+									     &info->
+									     app_info
+									     [i].
+									     app_sqlist);
+									info->
+									    app_info
+									    [i].
+									    NumOfMsg++;
+									spin_unlock_irqrestore
+									    (&free_buff_lock,
+									     flags);
+									wake_up_interruptible
+									    (&info->
+									     app_info
+									     [i].
+									     wait_dpram_msg);
+								} else {
+									info->
+									    app_info
+									    [i].
+									    nRxMsgMiss++;
+									// Put memory back to free pool
+									ft1000_free_buffer
+									    (pdpram_blk,
+									     &freercvpool);
+									DEBUG
+									    ("pdpram_blk::ft1000_get_buffer NULL\n");
+								}
+							} else {
+								DEBUG
+								    ("Out of memory in free receive command pool\n");
+								info->
+								    app_info[i].
+								    nRxMsgMiss++;
+							}	//endof if (pdpram_blk != NULL)
+						}	//endof if
+						//else
+						//    DEBUG("app_info mismatch\n");
+					}	// endof for
+					break;
+				default:
+					pdpram_blk =
+					    ft1000_get_buffer(&freercvpool);
+					//DEBUG("Memory allocated = 0x%8x\n", (u32)pdpram_blk);
+					if (pdpram_blk != NULL) {
+						if (ft1000_receive_cmd
+						    (dev, pdpram_blk->pbuffer,
+						     MAX_CMD_SQSIZE, &nxtph)) {
+							ppseudo_hdr =
+							    (PPSEUDO_HDR)
+							    pdpram_blk->pbuffer;
+							// Search for correct application block
+							for (i = 0;
+							     i < MAX_NUM_APP;
+							     i++) {
+								if (info->
+								    app_info[i].
+								    app_id ==
+								    ppseudo_hdr->
+								    portdest) {
+									break;
+								}
+							}
+
+							if (i == (MAX_NUM_APP - 1)) {	// aelias [+] reason: was out of
array boundary
+								info->
+								    app_info[i].
+								    nRxMsgMiss++;
+								DEBUG
+								    ("FT1000:ft1000_parse_dpram_msg: No application matching
id = %d\n",
+								     ppseudo_hdr->
+								     portdest);
+								// Put memory back to free pool
+								ft1000_free_buffer
+								    (pdpram_blk,
+								     &freercvpool);
+							} else {
+								if (info->
+								    app_info[i].
+								    NumOfMsg >
+								    MAX_MSG_LIMIT)
+								{
+									// Put memory back to free pool
+									ft1000_free_buffer
+									    (pdpram_blk,
+									     &freercvpool);
+								} else {
+									info->
+									    app_info
+									    [i].
+									    nRxMsg++;
+									// Put message into the appropriate application block
+									//pxu spin_lock_irqsave(&free_buff_lock, flags);
+									list_add_tail
+									    (&pdpram_blk->
+									     list,
+									     &info->
+									     app_info
+									     [i].
+									     app_sqlist);
+									info->
+									    app_info
+									    [i].
+									    NumOfMsg++;
+									//pxu spin_unlock_irqrestore(&free_buff_lock, flags);
+									//pxu wake_up_interruptible(&info->app_info[i].wait_dpram_msg);
+								}
+							}
+						} else {
+							// Put memory back to free pool
+							ft1000_free_buffer
+							    (pdpram_blk,
+							     &freercvpool);
+						}
+					} else {
+						DEBUG
+						    ("Out of memory in free receive command pool\n");
+					}
+					break;
+				}	//end of switch
+			}	//endof if (size < MAX_CMD_SQSIZE)
+			else {
+				DEBUG
+				    ("FT1000:dpc:Invalid total length for SlowQ = %d\n",
+				     size);
+			}
+			status =
+			    ft1000_write_register(dev, FT1000_DB_DPRAM_RX,
+						  FT1000_REG_DOORBELL);
+		} else if (tempword & FT1000_DSP_ASIC_RESET) {
+			//DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_DSP_ASIC_RESET\n");
+
+			// Let's reset the ASIC from the Host side as well
+			status =
+			    ft1000_write_register(dev, ASIC_RESET_BIT,
+						  FT1000_REG_RESET);
+			status =
+			    ft1000_read_register(dev, &tempword,
+						 FT1000_REG_RESET);
+			i = 0;
+			while (tempword & ASIC_RESET_BIT) {
+				status =
+				    ft1000_read_register(dev, &tempword,
+							 FT1000_REG_RESET);
+				msleep(10);
+				i++;
+				if (i == 100)
+					break;
+			}
+			if (i == 100) {
+				DEBUG("Unable to reset ASIC\n");
+				return STATUS_SUCCESS;
+			}
+			msleep(10);
+			// Program WMARK register
+			status =
+			    ft1000_write_register(dev, 0x600,
+						  FT1000_REG_MAG_WATERMARK);
+			// clear ASIC reset doorbell
+			status =
+			    ft1000_write_register(dev, FT1000_DSP_ASIC_RESET,
+						  FT1000_REG_DOORBELL);
+			msleep(10);
+		} else if (tempword & FT1000_ASIC_RESET_REQ) {
+			DEBUG
+			    ("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_ASIC_RESET_REQ\n");
+
+			// clear ASIC reset request from DSP
+			status =
+			    ft1000_write_register(dev, FT1000_ASIC_RESET_REQ,
+						  FT1000_REG_DOORBELL);
+			status =
+			    ft1000_write_register(dev, HOST_INTF_BE,
+						  FT1000_REG_SUP_CTRL);
+			// copy dsp session record from Adapter block
+			status =
+			    ft1000_write_dpram32(dev, 0,
+						 (PUCHAR) & info->DSPSess.
+						 Rec[0], 1024);
+			// Program WMARK register
+			status =
+			    ft1000_write_register(dev, 0x600,
+						  FT1000_REG_MAG_WATERMARK);
+			// ring doorbell to tell DSP that ASIC is out of reset
+			status =
+			    ft1000_write_register(dev, FT1000_ASIC_RESET_DSP,
+						  FT1000_REG_DOORBELL);
+		} else if (tempword & FT1000_DB_COND_RESET) {
+			DEBUG
+			    ("ft1000_poll: FT1000_REG_DOORBELL message type:
FT1000_DB_COND_RESET\n");
 //By Jim
 // Reset ASIC and DSP
 //MAG
-            if (info->fAppMsgPend == 0) {
-               // Reset ASIC and DSP
-
-                status    = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER0, (PUCHAR)&(info->DSP_TIME[0]),
FT1000_MAG_DSP_TIMER0_INDX);
-                status    = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER1, (PUCHAR)&(info->DSP_TIME[1]),
FT1000_MAG_DSP_TIMER1_INDX);
-                status    = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER2, (PUCHAR)&(info->DSP_TIME[2]),
FT1000_MAG_DSP_TIMER2_INDX);
-                status    = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER3, (PUCHAR)&(info->DSP_TIME[3]),
FT1000_MAG_DSP_TIMER3_INDX);
-                info->CardReady = 0;
-                info->DrvErrNum = DSP_CONDRESET_INFO;
-                DEBUG("ft1000_hw:DSP conditional reset requested\n");
-                info->ft1000_reset(dev->net);
-            }
-            else {
-                info->fProvComplete = 0;
-                info->fCondResetPend = 1;
-            }
-
-            ft1000_write_register(dev, FT1000_DB_COND_RESET,
FT1000_REG_DOORBELL);
-        }
-
-    }//endof if ( !status )
-
-    //DEBUG("return from ft1000_poll.\n");
-    return STATUS_SUCCESS;
+			if (info->fAppMsgPend == 0) {
+				// Reset ASIC and DSP
+
+				status =
+				    ft1000_read_dpram16(dev,
+							FT1000_MAG_DSP_TIMER0,
+							(PUCHAR) & (info->
+								    DSP_TIME
+								    [0]),
+							FT1000_MAG_DSP_TIMER0_INDX);
+				status =
+				    ft1000_read_dpram16(dev,
+							FT1000_MAG_DSP_TIMER1,
+							(PUCHAR) & (info->
+								    DSP_TIME
+								    [1]),
+							FT1000_MAG_DSP_TIMER1_INDX);
+				status =
+				    ft1000_read_dpram16(dev,
+							FT1000_MAG_DSP_TIMER2,
+							(PUCHAR) & (info->
+								    DSP_TIME
+								    [2]),
+							FT1000_MAG_DSP_TIMER2_INDX);
+				status =
+				    ft1000_read_dpram16(dev,
+							FT1000_MAG_DSP_TIMER3,
+							(PUCHAR) & (info->
+								    DSP_TIME
+								    [3]),
+							FT1000_MAG_DSP_TIMER3_INDX);
+				info->CardReady = 0;
+				info->DrvErrNum = DSP_CONDRESET_INFO;
+				DEBUG
+				    ("ft1000_hw:DSP conditional reset requested\n");
+				info->ft1000_reset(dev->net);
+			} else {
+				info->fProvComplete = 0;
+				info->fCondResetPend = 1;
+			}
+
+			ft1000_write_register(dev, FT1000_DB_COND_RESET,
+					      FT1000_REG_DOORBELL);
+		}
+
+	}			//endof if ( !status )
+
+	//DEBUG("return from ft1000_poll.\n");
+	return STATUS_SUCCESS;

 }

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.h
b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.h
index c580741..8382167 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.h
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.h
@@ -4,7 +4,9 @@

 #include "ft1000_usb.h"

-extern u16 ft1000_read_register(struct usb_device *dev, PUSHORT Data,
u8 nRegIndx);
-extern u16 ft1000_write_register(struct usb_device *dev, USHORT
value, u8 nRegIndx);
+extern u16 ft1000_read_register(struct usb_device *dev, PUSHORT Data,
+				u8 nRegIndx);
+extern u16 ft1000_write_register(struct usb_device *dev, USHORT value,
+				 u8 nRegIndx);

 #endif
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h
b/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h
index e7d3ec8..a1cb4aa 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h
@@ -36,84 +36,79 @@
 #define MAX_DNLD_BLKSZ          1024

 // Standard Flarion Pseudo header
-typedef struct _PSEUDO_HDR
-{
-   unsigned short    length;           //length of msg body
-   unsigned char     source;           //source address (0x10=Host 0x20=DSP)
-   unsigned char     destination;      //destination address (refer
to source address)
-   unsigned char     portdest;         //destination port id
-                                       //    0x00=Driver
-                                       //    0x10=Application Broadcast
-                                       //    0x20=Network Stack
-                                       //    0x80=Dsp OAM
-                                       //    0x90=Dsp Airlink
-                                       //    0xa0=Dsp Loader
-                                       //    0xb0=Dsp MIP
-   unsigned char     portsrc;          //source port id (refer to portdest)
-   unsigned short    sh_str_id;        //stream id (Not applicable on Mobile)
-   unsigned char     control;          //stream id (Not applicable on Mobile)
-   unsigned char     rsvd1;            //reserved
-   unsigned char     seq_num;          //sequence number
-   unsigned char     rsvd2;            //reserved
-   unsigned short    qos_class;        //Quality of Service class
(Not applicable on Mobile)
-   unsigned short    checksum;         //Psuedo header checksum
+typedef struct _PSEUDO_HDR {
+	unsigned short length;	//length of msg body
+	unsigned char source;	//source address (0x10=Host 0x20=DSP)
+	unsigned char destination;	//destination address (refer to source address)
+	unsigned char portdest;	//destination port id
+	//    0x00=Driver
+	//    0x10=Application Broadcast
+	//    0x20=Network Stack
+	//    0x80=Dsp OAM
+	//    0x90=Dsp Airlink
+	//    0xa0=Dsp Loader
+	//    0xb0=Dsp MIP
+	unsigned char portsrc;	//source port id (refer to portdest)
+	unsigned short sh_str_id;	//stream id (Not applicable on Mobile)
+	unsigned char control;	//stream id (Not applicable on Mobile)
+	unsigned char rsvd1;	//reserved
+	unsigned char seq_num;	//sequence number
+	unsigned char rsvd2;	//reserved
+	unsigned short qos_class;	//Quality of Service class (Not applicable
on Mobile)
+	unsigned short checksum;	//Psuedo header checksum
 } __attribute__ ((packed)) PSEUDO_HDR, *PPSEUDO_HDR;

-typedef struct _IOCTL_GET_VER
-{
-    unsigned long drv_ver;
+typedef struct _IOCTL_GET_VER {
+	unsigned long drv_ver;
 } __attribute__ ((packed)) IOCTL_GET_VER, *PIOCTL_GET_VER;

 //Data structure for Dsp statistics
-typedef struct _IOCTL_GET_DSP_STAT
-{
-    unsigned char DspVer[DSPVERSZ];        // DSP version number
-    unsigned char HwSerNum[HWSERNUMSZ];    // Hardware Serial Number
-    unsigned char Sku[SKUSZ];              // SKU
-    unsigned char eui64[EUISZ];            // EUI64
-    unsigned short ConStat;                // Connection Status
-                                //    Bits 0-3 = Connection Status Field
-                                //               0000=Idle (Disconnect)
-                                //               0001=Searching
-                                //               0010=Active (Connected)
-                                //               0011=Waiting for L2 down
-                                //               0100=Sleep
-    unsigned short LedStat;                // Led Status
-                                //    Bits 0-3   = Signal Strength Field
-                                //                 0000 = -105dBm to -92dBm
-                                //                 0001 = -92dBm to -85dBm
-                                //                 0011 = -85dBm to -75dBm
-                                //                 0111 = -75dBm to -50dBm
-                                //                 1111 = -50dBm to 0dBm
-                                //    Bits 4-7   = Reserved
-                                //    Bits 8-11  = SNR Field
-                                //                 0000 = <2dB
-                                //                 0001 = 2dB to 8dB
-                                //                 0011 = 8dB to 15dB
-                                //                 0111 = 15dB to 22dB
-                                //                 1111 = >22dB
-                                //    Bits 12-15 = Reserved
-    unsigned long nTxPkts;                // Number of packets
transmitted from host to dsp
-    unsigned long nRxPkts;                // Number of packets
received from dsp to host
-    unsigned long nTxBytes;               // Number of bytes
transmitted from host to dsp
-    unsigned long nRxBytes;               // Number of bytes received
from dsp to host
-    unsigned long ConTm;                  // Current session
connection time in seconds
-    unsigned char CalVer[CALVERSZ];       // Proprietary Calibration Version
-    unsigned char CalDate[CALDATESZ];     // Proprietary Calibration Date
+typedef struct _IOCTL_GET_DSP_STAT {
+	unsigned char DspVer[DSPVERSZ];	// DSP version number
+	unsigned char HwSerNum[HWSERNUMSZ];	// Hardware Serial Number
+	unsigned char Sku[SKUSZ];	// SKU
+	unsigned char eui64[EUISZ];	// EUI64
+	unsigned short ConStat;	// Connection Status
+	//    Bits 0-3 = Connection Status Field
+	//               0000=Idle (Disconnect)
+	//               0001=Searching
+	//               0010=Active (Connected)
+	//               0011=Waiting for L2 down
+	//               0100=Sleep
+	unsigned short LedStat;	// Led Status
+	//    Bits 0-3   = Signal Strength Field
+	//                 0000 = -105dBm to -92dBm
+	//                 0001 = -92dBm to -85dBm
+	//                 0011 = -85dBm to -75dBm
+	//                 0111 = -75dBm to -50dBm
+	//                 1111 = -50dBm to 0dBm
+	//    Bits 4-7   = Reserved
+	//    Bits 8-11  = SNR Field
+	//                 0000 = <2dB
+	//                 0001 = 2dB to 8dB
+	//                 0011 = 8dB to 15dB
+	//                 0111 = 15dB to 22dB
+	//                 1111 = >22dB
+	//    Bits 12-15 = Reserved
+	unsigned long nTxPkts;	// Number of packets transmitted from host to dsp
+	unsigned long nRxPkts;	// Number of packets received from dsp to host
+	unsigned long nTxBytes;	// Number of bytes transmitted from host to dsp
+	unsigned long nRxBytes;	// Number of bytes received from dsp to host
+	unsigned long ConTm;	// Current session connection time in seconds
+	unsigned char CalVer[CALVERSZ];	// Proprietary Calibration Version
+	unsigned char CalDate[CALDATESZ];	// Proprietary Calibration Date
 } __attribute__ ((packed)) IOCTL_GET_DSP_STAT, *PIOCTL_GET_DSP_STAT;

 //Data structure for Dual Ported RAM messaging between Host and Dsp
-typedef struct _IOCTL_DPRAM_BLK
-{
-    unsigned short total_len;
-    PSEUDO_HDR pseudohdr;
-    unsigned char buffer[1780];
+typedef struct _IOCTL_DPRAM_BLK {
+	unsigned short total_len;
+	PSEUDO_HDR pseudohdr;
+	unsigned char buffer[1780];
 } __attribute__ ((packed)) IOCTL_DPRAM_BLK, *PIOCTL_DPRAM_BLK;

-typedef struct _IOCTL_DPRAM_COMMAND
-{
-    unsigned short extra;
-    IOCTL_DPRAM_BLK dpram_blk;
+typedef struct _IOCTL_DPRAM_COMMAND {
+	unsigned short extra;
+	IOCTL_DPRAM_BLK dpram_blk;
 } __attribute__ ((packed)) IOCTL_DPRAM_COMMAND, *PIOCTL_DPRAM_COMMAND;

 //
@@ -137,4 +132,3 @@ typedef struct _IOCTL_DPRAM_COMMAND
 #define IOCTL_FT1000_GET_DPRAM _IOR (FT1000_MAGIC_CODE,
IOCTL_GET_DPRAM_CMD, sizeof(IOCTL_DPRAM_BLK) )
 #define IOCTL_FT1000_REGISTER  _IOW (FT1000_MAGIC_CODE,
IOCTL_REGISTER_CMD, sizeof(unsigned short *) )
 #endif // _FT1000IOCTLH_
-
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c
b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c
index 80faba5..4fc926d 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c
@@ -3,12 +3,10 @@
 #include <linux/proc_fs.h>
 #include <linux/netdevice.h>

-
 #include "ft1000_usb.h"

 #define FT1000_PROC_DIR "ft1000"

-
 #define PUTM_TO_PAGE(len,page,args...) \
 	len += snprintf(page+len, PAGE_SIZE - len, args)

@@ -28,205 +26,182 @@
 	} \
 	len += snprintf(page+len, PAGE_SIZE - len, "%d\n", var[i])

-
-
-
 //#ifdef INIT_NET_NS
 #define FTNET_PROC init_net.proc_net
 //#else
 //#define FTNET_PROC proc_net
 //#endif

-
-u16 ft1000_read_dpram16 (struct ft1000_device *ft1000dev, USHORT indx,
-			 PUCHAR buffer, u8 highlow);
-
+u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx,
+			PUCHAR buffer, u8 highlow);

 int
-ft1000ReadProc (char *page, char **start, off_t off, int count, int *eof,
-		void *data)
+ft1000ReadProc(char *page, char **start, off_t off, int count, int *eof,
+	       void *data)
 {
-  struct net_device *dev;
-  int len;
-  int i;
-  unsigned short ledStat;
-  unsigned short conStat;
-
-  FT1000_INFO *info;
-
-  char *status[] = { "Idle (Disconnect)", "Searching", "Active (Connected)",
-    "Waiting for L2", "Sleep", "No Coverage", "", ""
-  };
-
-  char *signal[] = { "", "*", "**", "***", "****" };
-  int strength;
-  int quality;
-  struct timeval tv;
-  time_t delta;
-
-  dev = (struct net_device *) data;
-  info = (FT1000_INFO *) netdev_priv (dev);
-
-  if (off > 0)
-    {
-      *eof = 1;
-      return 0;
-    }
-
-
-  if (info->ProgConStat != 0xFF)
-    {
-      ft1000_read_dpram16 (info->pFt1000Dev, FT1000_MAG_DSP_LED,
-			   (PUCHAR) & ledStat, FT1000_MAG_DSP_LED_INDX);
-      info->LedStat = ntohs (ledStat);
-
-      ft1000_read_dpram16 (info->pFt1000Dev, FT1000_MAG_DSP_CON_STATE,
-			   (PUCHAR) & conStat, FT1000_MAG_DSP_CON_STATE_INDX);
-      info->ConStat = ntohs (conStat);
-      do_gettimeofday (&tv);
-      delta = (tv.tv_sec - info->ConTm);
-    }
-  else
-    {
-      info->ConStat = 0xf;
-      delta = 0;
-    }
-
-
-
-  i = (info->LedStat) & 0xf;
-  switch (i)
-    {
-    case 0x1:
-      strength = 1;
-      break;
-    case 0x3:
-      strength = 2;
-      break;
-    case 0x7:
-      strength = 3;
-      break;
-    case 0xf:
-      strength = 4;
-      break;
-    default:
-      strength = 0;
-    }
-
-  i = (info->LedStat >> 8) & 0xf;
-  switch (i)
-    {
-    case 0x1:
-      quality = 1;
-      break;
-    case 0x3:
-      quality = 2;
-      break;
-    case 0x7:
-      quality = 3;
-      break;
-    case 0xf:
-      quality = 4;
-      break;
-    default:
-      quality = 0;
-    }
-
-
-  len = 0;
-  PUTM_TO_PAGE (len, page, "Connection Time: %02ld:%02ld:%02ld\n",
-		((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60));
-  PUTM_TO_PAGE (len, page, "Connection Time[s]: %ld\n", delta);
-  PUTM_TO_PAGE (len, page, "Asic ID: %s\n",
-		(info->AsicID) ==
-		ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC");
-  PUTX_TO_PAGE (len, page, "SKU: ", SKUSZ, info->Sku);
-  PUTX_TO_PAGE (len, page, "EUI64: ", EUISZ, info->eui64);
-  PUTD_TO_PAGE (len, page, "DSP version number: ", DSPVERSZ, info->DspVer);
-  PUTX_TO_PAGE (len, page, "Hardware Serial Number: ", HWSERNUMSZ,
-		info->HwSerNum);
-  PUTX_TO_PAGE (len, page, "Caliberation Version: ", CALVERSZ,
-		info->RfCalVer);
-  PUTD_TO_PAGE (len, page, "Caliberation Date: ", CALDATESZ, info->RfCalDate);
-  PUTM_TO_PAGE (len, page, "Media State: %s\n",
-		(info->mediastate) ? "link" : "no link");
-  PUTM_TO_PAGE (len, page, "Connection Status: %s\n",
-		status[((info->ConStat) & 0x7)]);
-  PUTM_TO_PAGE (len, page, "RX packets: %ld\n", info->stats.rx_packets);
-  PUTM_TO_PAGE (len, page, "TX packets: %ld\n", info->stats.tx_packets);
-  PUTM_TO_PAGE (len, page, "RX bytes: %ld\n", info->stats.rx_bytes);
-  PUTM_TO_PAGE (len, page, "TX bytes: %ld\n", info->stats.tx_bytes);
-  PUTM_TO_PAGE (len, page, "Signal Strength: %s\n", signal[strength]);
-  PUTM_TO_PAGE (len, page, "Signal Quality: %s\n", signal[quality]);
-
-
-
-
-  return len;
+	struct net_device *dev;
+	int len;
+	int i;
+	unsigned short ledStat;
+	unsigned short conStat;
+
+	FT1000_INFO *info;
+
+	char *status[] =
+	    { "Idle (Disconnect)", "Searching", "Active (Connected)",
+		"Waiting for L2", "Sleep", "No Coverage", "", ""
+	};
+
+	char *signal[] = { "", "*", "**", "***", "****" };
+	int strength;
+	int quality;
+	struct timeval tv;
+	time_t delta;
+
+	dev = (struct net_device *)data;
+	info = (FT1000_INFO *) netdev_priv(dev);
+
+	if (off > 0) {
+		*eof = 1;
+		return 0;
+	}
+
+	if (info->ProgConStat != 0xFF) {
+		ft1000_read_dpram16(info->pFt1000Dev, FT1000_MAG_DSP_LED,
+				    (PUCHAR) & ledStat,
+				    FT1000_MAG_DSP_LED_INDX);
+		info->LedStat = ntohs(ledStat);
+
+		ft1000_read_dpram16(info->pFt1000Dev, FT1000_MAG_DSP_CON_STATE,
+				    (PUCHAR) & conStat,
+				    FT1000_MAG_DSP_CON_STATE_INDX);
+		info->ConStat = ntohs(conStat);
+		do_gettimeofday(&tv);
+		delta = (tv.tv_sec - info->ConTm);
+	} else {
+		info->ConStat = 0xf;
+		delta = 0;
+	}
+
+	i = (info->LedStat) & 0xf;
+	switch (i) {
+	case 0x1:
+		strength = 1;
+		break;
+	case 0x3:
+		strength = 2;
+		break;
+	case 0x7:
+		strength = 3;
+		break;
+	case 0xf:
+		strength = 4;
+		break;
+	default:
+		strength = 0;
+	}
+
+	i = (info->LedStat >> 8) & 0xf;
+	switch (i) {
+	case 0x1:
+		quality = 1;
+		break;
+	case 0x3:
+		quality = 2;
+		break;
+	case 0x7:
+		quality = 3;
+		break;
+	case 0xf:
+		quality = 4;
+		break;
+	default:
+		quality = 0;
+	}
+
+	len = 0;
+	PUTM_TO_PAGE(len, page, "Connection Time: %02ld:%02ld:%02ld\n",
+		     ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60));
+	PUTM_TO_PAGE(len, page, "Connection Time[s]: %ld\n", delta);
+	PUTM_TO_PAGE(len, page, "Asic ID: %s\n",
+		     (info->AsicID) ==
+		     ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC");
+	PUTX_TO_PAGE(len, page, "SKU: ", SKUSZ, info->Sku);
+	PUTX_TO_PAGE(len, page, "EUI64: ", EUISZ, info->eui64);
+	PUTD_TO_PAGE(len, page, "DSP version number: ", DSPVERSZ, info->DspVer);
+	PUTX_TO_PAGE(len, page, "Hardware Serial Number: ", HWSERNUMSZ,
+		     info->HwSerNum);
+	PUTX_TO_PAGE(len, page, "Caliberation Version: ", CALVERSZ,
+		     info->RfCalVer);
+	PUTD_TO_PAGE(len, page, "Caliberation Date: ", CALDATESZ,
+		     info->RfCalDate);
+	PUTM_TO_PAGE(len, page, "Media State: %s\n",
+		     (info->mediastate) ? "link" : "no link");
+	PUTM_TO_PAGE(len, page, "Connection Status: %s\n",
+		     status[((info->ConStat) & 0x7)]);
+	PUTM_TO_PAGE(len, page, "RX packets: %ld\n", info->stats.rx_packets);
+	PUTM_TO_PAGE(len, page, "TX packets: %ld\n", info->stats.tx_packets);
+	PUTM_TO_PAGE(len, page, "RX bytes: %ld\n", info->stats.rx_bytes);
+	PUTM_TO_PAGE(len, page, "TX bytes: %ld\n", info->stats.tx_bytes);
+	PUTM_TO_PAGE(len, page, "Signal Strength: %s\n", signal[strength]);
+	PUTM_TO_PAGE(len, page, "Signal Quality: %s\n", signal[quality]);
+
+	return len;
 }

 static int
-ft1000NotifyProc (struct notifier_block *this, unsigned long event, void *ptr)
+ft1000NotifyProc(struct notifier_block *this, unsigned long event, void *ptr)
 {
-  struct net_device *dev = ptr;
-  FT1000_INFO *info;
-  struct proc_dir_entry *ft1000_proc_file;
-
-  info = (FT1000_INFO *) netdev_priv (dev);
-
-
-  switch (event)
-    {
-    case NETDEV_CHANGENAME:
-      remove_proc_entry (info->netdevname, info->ft1000_proc_dir);
-      ft1000_proc_file = create_proc_read_entry (dev->name, 0644,
-						 info->ft1000_proc_dir,
-						 ft1000ReadProc, dev);
-      snprintf (info->netdevname, IFNAMSIZ, "%s", dev->name);
-      break;
-    }
-  return NOTIFY_DONE;
+	struct net_device *dev = ptr;
+	FT1000_INFO *info;
+	struct proc_dir_entry *ft1000_proc_file;
+
+	info = (FT1000_INFO *) netdev_priv(dev);
+
+	switch (event) {
+	case NETDEV_CHANGENAME:
+		remove_proc_entry(info->netdevname, info->ft1000_proc_dir);
+		ft1000_proc_file = create_proc_read_entry(dev->name, 0644,
+							  info->ft1000_proc_dir,
+							  ft1000ReadProc, dev);
+		snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name);
+		break;
+	}
+	return NOTIFY_DONE;
 }

 static struct notifier_block ft1000_netdev_notifier = {
-  .notifier_call = ft1000NotifyProc
+	.notifier_call = ft1000NotifyProc
 };

-
-void
-ft1000InitProc (struct net_device *dev)
+void ft1000InitProc(struct net_device *dev)
 {
-  FT1000_INFO *info;
-  struct proc_dir_entry *ft1000_proc_file;
-  info = (FT1000_INFO *) netdev_priv (dev);
-
-
-  info->ft1000_proc_dir = proc_mkdir (FT1000_PROC_DIR, FTNET_PROC);
-  if (info->ft1000_proc_dir == NULL)
-    {
-      remove_proc_entry (FT1000_PROC_DIR, FTNET_PROC);
-    }
-
-
-  ft1000_proc_file =
-    create_proc_read_entry (dev->name, 0644, info->ft1000_proc_dir,
-			    ft1000ReadProc, dev);
-  if (ft1000_proc_file == NULL)
-    {
-      remove_proc_entry (info->netdevname, info->ft1000_proc_dir);
-    }
-
-  snprintf (info->netdevname, IFNAMSIZ, "%s", dev->name);
-  register_netdevice_notifier (&ft1000_netdev_notifier);
-  return;
+	FT1000_INFO *info;
+	struct proc_dir_entry *ft1000_proc_file;
+	info = (FT1000_INFO *) netdev_priv(dev);
+
+	info->ft1000_proc_dir = proc_mkdir(FT1000_PROC_DIR, FTNET_PROC);
+	if (info->ft1000_proc_dir == NULL) {
+		remove_proc_entry(FT1000_PROC_DIR, FTNET_PROC);
+	}
+
+	ft1000_proc_file =
+	    create_proc_read_entry(dev->name, 0644, info->ft1000_proc_dir,
+				   ft1000ReadProc, dev);
+	if (ft1000_proc_file == NULL) {
+		remove_proc_entry(info->netdevname, info->ft1000_proc_dir);
+	}
+
+	snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name);
+	register_netdevice_notifier(&ft1000_netdev_notifier);
+	return;
 }

-void
-ft1000CleanupProc (FT1000_INFO * info)
+void ft1000CleanupProc(FT1000_INFO * info)
 {
-  remove_proc_entry (info->netdevname, info->ft1000_proc_dir);
-  remove_proc_entry (FT1000_PROC_DIR, FTNET_PROC);
-  unregister_netdevice_notifier (&ft1000_netdev_notifier);
+	remove_proc_entry(info->netdevname, info->ft1000_proc_dir);
+	remove_proc_entry(FT1000_PROC_DIR, FTNET_PROC);
+	unregister_netdevice_notifier(&ft1000_netdev_notifier);

-  return;
+	return;
 }
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
index 4dbc98b..ee6e1a8 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
@@ -31,62 +31,59 @@ MODULE_DESCRIPTION("FT1000 EXPRESS CARD DRIVER");
 MODULE_LICENSE("Dual MPL/GPL");
 MODULE_SUPPORTED_DEVICE("QFT FT1000 Express Cards");

-
 void *pFileStart;
 ULONG FileLength;

-#define VENDOR_ID 0x1291   /* Qualcomm vendor id */
-#define PRODUCT_ID 0x11    /* fake product id */
+#define VENDOR_ID 0x1291	/* Qualcomm vendor id */
+#define PRODUCT_ID 0x11		/* fake product id */

 /* table of devices that work with this driver */
 static struct usb_device_id id_table[] = {
-    {USB_DEVICE(VENDOR_ID, PRODUCT_ID) },
-    { },
+	{USB_DEVICE(VENDOR_ID, PRODUCT_ID)},
+	{},
 };

-MODULE_DEVICE_TABLE (usb, id_table);
+MODULE_DEVICE_TABLE(usb, id_table);

-extern  struct ft1000_device *pdevobj[MAX_NUM_CARDS+2];
+extern struct ft1000_device *pdevobj[MAX_NUM_CARDS + 2];

-char *getfw (char *fn, int *pimgsz);
+char *getfw(char *fn, int *pimgsz);

 int ft1000_close(struct net_device *net);
-void dsp_reload (struct ft1000_device *ft1000dev);
+void dsp_reload(struct ft1000_device *ft1000dev);
 u16 init_ft1000_netdev(struct ft1000_device *ft1000dev);
-u16 reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct
usb_interface *intf);
-int ft1000_poll(void* dev_id);
+u16 reg_ft1000_netdev(struct ft1000_device *ft1000dev,
+		      struct usb_interface *intf);
+int ft1000_poll(void *dev_id);
 void ft1000_DestroyDevice(struct net_device *dev);
-u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx,
PUCHAR buffer, u8 highlow);
-u16 ft1000_read_register(struct ft1000_device *ft1000dev, short*
Data, u16 nRegIndx);
+u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx,
+			PUCHAR buffer, u8 highlow);
+u16 ft1000_read_register(struct ft1000_device *ft1000dev, short *Data,
+			 u16 nRegIndx);
 BOOLEAN gPollingfailed = FALSE;

 void ft1000InitProc(struct net_device *dev);
-void ft1000CleanupProc(FT1000_INFO *info);
+void ft1000CleanupProc(FT1000_INFO * info);
 int ft1000_poll_thread(void *arg);

 int ft1000_poll_thread(void *arg)
 {
-    int ret = STATUS_SUCCESS;
-
-    while(!kthread_should_stop() )
-    {
-        msleep(10);
-        if ( ! gPollingfailed )
-        {
-            ret = ft1000_poll(arg);
-            if ( ret != STATUS_SUCCESS )
-            {
-                DEBUG("ft1000_poll_thread: polling failed\n");
-                gPollingfailed = TRUE;
-            }
-        }
-    }
-    //DEBUG("returned from polling thread\n");
-    return STATUS_SUCCESS;
+	int ret = STATUS_SUCCESS;
+
+	while (!kthread_should_stop()) {
+		msleep(10);
+		if (!gPollingfailed) {
+			ret = ft1000_poll(arg);
+			if (ret != STATUS_SUCCESS) {
+				DEBUG("ft1000_poll_thread: polling failed\n");
+				gPollingfailed = TRUE;
+			}
+		}
+	}
+	//DEBUG("returned from polling thread\n");
+	return STATUS_SUCCESS;
 }

-
-
 //---------------------------------------------------------------------------
 // Function:    ft1000_probe
 //
@@ -99,29 +96,30 @@ int ft1000_poll_thread(void *arg)
 // Notes:
 //
 //---------------------------------------------------------------------------
-static int ft1000_probe(struct usb_interface *interface, const struct
usb_device_id *id)
+static int ft1000_probe(struct usb_interface *interface,
+			const struct usb_device_id *id)
 {
-    struct usb_host_interface *iface_desc;
-    struct usb_endpoint_descriptor *endpoint;
-    struct usb_device *dev;
-    unsigned numaltsetting;
-    int i;
+	struct usb_host_interface *iface_desc;
+	struct usb_endpoint_descriptor *endpoint;
+	struct usb_device *dev;
+	unsigned numaltsetting;
+	int i;

-    struct ft1000_device *ft1000dev;
-    FT1000_INFO *pft1000info;
+	struct ft1000_device *ft1000dev;
+	FT1000_INFO *pft1000info;

-    if(!(ft1000dev = kmalloc(sizeof(struct ft1000_device), GFP_KERNEL)))
-    {
-        printk("out of memory allocating device structure\n");
-	return 0;
-    }
+	if (!(ft1000dev = kmalloc(sizeof(struct ft1000_device), GFP_KERNEL))) {
+		printk("out of memory allocating device structure\n");
+		return 0;
+	}

-    memset(ft1000dev, 0, sizeof(*ft1000dev));
+	memset(ft1000dev, 0, sizeof(*ft1000dev));

 	//get usb device
-    dev = interface_to_usbdev(interface);
-    DEBUG("ft1000_probe: usb device descriptor info:\n");
-    DEBUG("ft1000_probe: number of configuration is %d\n",
dev->descriptor.bNumConfigurations);
+	dev = interface_to_usbdev(interface);
+	DEBUG("ft1000_probe: usb device descriptor info:\n");
+	DEBUG("ft1000_probe: number of configuration is %d\n",
+	      dev->descriptor.bNumConfigurations);

 	ft1000dev->dev = dev;
 	ft1000dev->status = 0;
@@ -131,98 +129,108 @@ static int ft1000_probe(struct usb_interface
*interface, const struct usb_device
 	ft1000dev->tx_urb = usb_alloc_urb(0, GFP_ATOMIC);
 	ft1000dev->rx_urb = usb_alloc_urb(0, GFP_ATOMIC);

-
-    DEBUG("ft1000_probe is called\n");
-    numaltsetting = interface->num_altsetting;
-    DEBUG("ft1000_probe: number of alt settings is :%d\n",numaltsetting);
-    iface_desc = interface->cur_altsetting;
-    DEBUG("ft1000_probe: number of endpoints is %d\n",
iface_desc->desc.bNumEndpoints);
-    DEBUG("ft1000_probe: descriptor type is %d\n",
iface_desc->desc.bDescriptorType);
-    DEBUG("ft1000_probe: interface number is %d\n",
iface_desc->desc.bInterfaceNumber);
-    DEBUG("ft1000_probe: alternatesetting is %d\n",
iface_desc->desc.bAlternateSetting);
-    DEBUG("ft1000_probe: interface class is %d\n",
iface_desc->desc.bInterfaceClass);
-    DEBUG("ft1000_probe: control endpoint info:\n");
-    DEBUG("ft1000_probe: descriptor0 type -- %d\n",
iface_desc->endpoint[0].desc.bmAttributes);
-    DEBUG("ft1000_probe: descriptor1 type -- %d\n",
iface_desc->endpoint[1].desc.bmAttributes);
-    DEBUG("ft1000_probe: descriptor2 type -- %d\n",
iface_desc->endpoint[2].desc.bmAttributes);
-
-    for (i=0; i< iface_desc->desc.bNumEndpoints;i++ )
-    {
-		endpoint = (struct usb_endpoint_descriptor *)&iface_desc->endpoint[i].desc;
-                DEBUG("endpoint %d\n", i);
-                DEBUG("bEndpointAddress=%x, bmAttributes=%x\n",
endpoint->bEndpointAddress, endpoint->bmAttributes);
-		if ( (endpoint->bEndpointAddress & USB_DIR_IN) &&
((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK))
-		{
-			ft1000dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
-			DEBUG("ft1000_probe: in: %d\n", endpoint->bEndpointAddress);
+	DEBUG("ft1000_probe is called\n");
+	numaltsetting = interface->num_altsetting;
+	DEBUG("ft1000_probe: number of alt settings is :%d\n", numaltsetting);
+	iface_desc = interface->cur_altsetting;
+	DEBUG("ft1000_probe: number of endpoints is %d\n",
+	      iface_desc->desc.bNumEndpoints);
+	DEBUG("ft1000_probe: descriptor type is %d\n",
+	      iface_desc->desc.bDescriptorType);
+	DEBUG("ft1000_probe: interface number is %d\n",
+	      iface_desc->desc.bInterfaceNumber);
+	DEBUG("ft1000_probe: alternatesetting is %d\n",
+	      iface_desc->desc.bAlternateSetting);
+	DEBUG("ft1000_probe: interface class is %d\n",
+	      iface_desc->desc.bInterfaceClass);
+	DEBUG("ft1000_probe: control endpoint info:\n");
+	DEBUG("ft1000_probe: descriptor0 type -- %d\n",
+	      iface_desc->endpoint[0].desc.bmAttributes);
+	DEBUG("ft1000_probe: descriptor1 type -- %d\n",
+	      iface_desc->endpoint[1].desc.bmAttributes);
+	DEBUG("ft1000_probe: descriptor2 type -- %d\n",
+	      iface_desc->endpoint[2].desc.bmAttributes);
+
+	for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
+		endpoint =
+		    (struct usb_endpoint_descriptor *)&iface_desc->
+		    endpoint[i].desc;
+		DEBUG("endpoint %d\n", i);
+		DEBUG("bEndpointAddress=%x, bmAttributes=%x\n",
+		      endpoint->bEndpointAddress, endpoint->bmAttributes);
+		if ((endpoint->bEndpointAddress & USB_DIR_IN)
+		    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+			USB_ENDPOINT_XFER_BULK)) {
+			ft1000dev->bulk_in_endpointAddr =
+			    endpoint->bEndpointAddress;
+			DEBUG("ft1000_probe: in: %d\n",
+			      endpoint->bEndpointAddress);
 		}

-		if (!(endpoint->bEndpointAddress & USB_DIR_IN) &&
((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK))
-		{
-			ft1000dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
-			DEBUG("ft1000_probe: out: %d\n", endpoint->bEndpointAddress);
+		if (!(endpoint->bEndpointAddress & USB_DIR_IN)
+		    && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+			USB_ENDPOINT_XFER_BULK)) {
+			ft1000dev->bulk_out_endpointAddr =
+			    endpoint->bEndpointAddress;
+			DEBUG("ft1000_probe: out: %d\n",
+			      endpoint->bEndpointAddress);
 		}
-    }
-
-    DEBUG("bulk_in=%d, bulk_out=%d\n",
ft1000dev->bulk_in_endpointAddr, ft1000dev->bulk_out_endpointAddr);
-
-    //read DSP image
-    pFileStart = (void*)getfw("/etc/flarion/ft3000.img", &FileLength);
-
-    if (pFileStart == NULL )
-    {
-        DEBUG ("ft1000_probe: Read DSP image failed\n");
-        return 0;
-    }
-
-    //for ( i=0; i< MAX_NUM_CARDS+2; i++)
-    //    pdevobj[i] = NULL;
-
-    //download dsp image
-    DEBUG("ft1000_probe: start downloading dsp image...\n");
-    init_ft1000_netdev(ft1000dev);
-    pft1000info = (FT1000_INFO *) netdev_priv (ft1000dev->net);
-
-//    DEBUG("In probe: pft1000info=%x\n", pft1000info);				// aelias
[-] reason: warning: format ???%x??? expects type ???unsigned int???,
but argument 2 has type ???struct FT1000_INFO *???
-    DEBUG("In probe: pft1000info=%x\n", (unsigned
int)pft1000info);		// aelias [+] reason: up
-
-    dsp_reload(ft1000dev);
-    gPollingfailed = FALSE;  //mbelian
-    pft1000info->pPollThread = kthread_run(ft1000_poll_thread,
ft1000dev, "ft1000_poll");
-	msleep(500); //mbelian
-
-
-    if ( pft1000info->DSP_loading )
-    {
-        DEBUG("ERROR!!!! RETURN FROM ft1000_probe **********************\n");
-        return 0;
-    }
-
-    while (!pft1000info->CardReady)
-    {
-        if ( gPollingfailed )
-        {
-            if ( pft1000info->pPollThread )
-            {
-                kthread_stop(pft1000info->pPollThread );
-            }
-            return 0;
-        }
-        msleep(100);
-        DEBUG("ft1000_probe::Waiting for Card Ready\n");
-    }
-
+	}
+
+	DEBUG("bulk_in=%d, bulk_out=%d\n", ft1000dev->bulk_in_endpointAddr,
+	      ft1000dev->bulk_out_endpointAddr);
+
+	//read DSP image
+	pFileStart = (void *)getfw("/etc/flarion/ft3000.img", &FileLength);
+
+	if (pFileStart == NULL) {
+		DEBUG("ft1000_probe: Read DSP image failed\n");
+		return 0;
+	}
+	//for ( i=0; i< MAX_NUM_CARDS+2; i++)
+	//    pdevobj[i] = NULL;
+
+	//download dsp image
+	DEBUG("ft1000_probe: start downloading dsp image...\n");
+	init_ft1000_netdev(ft1000dev);
+	pft1000info = (FT1000_INFO *) netdev_priv(ft1000dev->net);
+
+//    DEBUG("In probe: pft1000info=%x\n", pft1000info);
          // aelias [-] reason: warning: format ???%x??? expects type
???unsigned int???, but argument 2 has type ???struct FT1000_INFO *???
+	DEBUG("In probe: pft1000info=%x\n", (unsigned int)pft1000info);	//
aelias [+] reason: up
+
+	dsp_reload(ft1000dev);
+	gPollingfailed = FALSE;	//mbelian
+	pft1000info->pPollThread =
+	    kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll");
+	msleep(500);		//mbelian
+
+	if (pft1000info->DSP_loading) {
+		DEBUG
+		    ("ERROR!!!! RETURN FROM ft1000_probe **********************\n");
+		return 0;
+	}
+
+	while (!pft1000info->CardReady) {
+		if (gPollingfailed) {
+			if (pft1000info->pPollThread) {
+				kthread_stop(pft1000info->pPollThread);
+			}
+			return 0;
+		}
+		msleep(100);
+		DEBUG("ft1000_probe::Waiting for Card Ready\n");
+	}

-    //initialize network device
-    DEBUG("ft1000_probe::Card Ready!!!! Registering network device\n");
+	//initialize network device
+	DEBUG("ft1000_probe::Card Ready!!!! Registering network device\n");

-    reg_ft1000_netdev(ft1000dev, interface);
+	reg_ft1000_netdev(ft1000dev, interface);

-    pft1000info->NetDevRegDone = 1;
+	pft1000info->NetDevRegDone = 1;

-		ft1000InitProc(ft1000dev->net);// +mbelian
+	ft1000InitProc(ft1000dev->net);	// +mbelian

-       return 0;
+	return 0;
 }

 //---------------------------------------------------------------------------
@@ -239,65 +247,60 @@ static int ft1000_probe(struct usb_interface
*interface, const struct usb_device
 //---------------------------------------------------------------------------
 static void ft1000_disconnect(struct usb_interface *interface)
 {
-    FT1000_INFO *pft1000info;
+	FT1000_INFO *pft1000info;

-    DEBUG("ft1000_disconnect is called\n");
+	DEBUG("ft1000_disconnect is called\n");

-    pft1000info = (PFT1000_INFO)usb_get_intfdata(interface);
-//    DEBUG("In disconnect pft1000info=%x\n", pft1000info);	// aelias
[-] reason: warning: format ???%x??? expects type ???unsigned int???,
but argument 2 has type ???struct FT1000_INFO *???
-    DEBUG("In disconnect pft1000info=%x\n", (unsigned int)
pft1000info);	// aelias [+] reason: up
+	pft1000info = (PFT1000_INFO) usb_get_intfdata(interface);
+//    DEBUG("In disconnect pft1000info=%x\n", pft1000info);     //
aelias [-] reason: warning: format ???%x??? expects type ???unsigned
int???, but argument 2 has type ???struct FT1000_INFO *???
+	DEBUG("In disconnect pft1000info=%x\n", (unsigned
int)pft1000info);	// aelias [+] reason: up

-
-
-    if (pft1000info)
-    {
+	if (pft1000info) {
 		ft1000CleanupProc(pft1000info);	//+mbelian
-        if ( pft1000info->pPollThread )
-        {
-            kthread_stop(pft1000info->pPollThread );
-        }
-
-        DEBUG("ft1000_disconnect: threads are terminated\n");
+		if (pft1000info->pPollThread) {
+			kthread_stop(pft1000info->pPollThread);
+		}

-        if (pft1000info->pFt1000Dev->net)
-        {
-            DEBUG("ft1000_disconnect: destroy char driver\n");
-            ft1000_DestroyDevice(pft1000info->pFt1000Dev->net);
-            //DEBUG("ft1000_disconnect: calling ft1000_close\n");
-            //ft1000_close(pft1000info->pFt1000Dev->net);
-            //DEBUG("ft1000_disconnect: ft1000_close is called\n");
-            unregister_netdev(pft1000info->pFt1000Dev->net);
-            DEBUG("ft1000_disconnect: network device unregisterd\n");
-            free_netdev(pft1000info->pFt1000Dev->net);
+		DEBUG("ft1000_disconnect: threads are terminated\n");

-        }
+		if (pft1000info->pFt1000Dev->net) {
+			DEBUG("ft1000_disconnect: destroy char driver\n");
+			ft1000_DestroyDevice(pft1000info->pFt1000Dev->net);
+			//DEBUG("ft1000_disconnect: calling ft1000_close\n");
+			//ft1000_close(pft1000info->pFt1000Dev->net);
+			//DEBUG("ft1000_disconnect: ft1000_close is called\n");
+			unregister_netdev(pft1000info->pFt1000Dev->net);
+			DEBUG
+			    ("ft1000_disconnect: network device unregisterd\n");
+			free_netdev(pft1000info->pFt1000Dev->net);

-        usb_free_urb(pft1000info->pFt1000Dev->rx_urb);
-        usb_free_urb(pft1000info->pFt1000Dev->tx_urb);
+		}

-        DEBUG("ft1000_disconnect: urb freed\n");
+		usb_free_urb(pft1000info->pFt1000Dev->rx_urb);
+		usb_free_urb(pft1000info->pFt1000Dev->tx_urb);

-		kfree(pft1000info->pFt1000Dev); //+mbelian
-    }
+		DEBUG("ft1000_disconnect: urb freed\n");

-    //terminate other kernel threads
-    //in multiple instances case, first find the device
-    //in the link list
+		kfree(pft1000info->pFt1000Dev);	//+mbelian
+	}
+	//terminate other kernel threads
+	//in multiple instances case, first find the device
+	//in the link list
     /**if (pPollThread)
     {
         kthread_stop(pPollThread);
         DEBUG("Polling thread is killed \n");
     }**/

-    return;
+	return;
 }

 static struct usb_driver ft1000_usb_driver = {
-    //.owner =    THIS_MODULE,
-    .name  =    "ft1000usb",
-    .probe =    ft1000_probe,
-    .disconnect = ft1000_disconnect,
-    .id_table = id_table,
+	//.owner =    THIS_MODULE,
+	.name = "ft1000usb",
+	.probe = ft1000_probe,
+	.disconnect = ft1000_disconnect,
+	.id_table = id_table,
 };

 //---------------------------------------------------------------------------
@@ -314,15 +317,15 @@ static struct usb_driver ft1000_usb_driver = {
 //---------------------------------------------------------------------------
 static int __init usb_ft1000_init(void)
 {
-    int ret = 0;
+	int ret = 0;

-    DEBUG("Initialize and register the driver\n");
+	DEBUG("Initialize and register the driver\n");

-    ret = usb_register(&ft1000_usb_driver);
-    if (ret)
-        err("usb_register failed. Error number %d", ret);
+	ret = usb_register(&ft1000_usb_driver);
+	if (ret)
+		err("usb_register failed. Error number %d", ret);

-    return ret;
+	return ret;
 }

 //---------------------------------------------------------------------------
@@ -339,11 +342,9 @@ static int __init usb_ft1000_init(void)
 //---------------------------------------------------------------------------
 static void __exit usb_ft1000_exit(void)
 {
-    DEBUG("Deregister the driver\n");
-    usb_deregister(&ft1000_usb_driver);
+	DEBUG("Deregister the driver\n");
+	usb_deregister(&ft1000_usb_driver);
 }

-module_init (usb_ft1000_init);
-module_exit (usb_ft1000_exit);
-
-
+module_init(usb_ft1000_init);
+module_exit(usb_ft1000_exit);
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
index b0c611b..bea6e95 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
@@ -19,26 +19,23 @@
 #define GET_DRV_ERR_RPT_MSG  0x0073
 #define RSP_DRV_ERR_RPT_MSG  0x0074

-
 // Size of DPRAM Command
 #define MAX_CMD_SQSIZE          1780
 #define SLOWQ_TYPE              0
 #define PSEUDOSZ                16
 #define DSP_QID_OFFSET          4

-
 // MEMORY MAP FOR ELECTRABUZZ ASIC
 #define	FT1000_REG_DFIFO_STAT	0x0008	// Downlink FIFO status register
 #define	FT1000_REG_DPRAM_DATA	0x000C	// DPRAM VALUE in DPRAM ADDR

-#define FT1000_DSP_LED          0xFFA  // dsp led status for PAD device
+#define FT1000_DSP_LED          0xFFA	// dsp led status for PAD device

-#define FT1000_MAG_DSP_LED               0x3FE   // dsp led status
for PAD device
-#define FT1000_MAG_DSP_LED_INDX          0x1     // dsp led status
for PAD device
+#define FT1000_MAG_DSP_LED               0x3FE	// dsp led status for PAD device
+#define FT1000_MAG_DSP_LED_INDX          0x1	// dsp led status for PAD device

 #define  SUCCESS             0x00

-
 #define DRIVERID                0x00

 // Driver Error Messages for DSP
@@ -46,10 +43,8 @@
 #define DSP_HB_INFO          0x7ef0

 // Magnemite specific defines
-#define hi_mag                  0x6968  // Byte swap hi to avoid
additional system call
-#define ho_mag                  0x6f68  // Byte swap ho to avoid
additional system call
-
-
+#define hi_mag                  0x6968	// Byte swap hi to avoid
additional system call
+#define ho_mag                  0x6f68	// Byte swap ho to avoid
additional system call

 typedef struct _MEDIAMSG {
 	PSEUDO_HDR pseudo;
@@ -57,43 +52,41 @@ typedef struct _MEDIAMSG {
 	u16 length;
 	u16 state;
 	u32 ip_addr;
-        u32 net_mask;
+	u32 net_mask;
 	u32 gateway;
 	u32 dns_1;
 	u32 dns_2;
 } __attribute__ ((packed)) MEDIAMSG, *PMEDIAMSG;

 typedef struct _DSPINITMSG {
-    PSEUDO_HDR pseudo;
-    u16 type;
-    u16 length;
-    u8 DspVer[DSPVERSZ];        // DSP version number
-    u8 HwSerNum[HWSERNUMSZ];    // Hardware Serial Number
-    u8 Sku[SKUSZ];              // SKU
-    u8 eui64[EUISZ];            // EUI64
-    u8 ProductMode[MODESZ];     // Product Mode (Market/Production)
-    u8 RfCalVer[CALVERSZ];      // Rf Calibration version
-    u8 RfCalDate[CALDATESZ];    // Rf Calibration date
+	PSEUDO_HDR pseudo;
+	u16 type;
+	u16 length;
+	u8 DspVer[DSPVERSZ];	// DSP version number
+	u8 HwSerNum[HWSERNUMSZ];	// Hardware Serial Number
+	u8 Sku[SKUSZ];		// SKU
+	u8 eui64[EUISZ];	// EUI64
+	u8 ProductMode[MODESZ];	// Product Mode (Market/Production)
+	u8 RfCalVer[CALVERSZ];	// Rf Calibration version
+	u8 RfCalDate[CALDATESZ];	// Rf Calibration date
 } __attribute__ ((packed)) DSPINITMSG, *PDSPINITMSG;

-
-typedef struct _APP_INFO_BLOCK
-{
-    u32 nTxMsg;                    // DPRAM msg sent to DSP with app_id
-    u32 nRxMsg;                    // DPRAM msg rcv from dsp with app_id
-    u32 nTxMsgReject;              // DPRAM msg rejected due to DSP
doorbell set
-    u32 nRxMsgMiss;                // DPRAM msg dropped due to overflow
-    u32 fileobject;                // Application's file object
-    u16 app_id;                    // Application id
-    int DspBCMsgFlag;
-    int NumOfMsg;                   // number of messages queued up
-    wait_queue_head_t	wait_dpram_msg;
-    struct list_head app_sqlist;   // link list of msgs for
applicaton on slow queue
+typedef struct _APP_INFO_BLOCK {
+	u32 nTxMsg;		// DPRAM msg sent to DSP with app_id
+	u32 nRxMsg;		// DPRAM msg rcv from dsp with app_id
+	u32 nTxMsgReject;	// DPRAM msg rejected due to DSP doorbell set
+	u32 nRxMsgMiss;		// DPRAM msg dropped due to overflow
+	u32 fileobject;		// Application's file object
+	u16 app_id;		// Application id
+	int DspBCMsgFlag;
+	int NumOfMsg;		// number of messages queued up
+	wait_queue_head_t wait_dpram_msg;
+	struct list_head app_sqlist;	// link list of msgs for applicaton on slow queue
 } APP_INFO_BLOCK, *PAPP_INFO_BLOCK;

 typedef struct _PROV_RECORD {
-    struct list_head list;
-    u8 *pprov_data;
+	struct list_head list;
+	u8 *pprov_data;
 } PROV_RECORD, *PPROV_RECORD;

 /*end of Jim*/
@@ -149,7 +142,6 @@ typedef struct _PROV_RECORD {
 #define ENET_MAX_SIZE           1514
 #define ENET_HEADER_SIZE        14

-
 #define CIS_NET_ADDR_OFFSET 0xff0

 #define MEM_TAG 'FLRN'
@@ -159,122 +151,104 @@ typedef struct _PROV_RECORD {

 #define FT1000_REG_MAG_UFDRL		0x0000	// Uplink FIFO Data Register low-word.

-#define FT1000_REG_MAG_UFDRH		0x0002  // Uplink FIFO Data Register high-word.
+#define FT1000_REG_MAG_UFDRH		0x0002	// Uplink FIFO Data Register high-word.

-#define FT1000_REG_MAG_UFER			0x0004  // Uplink FIFO End Register
+#define FT1000_REG_MAG_UFER			0x0004	// Uplink FIFO End Register

-#define FT1000_REG_MAG_UFSR			0x0006  // Uplink FIFO Status Register
+#define FT1000_REG_MAG_UFSR			0x0006	// Uplink FIFO Status Register

 #define FT1000_REG_MAG_DFR			0x0008	// Downlink FIFO Register

 #define FT1000_REG_MAG_DFRL			0x0008	// Downlink FIFO Register low-word

-#define FT1000_REG_MAG_DFRH			0x000a  // Downlink FIFO Register high-word
+#define FT1000_REG_MAG_DFRH			0x000a	// Downlink FIFO Register high-word

-#define FT1000_REG_MAG_DFSR			0x000c  // Downlink FIFO Status Register
+#define FT1000_REG_MAG_DFSR			0x000c	// Downlink FIFO Status Register

-#define FT1000_REG_MAG_DPDATA		0x0010  // Dual Port RAM Indirect Data Register
+#define FT1000_REG_MAG_DPDATA		0x0010	// Dual Port RAM Indirect Data Register

-#define FT1000_REG_MAG_DPDATAL		0x0010  // Dual Port RAM Indirect
Data Register low-word
+#define FT1000_REG_MAG_DPDATAL		0x0010	// Dual Port RAM Indirect Data
Register low-word

-#define FT1000_REG_MAG_DPDATAH		0x0012  // Dual Port RAM Indirect
Data Register high-word
-
-#define	FT1000_REG_MAG_WATERMARK	0x002c	// Supv. Control Reg.			LLC register
-
-#define FT1000_REG_MAG_VERSION		0x0030	// LLC Version					LLC register
+#define FT1000_REG_MAG_DPDATAH		0x0012	// Dual Port RAM Indirect Data
Register high-word

+#define	FT1000_REG_MAG_WATERMARK	0x002c	// Supv. Control Reg.
          LLC register

+#define FT1000_REG_MAG_VERSION		0x0030	// LLC Version
                 LLC register

 // Common

 #define	FT1000_REG_DPRAM_ADDR	0x000E	// DPRAM ADDRESS when card in IO mode

-#define	FT1000_REG_SUP_CTRL		0x0020	// Supv. Control Reg.			LLC register
+#define	FT1000_REG_SUP_CTRL		0x0020	// Supv. Control Reg.
      LLC register

-#define	FT1000_REG_SUP_STAT		0x0022	// Supv. Status Reg				LLC register
+#define	FT1000_REG_SUP_STAT		0x0022	// Supv. Status Reg
              LLC register

-#define	FT1000_REG_RESET		0x0024	// Reset Reg					LLC register
+#define	FT1000_REG_RESET		0x0024	// Reset Reg
           LLC register

-#define	FT1000_REG_SUP_ISR		0x0026	// Supv ISR						LLC register
+#define	FT1000_REG_SUP_ISR		0x0026	// Supv ISR
                     LLC register

-#define	FT1000_REG_SUP_IMASK	0x0028	// Supervisor Interrupt Mask	LLC register
+#define	FT1000_REG_SUP_IMASK	0x0028	// Supervisor Interrupt Mask
LLC register

-#define	FT1000_REG_DOORBELL		0x002a	// Door Bell Reg				LLC register
+#define	FT1000_REG_DOORBELL		0x002a	// Door Bell Reg
              LLC register

-#define FT1000_REG_ASIC_ID      0x002e  // ASIC Identification Number
+#define FT1000_REG_ASIC_ID      0x002e	// ASIC Identification Number

 										// (Electrabuzz=0 Magnemite=TBD)

-
-
 // DSP doorbells

 #define FT1000_DB_DPRAM_RX		0x0001	// this value indicates that DSP has

-                                        //      data for host in DPRAM SlowQ
+					//      data for host in DPRAM SlowQ

-#define FT1000_DB_DNLD_RX       0x0002  // Downloader handshake doorbell
+#define FT1000_DB_DNLD_RX       0x0002	// Downloader handshake doorbell

 #define FT1000_ASIC_RESET_REQ   0x0004

 #define FT1000_DSP_ASIC_RESET   0x0008

-
-
 #define FT1000_DB_COND_RESET    0x0010

-
-
 // Host doorbells

 #define FT1000_DB_DPRAM_TX		0x0100	// this value indicates that host has

-                                        //      data for DSP in DPRAM.
+					//      data for DSP in DPRAM.

-#define FT1000_DB_DNLD_TX       0x0200  // Downloader handshake doorbell
+#define FT1000_DB_DNLD_TX       0x0200	// Downloader handshake doorbell

 #define FT1000_ASIC_RESET_DSP   0x0400

-#define FT1000_DB_HB            0x1000  // this value indicates that supervisor
-
-
+#define FT1000_DB_HB            0x1000	// this value indicates that supervisor

 // Electrabuzz specific DPRAM mapping
       //      has a heartbeat message for DSP.

-#define FT1000_DPRAM_BASE		0x1000	//  0x0000 to 0x07FF	DPRAM	2Kx16 -
R/W from PCMCIA or DSP
+#define FT1000_DPRAM_BASE		0x1000	//  0x0000 to 0x07FF    DPRAM
2Kx16 - R/W from PCMCIA or DSP

 #define FT1000_DPRAM_TX_BASE	0x1002	//  TX AREA (SlowQ)

 #define FT1000_DPRAM_RX_BASE	0x1800	//  RX AREA (SlowQ)

-#define FT1000_DPRAM_SIZE       0x1000  //  4K bytes
+#define FT1000_DPRAM_SIZE       0x1000	//  4K bytes

+#define FT1000_DRV_DEBUG        0x17E0	// Debug area for driver

+#define FT1000_FIFO_LEN         0x17FC	// total length for DSP FIFO tracking

-#define FT1000_DRV_DEBUG        0x17E0  // Debug area for driver
+#define FT1000_HI_HO            0x17FE	// heartbeat with HI/HO

-#define FT1000_FIFO_LEN         0x17FC  // total length for DSP FIFO tracking
+#define FT1000_DSP_STATUS       0x1FFE	// dsp status - non-zero is a
request to reset dsp

-#define FT1000_HI_HO            0x17FE  // heartbeat with HI/HO
+#define FT1000_DSP_CON_STATE    0x1FF8	// DSP Connection Status Info

-#define FT1000_DSP_STATUS       0x1FFE  // dsp status - non-zero is a
request to reset dsp
-
-
-
-#define FT1000_DSP_CON_STATE    0x1FF8  // DSP Connection Status Info
-
-#define FT1000_DSP_LEDS         0x1FFA  // DSP LEDS for rcv pwr
strength, Rx data, Tx data
-
-#define DSP_TIMESTAMP           0x1FFC  // dsp timestamp
-
-#define DSP_TIMESTAMP_DIFF      0x1FFA  // difference of dsp
timestamp in DPRAM and Pseudo header.
+#define FT1000_DSP_LEDS         0x1FFA	// DSP LEDS for rcv pwr
strength, Rx data, Tx data

+#define DSP_TIMESTAMP           0x1FFC	// dsp timestamp

+#define DSP_TIMESTAMP_DIFF      0x1FFA	// difference of dsp timestamp
in DPRAM and Pseudo header.

 #define FT1000_DPRAM_FEFE    	0x1002	// Dsp Downloader handshake location

-
-
 #define FT1000_DSP_TIMER0       0x1FF0

 #define FT1000_DSP_TIMER1       0x1FF2
@@ -283,84 +257,60 @@ typedef struct _PROV_RECORD {

 #define FT1000_DSP_TIMER3       0x1FF6

-
-
 // MEMORY MAP FOR MAGNEMITE

-#define FT1000_DPRAM_MAG_TX_BASE	 	 0x0000	 //  TX AREA (SlowQ)
-
-#define FT1000_DPRAM_MAG_RX_BASE		 0x0200	 //  RX AREA (SlowQ)
+#define FT1000_DPRAM_MAG_TX_BASE	 	 0x0000	//  TX AREA (SlowQ)

+#define FT1000_DPRAM_MAG_RX_BASE		 0x0200	//  RX AREA (SlowQ)

+#define FT1000_MAG_FIFO_LEN              0x1FF	// total length for
DSP FIFO tracking

-#define FT1000_MAG_FIFO_LEN              0x1FF   // total length for
DSP FIFO tracking
+#define FT1000_MAG_FIFO_LEN_INDX         0x1	// low-word index

-#define FT1000_MAG_FIFO_LEN_INDX         0x1     // low-word index
+#define FT1000_MAG_HI_HO                 0x1FF	// heartbeat with HI/HO

-#define FT1000_MAG_HI_HO                 0x1FF   // heartbeat with HI/HO
+#define FT1000_MAG_HI_HO_INDX            0x0	// high-word index

-#define FT1000_MAG_HI_HO_INDX            0x0     // high-word index
+#define FT1000_MAG_DSP_LEDS              0x3FE	// dsp led status for PAD device

-#define FT1000_MAG_DSP_LEDS              0x3FE   // dsp led status
for PAD device
+#define FT1000_MAG_DSP_LEDS_INDX         0x1	// dsp led status for PAD device

-#define FT1000_MAG_DSP_LEDS_INDX         0x1     // dsp led status
for PAD device
+#define FT1000_MAG_DSP_CON_STATE         0x3FE	// DSP Connection Status Info

+#define FT1000_MAG_DSP_CON_STATE_INDX    0x0	// DSP Connection Status Info

+#define FT1000_MAG_DPRAM_FEFE            0x000	// location for dsp
ready indicator

-#define FT1000_MAG_DSP_CON_STATE         0x3FE   // DSP Connection Status Info
-
-#define FT1000_MAG_DSP_CON_STATE_INDX    0x0     // DSP Connection Status Info
-
-
-
-#define FT1000_MAG_DPRAM_FEFE            0x000   // location for dsp
ready indicator
-
-#define FT1000_MAG_DPRAM_FEFE_INDX       0x0     // location for dsp
ready indicator
-
-
+#define FT1000_MAG_DPRAM_FEFE_INDX       0x0	// location for dsp
ready indicator

 #define FT1000_MAG_DSP_TIMER0            0x3FC

 #define FT1000_MAG_DSP_TIMER0_INDX       0x1

-
-
 #define FT1000_MAG_DSP_TIMER1            0x3FC

 #define FT1000_MAG_DSP_TIMER1_INDX       0x0

-
-
 #define FT1000_MAG_DSP_TIMER2            0x3FD

 #define FT1000_MAG_DSP_TIMER2_INDX       0x1

-
-
 #define FT1000_MAG_DSP_TIMER3            0x3FD

 #define FT1000_MAG_DSP_TIMER3_INDX       0x0

-
-
 #define FT1000_MAG_TOTAL_LEN             0x200

 #define FT1000_MAG_TOTAL_LEN_INDX        0x1

-
-
 #define FT1000_MAG_PH_LEN                0x200

 #define FT1000_MAG_PH_LEN_INDX           0x0

-
-
 #define FT1000_MAG_PORT_ID               0x201

 #define FT1000_MAG_PORT_ID_INDX          0x0

-
-
 //

 // Constants for the FT1000_REG_SUP_ISR
@@ -373,19 +323,15 @@ typedef struct _PROV_RECORD {

 // SUPERVISOR ISR BIT MAPS

+#define ISR_EMPTY			(UCHAR)0x00	// no bits set in ISR

+#define ISR_DOORBELL_ACK	(UCHAR)0x01	//  the doorbell i sent has been recieved.

-#define ISR_EMPTY			(UCHAR)0x00 	 // no bits set in ISR
-
-#define ISR_DOORBELL_ACK	(UCHAR)0x01		 //  the doorbell i sent has
been recieved.
-
-#define ISR_DOORBELL_PEND	(UCHAR)0x02 	 //  doorbell for me
-
-#define ISR_RCV				(UCHAR)0x04 	 // packet received with no errors
-
-#define ISR_WATERMARK		(UCHAR)0x08 	 //
+#define ISR_DOORBELL_PEND	(UCHAR)0x02	//  doorbell for me

+#define ISR_RCV				(UCHAR)0x04	// packet received with no errors

+#define ISR_WATERMARK		(UCHAR)0x08	//

 // Interrupt mask register defines

@@ -399,52 +345,36 @@ typedef struct _PROV_RECORD {

 #define ISR_MASK_RCV			0x0004

-#define ISR_MASK_WATERMARK		0x0008 	  // Normally we will only mask
the watermark interrupt when we want to enable interrupts.
+#define ISR_MASK_WATERMARK		0x0008	// Normally we will only mask the
watermark interrupt when we want to enable interrupts.

 #define ISR_MASK_ALL			0xffff

+#define HOST_INTF_LE            0x0000	// Host interface little endian

-
-#define HOST_INTF_LE            0x0000    // Host interface little endian
-
-#define HOST_INTF_BE            0x0001    // Host interface big endian
-
-
+#define HOST_INTF_BE            0x0001	// Host interface big endian

 #define ISR_DEFAULT_MASK		0x7ff9

-
-
 #define hi                      0x6869

 #define ho                      0x686f

+#define FT1000_ASIC_RESET       0x80	// COR value for soft reset to PCMCIA core

+#define FT1000_ASIC_BITS        0x51	// Bits set in COR register
under normal operation

-#define FT1000_ASIC_RESET       0x80     // COR value for soft reset
to PCMCIA core
-
-#define FT1000_ASIC_BITS        0x51     // Bits set in COR register
under normal operation
-
-#define FT1000_ASIC_MAG_BITS    0x55     // Bits set in COR register
under normal operation
-
-
+#define FT1000_ASIC_MAG_BITS    0x55	// Bits set in COR register
under normal operation

 #define FT1000_COR_OFFSET       0x100

+#define ELECTRABUZZ_ID			0	// ASIC ID for ELECTRABUZZ

-
-#define ELECTRABUZZ_ID			0        // ASIC ID for ELECTRABUZZ
-
-#define MAGNEMITE_ID			0x1a01   // ASIC ID for MAGNEMITE
-
-
+#define MAGNEMITE_ID			0x1a01	// ASIC ID for MAGNEMITE

 // Maximum times trying to get ASIC out of reset

 #define MAX_ASIC_RESET_CNT      20

-
-
 #define DSP_RESET_BIT           0x1

 #define ASIC_RESET_BIT          0x2
@@ -455,53 +385,47 @@ typedef struct _PROV_RECORD {

 #define EFUSE_MEM_DISABLE       0x0040

-
 #define MAX_BUF_SIZE            4096

-
-#if 0 //Removed by Jim
+#if 0				//Removed by Jim
 typedef struct _PSEUDO_HDR
-
 {

-   unsigned short    length;
-
-   unsigned char     source;
+	unsigned short length;

-   unsigned char     destination;
+	unsigned char source;

-   unsigned char     portdest;
+	unsigned char destination;

-   unsigned char     portsrc;
+	unsigned char portdest;

-   unsigned short    sh_str_id;
+	unsigned char portsrc;

-   unsigned char     control;
+	unsigned short sh_str_id;

-   unsigned char     rsvd1;
+	unsigned char control;

-   unsigned char     seq_num;
+	unsigned char rsvd1;

-   unsigned char     rsvd2;
+	unsigned char seq_num;

-   unsigned short    qos_class;
-
-   unsigned short    checksum;
+	unsigned char rsvd2;

+	unsigned short qos_class;

+	unsigned short checksum;

 } PSEUDO_HDR, *PPSEUDO_HDR;
 #endif //end of Jim

 typedef struct _DRVMSG {
-        PSEUDO_HDR pseudo;
-        u16 type;
-        u16 length;
-        u8  data[0];
+	PSEUDO_HDR pseudo;
+	u16 type;
+	u16 length;
+	u8 data[0];
 } __attribute__ ((packed)) DRVMSG, *PDRVMSG;

-struct ft1000_device
-{
+struct ft1000_device {
 	struct usb_device *dev;
 	struct net_device *net;
 	spinlock_t device_lock;
@@ -521,89 +445,87 @@ struct ft1000_device

 	//struct ft1000_ethernet_configuration configuration;

-//	struct net_device_stats stats; //mbelian
+//      struct net_device_stats stats; //mbelian
 } __attribute__ ((packed));

 typedef struct _FT1000_INFO {
-    struct ft1000_device *pFt1000Dev;
-    struct net_device_stats stats;
+	struct ft1000_device *pFt1000Dev;
+	struct net_device_stats stats;

-    struct task_struct *pPollThread;
+	struct task_struct *pPollThread;

-    unsigned char fcodeldr;
-    unsigned char bootmode;
+	unsigned char fcodeldr;
+	unsigned char bootmode;
 	unsigned char usbboot;
-    unsigned short dspalive;
-    u16 ASIC_ID;
-    BOOLEAN fProvComplete;
-    BOOLEAN fCondResetPend;
-    BOOLEAN fAppMsgPend;
-    char *pfwimg;
-    int fwimgsz;
-    u16 DrvErrNum;
-    u8  *pTestImage;
-    u16 AsicID;
-    unsigned long TestImageIndx;
-    unsigned long TestImageSz;
-    u8  TestImageEnable;
-    u8  TestImageReady;
-    int ASICResetNum;
-    int DspAsicReset;
-    int PktIntfErr;
-    int DSPResetNum;
-    int NumIOCTLBufs;
-    int IOCTLBufLvl;
-    int DeviceCreated;
-    int CardReady;
-    int DSP_loading;
-    int NetDevRegDone;
-    u8 CardNumber;
-    u8 DeviceName[15];
-    int DeviceMajor;
-    int registered;
-    int mediastate;
-    int dhcpflg;
-    u16 packetseqnum;
-    u8 squeseqnum;                 // sequence number on slow queue
-    spinlock_t dpram_lock;
-    spinlock_t fifo_lock;
-    u16 CurrentInterruptEnableMask;
-    int InterruptsEnabled;
-    u16 fifo_cnt;
-    u8 DspVer[DSPVERSZ];        // DSP version number
-    u8 HwSerNum[HWSERNUMSZ];    // Hardware Serial Number
-    u8 Sku[SKUSZ];              // SKU
-    u8 eui64[EUISZ];            // EUI64
-    time_t ConTm;               // Connection Time
-    u8 ProductMode[MODESZ];
-    u8 RfCalVer[CALVERSZ];
-    u8 RfCalDate[CALDATESZ];
-    u16 DSP_TIME[4];
-    u16 ProgSnr;
-    u16 LedStat;	//mbelian
-    u16 ConStat;	//mbelian
-    u16 ProgConStat;
-    struct list_head prov_list;
-    int appcnt;
-    APP_INFO_BLOCK app_info[MAX_NUM_APP]; //Added by Jim
-    u16 DSPInfoBlklen;
-    u16 DrvMsgPend;
-    int (*ft1000_reset)(struct net_device *dev);
-    u16 DSPInfoBlk[MAX_DSP_SESS_REC];
-    union {
-        u16 Rec[MAX_DSP_SESS_REC];
-        u32 MagRec[MAX_DSP_SESS_REC/2];
-    } DSPSess;
+	unsigned short dspalive;
+	u16 ASIC_ID;
+	BOOLEAN fProvComplete;
+	BOOLEAN fCondResetPend;
+	BOOLEAN fAppMsgPend;
+	char *pfwimg;
+	int fwimgsz;
+	u16 DrvErrNum;
+	u8 *pTestImage;
+	u16 AsicID;
+	unsigned long TestImageIndx;
+	unsigned long TestImageSz;
+	u8 TestImageEnable;
+	u8 TestImageReady;
+	int ASICResetNum;
+	int DspAsicReset;
+	int PktIntfErr;
+	int DSPResetNum;
+	int NumIOCTLBufs;
+	int IOCTLBufLvl;
+	int DeviceCreated;
+	int CardReady;
+	int DSP_loading;
+	int NetDevRegDone;
+	u8 CardNumber;
+	u8 DeviceName[15];
+	int DeviceMajor;
+	int registered;
+	int mediastate;
+	int dhcpflg;
+	u16 packetseqnum;
+	u8 squeseqnum;		// sequence number on slow queue
+	spinlock_t dpram_lock;
+	spinlock_t fifo_lock;
+	u16 CurrentInterruptEnableMask;
+	int InterruptsEnabled;
+	u16 fifo_cnt;
+	u8 DspVer[DSPVERSZ];	// DSP version number
+	u8 HwSerNum[HWSERNUMSZ];	// Hardware Serial Number
+	u8 Sku[SKUSZ];		// SKU
+	u8 eui64[EUISZ];	// EUI64
+	time_t ConTm;		// Connection Time
+	u8 ProductMode[MODESZ];
+	u8 RfCalVer[CALVERSZ];
+	u8 RfCalDate[CALDATESZ];
+	u16 DSP_TIME[4];
+	u16 ProgSnr;
+	u16 LedStat;		//mbelian
+	u16 ConStat;		//mbelian
+	u16 ProgConStat;
+	struct list_head prov_list;
+	int appcnt;
+	APP_INFO_BLOCK app_info[MAX_NUM_APP];	//Added by Jim
+	u16 DSPInfoBlklen;
+	u16 DrvMsgPend;
+	int (*ft1000_reset) (struct net_device * dev);
+	u16 DSPInfoBlk[MAX_DSP_SESS_REC];
+	union {
+		u16 Rec[MAX_DSP_SESS_REC];
+		u32 MagRec[MAX_DSP_SESS_REC / 2];
+	} DSPSess;
 	unsigned short tempbuf[32];
 	char netdevname[IFNAMSIZ];
-	struct proc_dir_entry *ft1000_proc_dir; //mbelian
+	struct proc_dir_entry *ft1000_proc_dir;	//mbelian
 } FT1000_INFO, *PFT1000_INFO;

-
 typedef struct _DPRAM_BLK {
-    struct list_head list;
-    u16 *pbuffer;
+	struct list_head list;
+	u16 *pbuffer;
 } __attribute__ ((packed)) DPRAM_BLK, *PDPRAM_BLK;

-
 #endif
-- 
1.7.1
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux