linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and some warnings.
@ 2014-06-02  2:26 Thomas Wood
  2014-06-02 10:30 ` Dan Carpenter
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas Wood @ 2014-06-02  2:26 UTC (permalink / raw)
  To: marek.belisko; +Cc: gregkh, devel, linux-kernel, Thomas Wood

Don't use spaces as tabs, and fix other style errors and warnings.

Signed-off-by: Thomas Wood <tommyandrena@gmail.com>
---

I think that this is correctly indented now, but I didn't touch the double parentheses on line 322 because I wasn't sure if they were necessary or not.

 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 960 +++++++++++------------
 1 file changed, 475 insertions(+), 485 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index a8945b7..af0844f 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -38,12 +38,12 @@
 #include <linux/debugfs.h>
 #include "ft1000_usb.h"
 
-static int ft1000_flarion_cnt = 0;
+static int ft1000_flarion_cnt;
 
 static int ft1000_open(struct inode *inode, struct file *file);
 static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait);
 static long ft1000_ioctl(struct file *file, unsigned int command,
-                           unsigned long argument);
+			   unsigned long argument);
 static int ft1000_release(struct inode *inode, struct file *file);
 
 /* List to free receive command buffer pool */
@@ -81,23 +81,23 @@ static const struct file_operations ft1000fops = {
 */
 struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist)
 {
-    unsigned long flags;
+	unsigned long flags;
 	struct dpram_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, struct 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;
+	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, struct 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;
 }
 
 
@@ -119,14 +119,14 @@ struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist)
 */
 void ft1000_free_buffer(struct dpram_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);
 }
 
 /*
@@ -145,25 +145,25 @@ void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist)
 */
 int ft1000_create_dev(struct ft1000_usb *dev)
 {
-    int result;
-    int i;
+	int result;
+	int i;
 	struct dentry *dir, *file;
 	struct ft1000_debug_dirs *tmp;
 
-    /* make a new device name */
-    sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber);
+	/* make a new device name */
+	sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber);
 
-    DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt);
-    DEBUG("DeviceCreated = %x\n", dev->DeviceCreated);
+	DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt);
+	DEBUG("DeviceCreated = %x\n", dev->DeviceCreated);
 
-    if (dev->DeviceCreated) {
-	DEBUG("%s: \"%s\" already registered\n", __func__, dev->DeviceName);
-	return -EIO;
-    }
+	if (dev->DeviceCreated) {
+		DEBUG("%s: \"%s\" already registered\n", __func__, dev->DeviceName);
+		return -EIO;
+	}
 
 
-    /* register the device */
-    DEBUG("%s: \"%s\" debugfs device registration\n", __func__, dev->DeviceName);
+	/* register the device */
+	DEBUG("%s: \"%s\" debugfs device registration\n", __func__, dev->DeviceName);
 
 	tmp = kmalloc(sizeof(struct ft1000_debug_dirs), GFP_KERNEL);
 	if (tmp == NULL) {
@@ -189,25 +189,25 @@ int ft1000_create_dev(struct ft1000_usb *dev)
 	tmp->int_number = dev->CardNumber;
 	list_add(&(tmp->list), &(dev->nodes.list));
 
-    DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, dev->DeviceName);
-
-    /* initialize application information */
-    dev->appcnt = 0;
-    for (i=0; i<MAX_NUM_APP; i++) {
-        dev->app_info[i].nTxMsg = 0;
-        dev->app_info[i].nRxMsg = 0;
-        dev->app_info[i].nTxMsgReject = 0;
-        dev->app_info[i].nRxMsgMiss = 0;
-        dev->app_info[i].fileobject = NULL;
-        dev->app_info[i].app_id = i+1;
-        dev->app_info[i].DspBCMsgFlag = 0;
-        dev->app_info[i].NumOfMsg = 0;
-        init_waitqueue_head(&dev->app_info[i].wait_dpram_msg);
-        INIT_LIST_HEAD(&dev->app_info[i].app_sqlist);
-    }
-
-    dev->DeviceCreated = TRUE;
-    ft1000_flarion_cnt++;
+	DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, dev->DeviceName);
+
+	/* initialize application information */
+	dev->appcnt = 0;
+	for (i = 0; i < MAX_NUM_APP; i++) {
+		dev->app_info[i].nTxMsg = 0;
+		dev->app_info[i].nRxMsg = 0;
+		dev->app_info[i].nTxMsgReject = 0;
+		dev->app_info[i].nRxMsgMiss = 0;
+		dev->app_info[i].fileobject = NULL;
+		dev->app_info[i].app_id = i+1;
+		dev->app_info[i].DspBCMsgFlag = 0;
+		dev->app_info[i].NumOfMsg = 0;
+		init_waitqueue_head(&dev->app_info[i].wait_dpram_msg);
+		INIT_LIST_HEAD(&dev->app_info[i].app_sqlist);
+	}
+
+	dev->DeviceCreated = TRUE;
+	ft1000_flarion_cnt++;
 
 	return 0;
 
@@ -241,12 +241,12 @@ void ft1000_destroy_dev(struct net_device *netdev)
 	struct list_head *pos, *q;
 	struct ft1000_debug_dirs *dir;
 
-    DEBUG("%s called\n", __func__);
+	DEBUG("%s called\n", __func__);
 
 
 
-    if (dev->DeviceCreated) {
-        ft1000_flarion_cnt--;
+	if (dev->DeviceCreated) {
+		ft1000_flarion_cnt--;
 		list_for_each_safe(pos, q, &dev->nodes.list) {
 			dir = list_entry(pos, struct ft1000_debug_dirs, list);
 			if (dir->int_number == dev->CardNumber) {
@@ -259,26 +259,26 @@ void ft1000_destroy_dev(struct net_device *netdev)
 		DEBUG("%s: unregistered device \"%s\"\n", __func__,
 					   dev->DeviceName);
 
-        /* Make sure we free any memory reserve for slow Queue */
-        for (i=0; i<MAX_NUM_APP; i++) {
-            while (list_empty(&dev->app_info[i].app_sqlist) == 0) {
-                pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
-                list_del(&pdpram_blk->list);
-                ft1000_free_buffer(pdpram_blk, &freercvpool);
-
-            }
-            wake_up_interruptible(&dev->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, struct dpram_blk, list);
-                list_del(&ptr->list);
-                kfree(ptr->pbuffer);
-                kfree(ptr);
-            }
-        }
+	/* Make sure we free any memory reserve for slow Queue */
+	for (i = 0; i < MAX_NUM_APP; i++) {
+		while (list_empty(&dev->app_info[i].app_sqlist) == 0) {
+			pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
+			list_del(&pdpram_blk->list);
+			ft1000_free_buffer(pdpram_blk, &freercvpool);
+
+		}
+		wake_up_interruptible(&dev->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, struct dpram_blk, list);
+			list_del(&ptr->list);
+			kfree(ptr->pbuffer);
+			kfree(ptr);
+		}
+	}
 		dev->DeviceCreated = FALSE;
 	}
 
@@ -301,44 +301,43 @@ static int ft1000_open(struct inode *inode, struct file *file)
 {
 	struct ft1000_info *info;
 	struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private;
-    int i,num;
+	int i, num;
 
-    DEBUG("%s called\n", __func__);
-    num = (MINOR(inode->i_rdev) & 0xf);
-    DEBUG("ft1000_open: minor number=%d\n", num);
+	DEBUG("%s called\n", __func__);
+	num = (MINOR(inode->i_rdev) & 0xf);
+	DEBUG("ft1000_open: minor number=%d\n", num);
 
 	info = file->private_data = netdev_priv(dev->net);
 
-    DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), dev->appcnt);
-
-    /* Check if maximum number of application exceeded */
-    if (dev->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 ((dev->app_info[i].fileobject == NULL)) {
-            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;
-    }
-
-    dev->appcnt++;
-    dev->app_info[i].fileobject = &file->f_owner;
-    dev->app_info[i].nTxMsg = 0;
-    dev->app_info[i].nRxMsg = 0;
-    dev->app_info[i].nTxMsgReject = 0;
-    dev->app_info[i].nRxMsgMiss = 0;
+	DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), dev->appcnt);
+
+	/* Check if maximum number of application exceeded */
+	if (dev->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 ((dev->app_info[i].fileobject == NULL))
+			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;
+	}
+
+	dev->appcnt++;
+	dev->app_info[i].fileobject = &file->f_owner;
+	dev->app_info[i].nTxMsg = 0;
+	dev->app_info[i].nRxMsg = 0;
+	dev->app_info[i].nTxMsgReject = 0;
+	dev->app_info[i].nRxMsgMiss = 0;
 
 	nonseekable_open(inode, file);
-    return 0;
+	return 0;
 }
 
 
@@ -357,40 +356,40 @@ static int ft1000_open(struct inode *inode, struct file *file)
 
 static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait)
 {
-    struct net_device *netdev = file->private_data;
+	struct net_device *netdev = file->private_data;
 	struct ft1000_info *info = netdev_priv(netdev);
 	struct ft1000_usb *dev = info->priv;
-    int i;
-
-    /* DEBUG("ft1000_poll_dev called\n"); */
-    if (ft1000_flarion_cnt == 0) {
-        DEBUG("FT1000:ft1000_poll_dev called when ft1000_flarion_cnt is zero\n");
-        return (-EBADF);
-    }
-
-    /* Search for matching file object */
-    for (i=0; i<MAX_NUM_APP; i++) {
-        if (dev->app_info[i].fileobject == &file->f_owner) {
-            /* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", dev->app_info[i].app_id); */
-            break;
-        }
-    }
-
-    /* Could not find application info block */
-    if (i == MAX_NUM_APP) {
-        DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n");
-        return (-EACCES);
-    }
-
-    if (list_empty(&dev->app_info[i].app_sqlist) == 0) {
-        DEBUG("FT1000:ft1000_poll_dev:Message detected in slow queue\n");
-        return(POLLIN | POLLRDNORM | POLLPRI);
-    }
-
-    poll_wait(file, &dev->app_info[i].wait_dpram_msg, wait);
-    /* DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n"); */
-
-    return (0);
+	int i;
+
+	/* DEBUG("ft1000_poll_dev called\n"); */
+	if (ft1000_flarion_cnt == 0) {
+		DEBUG("FT1000:ft1000_poll_dev called when ft1000_flarion_cnt is zero\n");
+		return (-EBADF);
+	}
+
+	/* Search for matching file object */
+	for (i = 0; i < MAX_NUM_APP; i++) {
+		if (dev->app_info[i].fileobject == &file->f_owner) {
+			/* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", dev->app_info[i].app_id); */
+			break;
+		}
+	}
+
+	/* Could not find application info block */
+	if (i == MAX_NUM_APP) {
+		DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n");
+		return (-EACCES);
+	}
+
+	if (list_empty(&dev->app_info[i].app_sqlist) == 0) {
+		DEBUG("FT1000:ft1000_poll_dev:Message detected in slow queue\n");
+		return(POLLIN | POLLRDNORM | POLLPRI);
+	}
+
+	poll_wait(file, &dev->app_info[i].wait_dpram_msg, wait);
+	/* DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n"); */
+
+	return 0;
 }
 
 /*
@@ -406,332 +405,323 @@ static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait)
 *---------------------------------------------------------------------------
 */
 static long ft1000_ioctl(struct file *file, unsigned int command,
-                           unsigned long argument)
+			   unsigned long argument)
 {
-    void __user *argp = (void __user *)argument;
+	void __user *argp = (void __user *)argument;
 	struct ft1000_info *info;
-    struct ft1000_usb *ft1000dev;
-    int result=0;
-    int cmd;
-    int i;
-    u16 tempword;
-    unsigned long flags;
-    struct timeval tv;
+	struct ft1000_usb *ft1000dev;
+	int result = 0;
+	int cmd;
+	int i;
+	u16 tempword;
+	unsigned long flags;
+	struct timeval tv;
 	struct IOCTL_GET_VER get_ver_data;
 	struct 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};
+	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;
+	unsigned short ledStat = 0;
+	unsigned short conStat = 0;
 
-    /* DEBUG("ft1000_ioctl called\n"); */
+	/* DEBUG("ft1000_ioctl called\n"); */
 
-    if (ft1000_flarion_cnt == 0) {
-        DEBUG("FT1000:ft1000_ioctl called when ft1000_flarion_cnt is zero\n");
-        return (-EBADF);
-    }
+	if (ft1000_flarion_cnt == 0) {
+		DEBUG("FT1000:ft1000_ioctl called when ft1000_flarion_cnt is zero\n");
+		return (-EBADF);
+	}
 
-    /* DEBUG("FT1000:ft1000_ioctl:command = 0x%x argument = 0x%8x\n", command, (u32)argument); */
+	/* DEBUG("FT1000:ft1000_ioctl:command = 0x%x argument = 0x%8x\n", command, (u32)argument); */
 
 	info = file->private_data;
 	ft1000dev = info->priv;
-    cmd = _IOC_NR(command);
-    /* DEBUG("FT1000:ft1000_ioctl:cmd = 0x%x\n", cmd); */
-
-    /* process the command */
-    switch (cmd) {
-    case IOCTL_REGISTER_CMD:
-            DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n");
-            result = get_user(tempword, (__u16 __user*)argp);
-            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 (ft1000dev->app_info[i].fileobject == &file->f_owner) {
-                        ft1000dev->app_info[i].DspBCMsgFlag = 1;
-                        DEBUG("FT1000:ft1000_ioctl:Registered for broadcast messages\n");
-                        break;
-                    }
-                }
-            }
-            break;
-
-    case IOCTL_GET_VER_CMD:
-        DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_VER called\n");
-
-        get_ver_data.drv_ver = FT1000_DRV_VER;
-
-        if (copy_to_user(argp, &get_ver_data, sizeof(get_ver_data))) {
-            DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
-            result = -EFAULT;
-            break;
-        }
-
-        DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n",(unsigned int)get_ver_data.drv_ver);
-
-        break;
-    case IOCTL_CONNECT:
-        /* Connect Message */
-        DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_CONNECT\n");
-        ConnectionMsg[79] = 0xfc;
-			   card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
-
-        break;
-    case IOCTL_DISCONNECT:
-        /* Disconnect Message */
-        DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_DISCONNECT\n");
-        ConnectionMsg[79] = 0xfd;
-			   card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
-        break;
-    case IOCTL_GET_DSP_STAT_CMD:
-        /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DSP_STAT called\n"); */
-	memset(&get_stat_data, 0, sizeof(get_stat_data));
-        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, (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX);
-                get_stat_data.LedStat = ntohs(ledStat);
-                DEBUG("FT1000:ft1000_ioctl: LedStat = 0x%x\n", get_stat_data.LedStat);
-                ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE, (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX);
-                get_stat_data.ConStat = ntohs(conStat);
-                DEBUG("FT1000:ft1000_ioctl: 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(argp, &get_stat_data, sizeof(get_stat_data))) {
-            DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
-            result = -EFAULT;
-            break;
-        }
-        DEBUG("ft1000_chioctl: GET_DSP_STAT succeed\n");
-        break;
-    case IOCTL_SET_DPRAM_CMD:
-        {
-		struct IOCTL_DPRAM_BLK *dpram_data = NULL;
-		/* struct IOCTL_DPRAM_COMMAND dpram_command; */
-            u16 qtype;
-            u16 msgsz;
-		struct pseudo_hdr *ppseudo_hdr;
-            u16 *pmsg;
-            u16 total_len;
-            u16 app_index;
-            u16 status;
-
-            /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_SET_DPRAM called\n");*/
-
-
-            if (ft1000_flarion_cnt == 0) {
-                return (-EBADF);
-            }
-
-            if (ft1000dev->DrvMsgPend) {
-                return (-ENOTTY);
-            }
-
-            if (ft1000dev->fProvComplete == 0) {
-                return (-EACCES);
-            }
-
-            ft1000dev->fAppMsgPend = 1;
-
-            if (info->CardReady) {
-
-               /* DEBUG("FT1000:ft1000_ioctl: try to SET_DPRAM \n"); */
-
-                /* Get the length field to see how many bytes to copy */
-                result = get_user(msgsz, (__u16 __user *)argp);
-		if (result)
-			break;
-                msgsz = ntohs(msgsz);
-                /* DEBUG("FT1000:ft1000_ioctl: length of message = %d\n", msgsz); */
-
-                if (msgsz > MAX_CMD_SQSIZE) {
-                    DEBUG("FT1000:ft1000_ioctl: bad message length = %d\n", msgsz);
-                    result = -EINVAL;
-                    break;
-                }
-
-		result = -ENOMEM;
-		dpram_data = kmalloc(msgsz + 2, GFP_KERNEL);
-		if (!dpram_data)
+	cmd = _IOC_NR(command);
+	/* DEBUG("FT1000:ft1000_ioctl:cmd = 0x%x\n", cmd); */
+
+	/* process the command */
+	switch (cmd) {
+	case IOCTL_REGISTER_CMD:
+		DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n");
+		result = get_user(tempword, (__u16 __user *)argp);
+		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 (ft1000dev->app_info[i].fileobject == &file->f_owner) {
+					ft1000dev->app_info[i].DspBCMsgFlag = 1;
+					DEBUG("FT1000:ft1000_ioctl:Registered for broadcast messages\n");
+					break;
+				}
+			}
+		}
+		break;
 
-                if (copy_from_user(dpram_data, argp, msgsz+2)) {
-                    DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
-                    result = -EFAULT;
-                } else {
-                    /* Check if this message came from a registered application */
-                    for (i=0; i<MAX_NUM_APP; i++) {
-                        if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
-                            break;
-                        }
-                    }
-                    if (i==MAX_NUM_APP) {
-                        DEBUG("FT1000:No matching application fileobject\n");
-                        result = -EINVAL;
-			kfree(dpram_data);
-                        break;
-                    }
-                    app_index = i;
-
-                    /* Check message qtype type which is the lower byte within qos_class */
-                    qtype = ntohs(dpram_data->pseudohdr.qos_class) & 0xff;
-                    /* DEBUG("FT1000_ft1000_ioctl: 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_ioctl: 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_ioctl:Doorbell not available\n");
-                                            result = -ENOTTY;
-						kfree(dpram_data);
-                                            break;
-                                        }
-                                    }
-                                }
-                            }
-                        }
-
-                        /*DEBUG("FT1000_ft1000_ioctl: 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 = (u16 *)&dpram_data->pseudohdr;
-				ppseudo_hdr = (struct pseudo_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 = ft1000dev->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 = (struct pseudo_hdr *)pmsg;
-                           card_send_command(ft1000dev,(unsigned short*)dpram_data,total_len+2);
-
-
-                            ft1000dev->app_info[app_index].nTxMsg++;
-                        } else {
-                            result = -EINVAL;
-                        }
-                    }
-                }
-            } else {
-                DEBUG("FT1000:ft1000_ioctl: Card not ready take messages\n");
-                result = -EACCES;
-            }
-	    kfree(dpram_data);
-
-        }
-        break;
-    case IOCTL_GET_DPRAM_CMD:
-        {
-		struct dpram_blk *pdpram_blk;
-		struct IOCTL_DPRAM_BLK __user *pioctl_dpram;
-            int msglen;
-
-            /* DEBUG("FT1000:ft1000_ioctl: 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 (ft1000dev->app_info[i].fileobject == &file->f_owner) {
-                    /*DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
-                    break;
-                }
-            }
-
-            /* Could not find application info block */
-            if (i == MAX_NUM_APP) {
-                DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n");
-                result = -EBADF;
-                break;
-            }
-
-            result = 0;
-            pioctl_dpram = argp;
-            if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
-                /* DEBUG("FT1000:ft1000_ioctl:Message detected in slow queue\n"); */
-                spin_lock_irqsave(&free_buff_lock, flags);
-                pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
-                list_del(&pdpram_blk->list);
-                ft1000dev->app_info[i].NumOfMsg--;
-                /* DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg); */
-                spin_unlock_irqrestore(&free_buff_lock, flags);
-                msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ;
-                result = get_user(msglen, &pioctl_dpram->total_len);
-		if (result)
+	case IOCTL_GET_VER_CMD:
+		DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_VER called\n");
+
+		get_ver_data.drv_ver = FT1000_DRV_VER;
+
+		if (copy_to_user(argp, &get_ver_data, sizeof(get_ver_data))) {
+			DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
+			result = -EFAULT;
 			break;
-		msglen = htons(msglen);
-                /* DEBUG("FT1000:ft1000_ioctl:msg length = %x\n", msglen); */
-                if (copy_to_user (&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen)) {
-					DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
+		}
+
+		DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n", (unsigned int)get_ver_data.drv_ver);
+
+		break;
+	case IOCTL_CONNECT:
+		/* Connect Message */
+		DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_CONNECT\n");
+		ConnectionMsg[79] = 0xfc;
+		card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
+
+		break;
+	case IOCTL_DISCONNECT:
+		/* Disconnect Message */
+		DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_DISCONNECT\n");
+		ConnectionMsg[79] = 0xfd;
+		card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
+		break;
+	case IOCTL_GET_DSP_STAT_CMD:
+		/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DSP_STAT called\n"); */
+		memset(&get_stat_data, 0, sizeof(get_stat_data));
+		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, (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX);
+			get_stat_data.LedStat = ntohs(ledStat);
+			DEBUG("FT1000:ft1000_ioctl: LedStat = 0x%x\n", get_stat_data.LedStat);
+			ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE, (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX);
+			get_stat_data.ConStat = ntohs(conStat);
+			DEBUG("FT1000:ft1000_ioctl: 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(argp, &get_stat_data, sizeof(get_stat_data))) {
+			DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
 			result = -EFAULT;
 			break;
+		}
+		DEBUG("ft1000_chioctl: GET_DSP_STAT succeed\n");
+		break;
+	case IOCTL_SET_DPRAM_CMD:
+		{
+			struct IOCTL_DPRAM_BLK *dpram_data = NULL;
+			/* struct IOCTL_DPRAM_COMMAND dpram_command; */
+			u16 qtype;
+			u16 msgsz;
+			struct pseudo_hdr *ppseudo_hdr;
+			u16 *pmsg;
+			u16 total_len;
+			u16 app_index;
+			u16 status;
+
+			/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_SET_DPRAM called\n");*/
+
+			if (ft1000_flarion_cnt == 0)
+				return (-EBADF);
+
+			if (ft1000dev->DrvMsgPend)
+				return (-ENOTTY);
+
+			if (ft1000dev->fProvComplete == 0)
+				return (-EACCES);
+
+			ft1000dev->fAppMsgPend = 1;
+
+			if (info->CardReady) {
+
+				/* DEBUG("FT1000:ft1000_ioctl: try to SET_DPRAM\n"); */
+
+				/* Get the length field to see how many bytes to copy */
+				result = get_user(msgsz, (__u16 __user *)argp);
+				if (result)
+					break;
+				msgsz = ntohs(msgsz);
+				/* DEBUG("FT1000:ft1000_ioctl: length of message = %d\n", msgsz); */
+
+				if (msgsz > MAX_CMD_SQSIZE) {
+					DEBUG("FT1000:ft1000_ioctl: bad message length = %d\n", msgsz);
+					result = -EINVAL;
+					break;
+				}
+
+				result = -ENOMEM;
+				dpram_data = kmalloc(msgsz + 2, GFP_KERNEL);
+				if (!dpram_data)
+					break;
+
+				if (copy_from_user(dpram_data, argp, msgsz+2)) {
+					DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
+					result = -EFAULT;
+				} else {
+					/* Check if this message came from a registered application */
+					for (i = 0; i < MAX_NUM_APP; i++) {
+						if (ft1000dev->app_info[i].fileobject == &file->f_owner)
+							break;
+					}
+					if (i == MAX_NUM_APP) {
+						DEBUG("FT1000:No matching application fileobject\n");
+						result = -EINVAL;
+						kfree(dpram_data);
+						break;
+					}
+					app_index = i;
+
+					/* Check message qtype type which is the lower byte within qos_class */
+					qtype = ntohs(dpram_data->pseudohdr.qos_class) & 0xff;
+					/* DEBUG("FT1000_ft1000_ioctl: qtype = %d\n", qtype); */
+					if (!qtype) {
+						/* 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_ioctl: 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_ioctl:Doorbell not available\n");
+											result = -ENOTTY;
+											kfree(dpram_data);
+											break;
+										}
+									}
+								}
+							}
+						}
+
+						/*DEBUG("FT1000_ft1000_ioctl: 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 = (u16 *)&dpram_data->pseudohdr;
+							ppseudo_hdr = (struct pseudo_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 = ft1000dev->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 = (struct pseudo_hdr *)pmsg;
+							card_send_command(ft1000dev, (unsigned short *)dpram_data, total_len+2);
+
+							ft1000dev->app_info[app_index].nTxMsg++;
+						} else {
+							result = -EINVAL;
+						}
+					}
+				}
+			} else {
+				DEBUG("FT1000:ft1000_ioctl: Card not ready take messages\n");
+				result = -EACCES;
+			}
+			kfree(dpram_data);
+
+		}
+		break;
+	case IOCTL_GET_DPRAM_CMD:
+		{
+			struct dpram_blk *pdpram_blk;
+			struct IOCTL_DPRAM_BLK __user *pioctl_dpram;
+			int msglen;
+
+			/* DEBUG("FT1000:ft1000_ioctl: 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 (ft1000dev->app_info[i].fileobject == &file->f_owner) {
+					/*DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
+					break;
+				}
+			}
+
+			/* Could not find application info block */
+			if (i == MAX_NUM_APP) {
+				DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n");
+				result = -EBADF;
+				break;
+			}
+
+			result = 0;
+			pioctl_dpram = argp;
+			if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
+				/* DEBUG("FT1000:ft1000_ioctl:Message detected in slow queue\n"); */
+				spin_lock_irqsave(&free_buff_lock, flags);
+				pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
+				list_del(&pdpram_blk->list);
+				ft1000dev->app_info[i].NumOfMsg--;
+				/* DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg); */
+				spin_unlock_irqrestore(&free_buff_lock, flags);
+				msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ;
+				result = get_user(msglen, &pioctl_dpram->total_len);
+				if (result)
+					break;
+				msglen = htons(msglen);
+				/* DEBUG("FT1000:ft1000_ioctl:msg length = %x\n", msglen); */
+				if (copy_to_user(&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen)) {
+					DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
+					result = -EFAULT;
+					break;
 				}
 
-                ft1000_free_buffer(pdpram_blk, &freercvpool);
-                result = msglen;
-            }
-            /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM no message\n"); */
-        }
-        break;
-
-    default:
-        DEBUG("FT1000:ft1000_ioctl:unknown command: 0x%x\n", command);
-        result = -ENOTTY;
-        break;
-    }
-    ft1000dev->fAppMsgPend = 0;
-    return result;
+				ft1000_free_buffer(pdpram_blk, &freercvpool);
+				result = msglen;
+			}
+			/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM no message\n"); */
+		}
+		break;
+
+	default:
+		DEBUG("FT1000:ft1000_ioctl:unknown command: 0x%x\n", command);
+		result = -ENOTTY;
+		break;
+	}
+	ft1000dev->fAppMsgPend = 0;
+	return result;
 }
 
 /*
@@ -749,44 +739,44 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 static int ft1000_release(struct inode *inode, struct file *file)
 {
 	struct ft1000_info *info;
-    struct net_device *dev;
-    struct ft1000_usb *ft1000dev;
-    int i;
+	struct net_device *dev;
+	struct ft1000_usb *ft1000dev;
+	int i;
 	struct dpram_blk *pdpram_blk;
 
-    DEBUG("ft1000_release called\n");
+	DEBUG("ft1000_release called\n");
 
-    dev = file->private_data;
+	dev = file->private_data;
 	info = netdev_priv(dev);
 	ft1000dev = info->priv;
 
-    if (ft1000_flarion_cnt == 0) {
-        ft1000dev->appcnt--;
-        return (-EBADF);
-    }
-
-    /* Search for matching file object */
-    for (i=0; i<MAX_NUM_APP; i++) {
-        if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
-            /* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
-            break;
-        }
-    }
-
-    if (i==MAX_NUM_APP)
-	    return 0;
-
-    while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
-        DEBUG("Remove and free memory queue up on slow queue\n");
-        pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
-        list_del(&pdpram_blk->list);
-        ft1000_free_buffer(pdpram_blk, &freercvpool);
-    }
-
-    /* initialize application information */
-    ft1000dev->appcnt--;
-    DEBUG("ft1000_chdev:%s:appcnt = %d\n", __func__, ft1000dev->appcnt);
-    ft1000dev->app_info[i].fileobject = NULL;
-
-    return 0;
+	if (ft1000_flarion_cnt == 0) {
+		ft1000dev->appcnt--;
+		return (-EBADF);
+	}
+
+	/* Search for matching file object */
+	for (i = 0; i < MAX_NUM_APP; i++) {
+		if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
+			/* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
+			break;
+		}
+	}
+
+	if (i == MAX_NUM_APP)
+		return 0;
+
+	while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
+		DEBUG("Remove and free memory queue up on slow queue\n");
+		pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
+		list_del(&pdpram_blk->list);
+		ft1000_free_buffer(pdpram_blk, &freercvpool);
+	}
+
+	/* initialize application information */
+	ft1000dev->appcnt--;
+	DEBUG("ft1000_chdev:%s:appcnt = %d\n", __func__, ft1000dev->appcnt);
+	ft1000dev->app_info[i].fileobject = NULL;
+
+	return 0;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and some warnings.
  2014-06-02  2:26 [PATCH] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and some warnings Thomas Wood
@ 2014-06-02 10:30 ` Dan Carpenter
  2014-06-02 19:23   ` Thomas Wood
  2014-06-07  3:02   ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Thomas Wood
  0 siblings, 2 replies; 12+ messages in thread
From: Dan Carpenter @ 2014-06-02 10:30 UTC (permalink / raw)
  To: Thomas Wood; +Cc: marek.belisko, devel, gregkh, linux-kernel

On Sun, Jun 01, 2014 at 07:26:18PM -0700, Thomas Wood wrote:
> Don't use spaces as tabs, and fix other style errors and warnings.
>
> Signed-off-by: Thomas Wood <tommyandrena@gmail.com>

Too much in one patch.  Break it up into one type of fix per patch and
send a series of patches.

[patch 1] use tabs
[patch 2] fix braces style
[patch 3] remove parens from return values
[patch 4] reverse an if statement

patch 3 and 4 are small enough that you could get away with pushing them
into a single "misc fixes" patch and we wouldn't have complained but the
first two patches are very big.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and some warnings.
  2014-06-02 10:30 ` Dan Carpenter
@ 2014-06-02 19:23   ` Thomas Wood
  2014-06-07  3:02   ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Thomas Wood
  1 sibling, 0 replies; 12+ messages in thread
From: Thomas Wood @ 2014-06-02 19:23 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: marek.belisko, devel, gregkh, linux-kernel



On 06/02/2014 03:30 AM, Dan Carpenter wrote:
> On Sun, Jun 01, 2014 at 07:26:18PM -0700, Thomas Wood wrote:
>> Don't use spaces as tabs, and fix other style errors and warnings.
>>
>> Signed-off-by: Thomas Wood <tommyandrena@gmail.com>
> 
> Too much in one patch.  Break it up into one type of fix per patch and
> send a series of patches.
> 
> [patch 1] use tabs
> [patch 2] fix braces style
> [patch 3] remove parens from return values
> [patch 4] reverse an if statement
> 
> patch 3 and 4 are small enough that you could get away with pushing them
> into a single "misc fixes" patch and we wouldn't have complained but the
> first two patches are very big.
> 
> regards,
> dan carpenter
> 
> 
Ah, thank you. I will do so.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings.
  2014-06-02 10:30 ` Dan Carpenter
  2014-06-02 19:23   ` Thomas Wood
@ 2014-06-07  3:02   ` Thomas Wood
  2014-06-07  3:02     ` [PATCH v2 1/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Replace spaces with tabs Thomas Wood
                       ` (5 more replies)
  1 sibling, 6 replies; 12+ messages in thread
From: Thomas Wood @ 2014-06-07  3:02 UTC (permalink / raw)
  To: dan.carpenter; +Cc: marek.belisko, devel, gregkh, linux-kernel, Thomas Wood

Changes since v1:
 * Made single patch into a patch set.
 * Added better commit messages.

Is this better, or do I still have to split up my first patch?

>8------------------------------------------------------8<

Remove all style errors from ft1000_debug.c and some warnings.

Thomas Wood (5):
  staging: ft1000: ft1000-usb: ft1000_debug.c: Replace spaces with tabs.
  staging: ft1000: ft1000-usb: ft1000_debug.c: Add required spaces.
  staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary
    whitespace.
  staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary
    braces.
  staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes.

 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 968 +++++++++++------------
 1 file changed, 480 insertions(+), 488 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Replace spaces with tabs.
  2014-06-07  3:02   ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Thomas Wood
@ 2014-06-07  3:02     ` Thomas Wood
  2014-06-07  3:02     ` [PATCH v2 2/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Add required spaces Thomas Wood
                       ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Thomas Wood @ 2014-06-07  3:02 UTC (permalink / raw)
  To: dan.carpenter; +Cc: marek.belisko, devel, gregkh, linux-kernel, Thomas Wood

Replace the spaces that were used as tabs with actual tabs.

Signed-off-by: Thomas Wood <tommyandrena@gmail.com>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 974 +++++++++++------------
 1 file changed, 487 insertions(+), 487 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index a8945b7..338f91e 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -43,7 +43,7 @@ static int ft1000_flarion_cnt = 0;
 static int ft1000_open(struct inode *inode, struct file *file);
 static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait);
 static long ft1000_ioctl(struct file *file, unsigned int command,
-                           unsigned long argument);
+			unsigned long argument);
 static int ft1000_release(struct inode *inode, struct file *file);
 
 /* List to free receive command buffer pool */
@@ -81,23 +81,23 @@ static const struct file_operations ft1000fops = {
 */
 struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist)
 {
-    unsigned long flags;
+	unsigned long flags;
 	struct dpram_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, struct 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;
+	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, struct 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;
 }
 
 
@@ -119,14 +119,14 @@ struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist)
 */
 void ft1000_free_buffer(struct dpram_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);
 }
 
 /*
@@ -145,25 +145,25 @@ void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist)
 */
 int ft1000_create_dev(struct ft1000_usb *dev)
 {
-    int result;
-    int i;
+	int result;
+	int i;
 	struct dentry *dir, *file;
 	struct ft1000_debug_dirs *tmp;
 
-    /* make a new device name */
-    sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber);
+	/* make a new device name */
+	sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber);
 
-    DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt);
-    DEBUG("DeviceCreated = %x\n", dev->DeviceCreated);
+	DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt);
+	DEBUG("DeviceCreated = %x\n", dev->DeviceCreated);
 
-    if (dev->DeviceCreated) {
-	DEBUG("%s: \"%s\" already registered\n", __func__, dev->DeviceName);
-	return -EIO;
-    }
+	if (dev->DeviceCreated) {
+		DEBUG("%s: \"%s\" already registered\n", __func__, dev->DeviceName);
+		return -EIO;
+	}
 
 
-    /* register the device */
-    DEBUG("%s: \"%s\" debugfs device registration\n", __func__, dev->DeviceName);
+	/* register the device */
+	DEBUG("%s: \"%s\" debugfs device registration\n", __func__, dev->DeviceName);
 
 	tmp = kmalloc(sizeof(struct ft1000_debug_dirs), GFP_KERNEL);
 	if (tmp == NULL) {
@@ -189,25 +189,25 @@ int ft1000_create_dev(struct ft1000_usb *dev)
 	tmp->int_number = dev->CardNumber;
 	list_add(&(tmp->list), &(dev->nodes.list));
 
-    DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, dev->DeviceName);
-
-    /* initialize application information */
-    dev->appcnt = 0;
-    for (i=0; i<MAX_NUM_APP; i++) {
-        dev->app_info[i].nTxMsg = 0;
-        dev->app_info[i].nRxMsg = 0;
-        dev->app_info[i].nTxMsgReject = 0;
-        dev->app_info[i].nRxMsgMiss = 0;
-        dev->app_info[i].fileobject = NULL;
-        dev->app_info[i].app_id = i+1;
-        dev->app_info[i].DspBCMsgFlag = 0;
-        dev->app_info[i].NumOfMsg = 0;
-        init_waitqueue_head(&dev->app_info[i].wait_dpram_msg);
-        INIT_LIST_HEAD(&dev->app_info[i].app_sqlist);
-    }
-
-    dev->DeviceCreated = TRUE;
-    ft1000_flarion_cnt++;
+	DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, dev->DeviceName);
+
+	/* initialize application information */
+	dev->appcnt = 0;
+	for (i=0; i<MAX_NUM_APP; i++) {
+		dev->app_info[i].nTxMsg = 0;
+		dev->app_info[i].nRxMsg = 0;
+		dev->app_info[i].nTxMsgReject = 0;
+		dev->app_info[i].nRxMsgMiss = 0;
+		dev->app_info[i].fileobject = NULL;
+		dev->app_info[i].app_id = i+1;
+		dev->app_info[i].DspBCMsgFlag = 0;
+		dev->app_info[i].NumOfMsg = 0;
+		init_waitqueue_head(&dev->app_info[i].wait_dpram_msg);
+		INIT_LIST_HEAD(&dev->app_info[i].app_sqlist);
+	}
+
+	dev->DeviceCreated = TRUE;
+	ft1000_flarion_cnt++;
 
 	return 0;
 
@@ -235,18 +235,18 @@ void ft1000_destroy_dev(struct net_device *netdev)
 {
 	struct ft1000_info *info = netdev_priv(netdev);
 	struct ft1000_usb *dev = info->priv;
-		int i;
+	int i;
 	struct dpram_blk *pdpram_blk;
 	struct dpram_blk *ptr;
 	struct list_head *pos, *q;
 	struct ft1000_debug_dirs *dir;
 
-    DEBUG("%s called\n", __func__);
+	DEBUG("%s called\n", __func__);
 
 
 
-    if (dev->DeviceCreated) {
-        ft1000_flarion_cnt--;
+	if (dev->DeviceCreated) {
+		ft1000_flarion_cnt--;
 		list_for_each_safe(pos, q, &dev->nodes.list) {
 			dir = list_entry(pos, struct ft1000_debug_dirs, list);
 			if (dir->int_number == dev->CardNumber) {
@@ -257,28 +257,28 @@ void ft1000_destroy_dev(struct net_device *netdev)
 			}
 		}
 		DEBUG("%s: unregistered device \"%s\"\n", __func__,
-					   dev->DeviceName);
-
-        /* Make sure we free any memory reserve for slow Queue */
-        for (i=0; i<MAX_NUM_APP; i++) {
-            while (list_empty(&dev->app_info[i].app_sqlist) == 0) {
-                pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
-                list_del(&pdpram_blk->list);
-                ft1000_free_buffer(pdpram_blk, &freercvpool);
-
-            }
-            wake_up_interruptible(&dev->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, struct dpram_blk, list);
-                list_del(&ptr->list);
-                kfree(ptr->pbuffer);
-                kfree(ptr);
-            }
-        }
+			dev->DeviceName);
+
+		/* Make sure we free any memory reserve for slow Queue */
+		for (i=0; i<MAX_NUM_APP; i++) {
+			while (list_empty(&dev->app_info[i].app_sqlist) == 0) {
+				pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
+				list_del(&pdpram_blk->list);
+				ft1000_free_buffer(pdpram_blk, &freercvpool);
+
+			}
+			wake_up_interruptible(&dev->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, struct dpram_blk, list);
+				list_del(&ptr->list);
+				kfree(ptr->pbuffer);
+				kfree(ptr);
+			}
+		}
 		dev->DeviceCreated = FALSE;
 	}
 
@@ -301,44 +301,44 @@ static int ft1000_open(struct inode *inode, struct file *file)
 {
 	struct ft1000_info *info;
 	struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private;
-    int i,num;
+	int i,num;
 
-    DEBUG("%s called\n", __func__);
-    num = (MINOR(inode->i_rdev) & 0xf);
-    DEBUG("ft1000_open: minor number=%d\n", num);
+	DEBUG("%s called\n", __func__);
+	num = (MINOR(inode->i_rdev) & 0xf);
+	DEBUG("ft1000_open: minor number=%d\n", num);
 
 	info = file->private_data = netdev_priv(dev->net);
 
-    DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), dev->appcnt);
-
-    /* Check if maximum number of application exceeded */
-    if (dev->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 ((dev->app_info[i].fileobject == NULL)) {
-            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;
-    }
-
-    dev->appcnt++;
-    dev->app_info[i].fileobject = &file->f_owner;
-    dev->app_info[i].nTxMsg = 0;
-    dev->app_info[i].nRxMsg = 0;
-    dev->app_info[i].nTxMsgReject = 0;
-    dev->app_info[i].nRxMsgMiss = 0;
+	DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), dev->appcnt);
+
+	/* Check if maximum number of application exceeded */
+	if (dev->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 ((dev->app_info[i].fileobject == NULL)) {
+			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;
+	}
+
+	dev->appcnt++;
+	dev->app_info[i].fileobject = &file->f_owner;
+	dev->app_info[i].nTxMsg = 0;
+	dev->app_info[i].nRxMsg = 0;
+	dev->app_info[i].nTxMsgReject = 0;
+	dev->app_info[i].nRxMsgMiss = 0;
 
 	nonseekable_open(inode, file);
-    return 0;
+	return 0;
 }
 
 
@@ -357,40 +357,40 @@ static int ft1000_open(struct inode *inode, struct file *file)
 
 static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait)
 {
-    struct net_device *netdev = file->private_data;
+	struct net_device *netdev = file->private_data;
 	struct ft1000_info *info = netdev_priv(netdev);
 	struct ft1000_usb *dev = info->priv;
-    int i;
-
-    /* DEBUG("ft1000_poll_dev called\n"); */
-    if (ft1000_flarion_cnt == 0) {
-        DEBUG("FT1000:ft1000_poll_dev called when ft1000_flarion_cnt is zero\n");
-        return (-EBADF);
-    }
-
-    /* Search for matching file object */
-    for (i=0; i<MAX_NUM_APP; i++) {
-        if (dev->app_info[i].fileobject == &file->f_owner) {
-            /* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", dev->app_info[i].app_id); */
-            break;
-        }
-    }
-
-    /* Could not find application info block */
-    if (i == MAX_NUM_APP) {
-        DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n");
-        return (-EACCES);
-    }
-
-    if (list_empty(&dev->app_info[i].app_sqlist) == 0) {
-        DEBUG("FT1000:ft1000_poll_dev:Message detected in slow queue\n");
-        return(POLLIN | POLLRDNORM | POLLPRI);
-    }
-
-    poll_wait(file, &dev->app_info[i].wait_dpram_msg, wait);
-    /* DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n"); */
-
-    return (0);
+	int i;
+
+	/* DEBUG("ft1000_poll_dev called\n"); */
+	if (ft1000_flarion_cnt == 0) {
+		DEBUG("FT1000:ft1000_poll_dev called when ft1000_flarion_cnt is zero\n");
+		return (-EBADF);
+	}
+
+	/* Search for matching file object */
+	for (i=0; i<MAX_NUM_APP; i++) {
+		if (dev->app_info[i].fileobject == &file->f_owner) {
+			/* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", dev->app_info[i].app_id); */
+			break;
+		}
+	}
+
+	/* Could not find application info block */
+	if (i == MAX_NUM_APP) {
+		DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n");
+		return (-EACCES);
+	}
+
+	if (list_empty(&dev->app_info[i].app_sqlist) == 0) {
+		DEBUG("FT1000:ft1000_poll_dev:Message detected in slow queue\n");
+		return(POLLIN | POLLRDNORM | POLLPRI);
+	}
+
+	poll_wait(file, &dev->app_info[i].wait_dpram_msg, wait);
+	/* DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n"); */
+
+	return (0);
 }
 
 /*
@@ -406,332 +406,332 @@ static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait)
 *---------------------------------------------------------------------------
 */
 static long ft1000_ioctl(struct file *file, unsigned int command,
-                           unsigned long argument)
+			unsigned long argument)
 {
-    void __user *argp = (void __user *)argument;
+	void __user *argp = (void __user *)argument;
 	struct ft1000_info *info;
-    struct ft1000_usb *ft1000dev;
-    int result=0;
-    int cmd;
-    int i;
-    u16 tempword;
-    unsigned long flags;
-    struct timeval tv;
+	struct ft1000_usb *ft1000dev;
+	int result=0;
+	int cmd;
+	int i;
+	u16 tempword;
+	unsigned long flags;
+	struct timeval tv;
 	struct IOCTL_GET_VER get_ver_data;
 	struct 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};
+	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;
+	unsigned short ledStat=0;
+	unsigned short conStat=0;
 
-    /* DEBUG("ft1000_ioctl called\n"); */
+	/* DEBUG("ft1000_ioctl called\n"); */
 
-    if (ft1000_flarion_cnt == 0) {
-        DEBUG("FT1000:ft1000_ioctl called when ft1000_flarion_cnt is zero\n");
-        return (-EBADF);
-    }
+	if (ft1000_flarion_cnt == 0) {
+		DEBUG("FT1000:ft1000_ioctl called when ft1000_flarion_cnt is zero\n");
+		return (-EBADF);
+	}
 
-    /* DEBUG("FT1000:ft1000_ioctl:command = 0x%x argument = 0x%8x\n", command, (u32)argument); */
+	/* DEBUG("FT1000:ft1000_ioctl:command = 0x%x argument = 0x%8x\n", command, (u32)argument); */
 
 	info = file->private_data;
 	ft1000dev = info->priv;
-    cmd = _IOC_NR(command);
-    /* DEBUG("FT1000:ft1000_ioctl:cmd = 0x%x\n", cmd); */
-
-    /* process the command */
-    switch (cmd) {
-    case IOCTL_REGISTER_CMD:
-            DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n");
-            result = get_user(tempword, (__u16 __user*)argp);
-            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 (ft1000dev->app_info[i].fileobject == &file->f_owner) {
-                        ft1000dev->app_info[i].DspBCMsgFlag = 1;
-                        DEBUG("FT1000:ft1000_ioctl:Registered for broadcast messages\n");
-                        break;
-                    }
-                }
-            }
-            break;
-
-    case IOCTL_GET_VER_CMD:
-        DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_VER called\n");
-
-        get_ver_data.drv_ver = FT1000_DRV_VER;
-
-        if (copy_to_user(argp, &get_ver_data, sizeof(get_ver_data))) {
-            DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
-            result = -EFAULT;
-            break;
-        }
-
-        DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n",(unsigned int)get_ver_data.drv_ver);
-
-        break;
-    case IOCTL_CONNECT:
-        /* Connect Message */
-        DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_CONNECT\n");
-        ConnectionMsg[79] = 0xfc;
-			   card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
-
-        break;
-    case IOCTL_DISCONNECT:
-        /* Disconnect Message */
-        DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_DISCONNECT\n");
-        ConnectionMsg[79] = 0xfd;
-			   card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
-        break;
-    case IOCTL_GET_DSP_STAT_CMD:
-        /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DSP_STAT called\n"); */
-	memset(&get_stat_data, 0, sizeof(get_stat_data));
-        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, (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX);
-                get_stat_data.LedStat = ntohs(ledStat);
-                DEBUG("FT1000:ft1000_ioctl: LedStat = 0x%x\n", get_stat_data.LedStat);
-                ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE, (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX);
-                get_stat_data.ConStat = ntohs(conStat);
-                DEBUG("FT1000:ft1000_ioctl: 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(argp, &get_stat_data, sizeof(get_stat_data))) {
-            DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
-            result = -EFAULT;
-            break;
-        }
-        DEBUG("ft1000_chioctl: GET_DSP_STAT succeed\n");
-        break;
-    case IOCTL_SET_DPRAM_CMD:
-        {
-		struct IOCTL_DPRAM_BLK *dpram_data = NULL;
-		/* struct IOCTL_DPRAM_COMMAND dpram_command; */
-            u16 qtype;
-            u16 msgsz;
-		struct pseudo_hdr *ppseudo_hdr;
-            u16 *pmsg;
-            u16 total_len;
-            u16 app_index;
-            u16 status;
-
-            /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_SET_DPRAM called\n");*/
-
-
-            if (ft1000_flarion_cnt == 0) {
-                return (-EBADF);
-            }
-
-            if (ft1000dev->DrvMsgPend) {
-                return (-ENOTTY);
-            }
-
-            if (ft1000dev->fProvComplete == 0) {
-                return (-EACCES);
-            }
-
-            ft1000dev->fAppMsgPend = 1;
-
-            if (info->CardReady) {
-
-               /* DEBUG("FT1000:ft1000_ioctl: try to SET_DPRAM \n"); */
-
-                /* Get the length field to see how many bytes to copy */
-                result = get_user(msgsz, (__u16 __user *)argp);
-		if (result)
-			break;
-                msgsz = ntohs(msgsz);
-                /* DEBUG("FT1000:ft1000_ioctl: length of message = %d\n", msgsz); */
-
-                if (msgsz > MAX_CMD_SQSIZE) {
-                    DEBUG("FT1000:ft1000_ioctl: bad message length = %d\n", msgsz);
-                    result = -EINVAL;
-                    break;
-                }
-
-		result = -ENOMEM;
-		dpram_data = kmalloc(msgsz + 2, GFP_KERNEL);
-		if (!dpram_data)
+	cmd = _IOC_NR(command);
+	/* DEBUG("FT1000:ft1000_ioctl:cmd = 0x%x\n", cmd); */
+
+	/* process the command */
+	switch (cmd) {
+	case IOCTL_REGISTER_CMD:
+		DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n");
+		result = get_user(tempword, (__u16 __user*)argp);
+		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 (ft1000dev->app_info[i].fileobject == &file->f_owner) {
+					ft1000dev->app_info[i].DspBCMsgFlag = 1;
+					DEBUG("FT1000:ft1000_ioctl:Registered for broadcast messages\n");
+					break;
+				}
+			}
+		}
+		break;
 
-                if (copy_from_user(dpram_data, argp, msgsz+2)) {
-                    DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
-                    result = -EFAULT;
-                } else {
-                    /* Check if this message came from a registered application */
-                    for (i=0; i<MAX_NUM_APP; i++) {
-                        if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
-                            break;
-                        }
-                    }
-                    if (i==MAX_NUM_APP) {
-                        DEBUG("FT1000:No matching application fileobject\n");
-                        result = -EINVAL;
-			kfree(dpram_data);
-                        break;
-                    }
-                    app_index = i;
-
-                    /* Check message qtype type which is the lower byte within qos_class */
-                    qtype = ntohs(dpram_data->pseudohdr.qos_class) & 0xff;
-                    /* DEBUG("FT1000_ft1000_ioctl: 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_ioctl: 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_ioctl:Doorbell not available\n");
-                                            result = -ENOTTY;
-						kfree(dpram_data);
-                                            break;
-                                        }
-                                    }
-                                }
-                            }
-                        }
-
-                        /*DEBUG("FT1000_ft1000_ioctl: 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 = (u16 *)&dpram_data->pseudohdr;
-				ppseudo_hdr = (struct pseudo_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 = ft1000dev->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 = (struct pseudo_hdr *)pmsg;
-                           card_send_command(ft1000dev,(unsigned short*)dpram_data,total_len+2);
-
-
-                            ft1000dev->app_info[app_index].nTxMsg++;
-                        } else {
-                            result = -EINVAL;
-                        }
-                    }
-                }
-            } else {
-                DEBUG("FT1000:ft1000_ioctl: Card not ready take messages\n");
-                result = -EACCES;
-            }
-	    kfree(dpram_data);
-
-        }
-        break;
-    case IOCTL_GET_DPRAM_CMD:
-        {
-		struct dpram_blk *pdpram_blk;
-		struct IOCTL_DPRAM_BLK __user *pioctl_dpram;
-            int msglen;
-
-            /* DEBUG("FT1000:ft1000_ioctl: 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 (ft1000dev->app_info[i].fileobject == &file->f_owner) {
-                    /*DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
-                    break;
-                }
-            }
-
-            /* Could not find application info block */
-            if (i == MAX_NUM_APP) {
-                DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n");
-                result = -EBADF;
-                break;
-            }
-
-            result = 0;
-            pioctl_dpram = argp;
-            if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
-                /* DEBUG("FT1000:ft1000_ioctl:Message detected in slow queue\n"); */
-                spin_lock_irqsave(&free_buff_lock, flags);
-                pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
-                list_del(&pdpram_blk->list);
-                ft1000dev->app_info[i].NumOfMsg--;
-                /* DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg); */
-                spin_unlock_irqrestore(&free_buff_lock, flags);
-                msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ;
-                result = get_user(msglen, &pioctl_dpram->total_len);
-		if (result)
+	case IOCTL_GET_VER_CMD:
+		DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_VER called\n");
+
+		get_ver_data.drv_ver = FT1000_DRV_VER;
+
+		if (copy_to_user(argp, &get_ver_data, sizeof(get_ver_data))) {
+			DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
+			result = -EFAULT;
 			break;
-		msglen = htons(msglen);
-                /* DEBUG("FT1000:ft1000_ioctl:msg length = %x\n", msglen); */
-                if (copy_to_user (&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen)) {
-					DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
+		}
+
+		DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n",(unsigned int)get_ver_data.drv_ver);
+
+		break;
+	case IOCTL_CONNECT:
+		/* Connect Message */
+		DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_CONNECT\n");
+		ConnectionMsg[79] = 0xfc;
+		card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
+
+		break;
+	case IOCTL_DISCONNECT:
+		/* Disconnect Message */
+		DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_DISCONNECT\n");
+		ConnectionMsg[79] = 0xfd;
+		card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c);
+		break;
+	case IOCTL_GET_DSP_STAT_CMD:
+		/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DSP_STAT called\n"); */
+		memset(&get_stat_data, 0, sizeof(get_stat_data));
+		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, (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX);
+			get_stat_data.LedStat = ntohs(ledStat);
+			DEBUG("FT1000:ft1000_ioctl: LedStat = 0x%x\n", get_stat_data.LedStat);
+			ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE, (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX);
+			get_stat_data.ConStat = ntohs(conStat);
+			DEBUG("FT1000:ft1000_ioctl: 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(argp, &get_stat_data, sizeof(get_stat_data))) {
+			DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
 			result = -EFAULT;
 			break;
+		}
+		DEBUG("ft1000_chioctl: GET_DSP_STAT succeed\n");
+		break;
+	case IOCTL_SET_DPRAM_CMD:
+		{
+			struct IOCTL_DPRAM_BLK *dpram_data = NULL;
+			/* struct IOCTL_DPRAM_COMMAND dpram_command; */
+			u16 qtype;
+			u16 msgsz;
+			struct pseudo_hdr *ppseudo_hdr;
+			u16 *pmsg;
+			u16 total_len;
+			u16 app_index;
+			u16 status;
+
+			/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_SET_DPRAM called\n");*/
+
+
+			if (ft1000_flarion_cnt == 0) {
+				return (-EBADF);
+			}
+
+			if (ft1000dev->DrvMsgPend) {
+				return (-ENOTTY);
+			}
+
+			if (ft1000dev->fProvComplete == 0) {
+				return (-EACCES);
+			}
+
+			ft1000dev->fAppMsgPend = 1;
+
+			if (info->CardReady) {
+
+				/* DEBUG("FT1000:ft1000_ioctl: try to SET_DPRAM \n"); */
+
+				/* Get the length field to see how many bytes to copy */
+				result = get_user(msgsz, (__u16 __user *)argp);
+				if (result)
+					break;
+				msgsz = ntohs(msgsz);
+				/* DEBUG("FT1000:ft1000_ioctl: length of message = %d\n", msgsz); */
+
+				if (msgsz > MAX_CMD_SQSIZE) {
+					DEBUG("FT1000:ft1000_ioctl: bad message length = %d\n", msgsz);
+					result = -EINVAL;
+					break;
+				}
+
+				result = -ENOMEM;
+				dpram_data = kmalloc(msgsz + 2, GFP_KERNEL);
+				if (!dpram_data)
+					break;
+
+				if (copy_from_user(dpram_data, argp, msgsz+2)) {
+					DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
+					result = -EFAULT;
+				} else {
+					/* Check if this message came from a registered application */
+					for (i=0; i<MAX_NUM_APP; i++) {
+						if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
+							break;
+						}
+					}
+					if (i==MAX_NUM_APP) {
+						DEBUG("FT1000:No matching application fileobject\n");
+						result = -EINVAL;
+						kfree(dpram_data);
+						break;
+					}
+					app_index = i;
+
+					/* Check message qtype type which is the lower byte within qos_class */
+					qtype = ntohs(dpram_data->pseudohdr.qos_class) & 0xff;
+					/* DEBUG("FT1000_ft1000_ioctl: 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_ioctl: 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_ioctl:Doorbell not available\n");
+										result = -ENOTTY;
+										kfree(dpram_data);
+										break;
+									}
+								}
+							}
+						}
+					}
+
+					/*DEBUG("FT1000_ft1000_ioctl: 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 = (u16 *)&dpram_data->pseudohdr;
+						ppseudo_hdr = (struct pseudo_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 = ft1000dev->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 = (struct pseudo_hdr *)pmsg;
+						card_send_command(ft1000dev,(unsigned short*)dpram_data,total_len+2);
+
+
+						ft1000dev->app_info[app_index].nTxMsg++;
+						} else {
+							result = -EINVAL;
+						}
+					}
+				}
+			} else {
+				DEBUG("FT1000:ft1000_ioctl: Card not ready take messages\n");
+				result = -EACCES;
+			}
+			kfree(dpram_data);
+
+		}
+		break;
+	case IOCTL_GET_DPRAM_CMD:
+		{
+			struct dpram_blk *pdpram_blk;
+			struct IOCTL_DPRAM_BLK __user *pioctl_dpram;
+			int msglen;
+
+			/* DEBUG("FT1000:ft1000_ioctl: 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 (ft1000dev->app_info[i].fileobject == &file->f_owner) {
+					/*DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
+					break;
+				}
+			}
+
+			/* Could not find application info block */
+			if (i == MAX_NUM_APP) {
+				DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n");
+				result = -EBADF;
+				break;
+			}
+
+			result = 0;
+			pioctl_dpram = argp;
+			if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
+				/* DEBUG("FT1000:ft1000_ioctl:Message detected in slow queue\n"); */
+				spin_lock_irqsave(&free_buff_lock, flags);
+				pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
+				list_del(&pdpram_blk->list);
+				ft1000dev->app_info[i].NumOfMsg--;
+				/* DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg); */
+				spin_unlock_irqrestore(&free_buff_lock, flags);
+				msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ;
+				result = get_user(msglen, &pioctl_dpram->total_len);
+				if (result)
+					break;
+				msglen = htons(msglen);
+				/* DEBUG("FT1000:ft1000_ioctl:msg length = %x\n", msglen); */
+				if (copy_to_user (&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen)) {
+					DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
+					result = -EFAULT;
+					break;
 				}
 
-                ft1000_free_buffer(pdpram_blk, &freercvpool);
-                result = msglen;
-            }
-            /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM no message\n"); */
-        }
-        break;
-
-    default:
-        DEBUG("FT1000:ft1000_ioctl:unknown command: 0x%x\n", command);
-        result = -ENOTTY;
-        break;
-    }
-    ft1000dev->fAppMsgPend = 0;
-    return result;
+				ft1000_free_buffer(pdpram_blk, &freercvpool);
+				result = msglen;
+			}
+			/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM no message\n"); */
+		}
+		break;
+
+	default:
+		DEBUG("FT1000:ft1000_ioctl:unknown command: 0x%x\n", command);
+		result = -ENOTTY;
+		break;
+	}
+	ft1000dev->fAppMsgPend = 0;
+	return result;
 }
 
 /*
@@ -749,44 +749,44 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 static int ft1000_release(struct inode *inode, struct file *file)
 {
 	struct ft1000_info *info;
-    struct net_device *dev;
-    struct ft1000_usb *ft1000dev;
-    int i;
+	struct net_device *dev;
+	struct ft1000_usb *ft1000dev;
+	int i;
 	struct dpram_blk *pdpram_blk;
 
-    DEBUG("ft1000_release called\n");
+	DEBUG("ft1000_release called\n");
 
-    dev = file->private_data;
+	dev = file->private_data;
 	info = netdev_priv(dev);
 	ft1000dev = info->priv;
 
-    if (ft1000_flarion_cnt == 0) {
-        ft1000dev->appcnt--;
-        return (-EBADF);
-    }
-
-    /* Search for matching file object */
-    for (i=0; i<MAX_NUM_APP; i++) {
-        if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
-            /* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
-            break;
-        }
-    }
-
-    if (i==MAX_NUM_APP)
-	    return 0;
-
-    while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
-        DEBUG("Remove and free memory queue up on slow queue\n");
-        pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
-        list_del(&pdpram_blk->list);
-        ft1000_free_buffer(pdpram_blk, &freercvpool);
-    }
-
-    /* initialize application information */
-    ft1000dev->appcnt--;
-    DEBUG("ft1000_chdev:%s:appcnt = %d\n", __func__, ft1000dev->appcnt);
-    ft1000dev->app_info[i].fileobject = NULL;
-
-    return 0;
+	if (ft1000_flarion_cnt == 0) {
+		ft1000dev->appcnt--;
+		return (-EBADF);
+	}
+
+	/* Search for matching file object */
+	for (i=0; i<MAX_NUM_APP; i++) {
+		if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
+			/* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
+			break;
+		}
+	}
+
+	if (i==MAX_NUM_APP)
+		return 0;
+
+	while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
+		DEBUG("Remove and free memory queue up on slow queue\n");
+		pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
+		list_del(&pdpram_blk->list);
+		ft1000_free_buffer(pdpram_blk, &freercvpool);
+	}
+
+	/* initialize application information */
+	ft1000dev->appcnt--;
+	DEBUG("ft1000_chdev:%s:appcnt = %d\n", __func__, ft1000dev->appcnt);
+	ft1000dev->app_info[i].fileobject = NULL;
+
+	return 0;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Add required spaces.
  2014-06-07  3:02   ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Thomas Wood
  2014-06-07  3:02     ` [PATCH v2 1/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Replace spaces with tabs Thomas Wood
@ 2014-06-07  3:02     ` Thomas Wood
  2014-06-07  3:02     ` [PATCH v2 3/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary whitespace Thomas Wood
                       ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Thomas Wood @ 2014-06-07  3:02 UTC (permalink / raw)
  To: dan.carpenter; +Cc: marek.belisko, devel, gregkh, linux-kernel, Thomas Wood

Add spaces around operators, after commas, and between (foo*).

Signed-off-by: Thomas Wood <tommyandrena@gmail.com>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 48 ++++++++++++------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 338f91e..1395c2b 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -193,7 +193,7 @@ int ft1000_create_dev(struct ft1000_usb *dev)
 
 	/* initialize application information */
 	dev->appcnt = 0;
-	for (i=0; i<MAX_NUM_APP; i++) {
+	for (i = 0; i < MAX_NUM_APP; i++) {
 		dev->app_info[i].nTxMsg = 0;
 		dev->app_info[i].nRxMsg = 0;
 		dev->app_info[i].nTxMsgReject = 0;
@@ -260,7 +260,7 @@ void ft1000_destroy_dev(struct net_device *netdev)
 			dev->DeviceName);
 
 		/* Make sure we free any memory reserve for slow Queue */
-		for (i=0; i<MAX_NUM_APP; i++) {
+		for (i = 0; i < MAX_NUM_APP; i++) {
 			while (list_empty(&dev->app_info[i].app_sqlist) == 0) {
 				pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
 				list_del(&pdpram_blk->list);
@@ -301,7 +301,7 @@ static int ft1000_open(struct inode *inode, struct file *file)
 {
 	struct ft1000_info *info;
 	struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private;
-	int i,num;
+	int i, num;
 
 	DEBUG("%s called\n", __func__);
 	num = (MINOR(inode->i_rdev) & 0xf);
@@ -318,7 +318,7 @@ static int ft1000_open(struct inode *inode, struct file *file)
 	}
 
 	/* Search for available application info block */
-	for (i=0; i<MAX_NUM_APP; i++) {
+	for (i = 0; i < MAX_NUM_APP; i++) {
 		if ((dev->app_info[i].fileobject == NULL)) {
 			break;
 		}
@@ -369,7 +369,7 @@ static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait)
 	}
 
 	/* Search for matching file object */
-	for (i=0; i<MAX_NUM_APP; i++) {
+	for (i = 0; i < MAX_NUM_APP; i++) {
 		if (dev->app_info[i].fileobject == &file->f_owner) {
 			/* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", dev->app_info[i].app_id); */
 			break;
@@ -411,7 +411,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 	void __user *argp = (void __user *)argument;
 	struct ft1000_info *info;
 	struct ft1000_usb *ft1000dev;
-	int result=0;
+	int result = 0;
 	int cmd;
 	int i;
 	u16 tempword;
@@ -419,15 +419,15 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 	struct timeval tv;
 	struct IOCTL_GET_VER get_ver_data;
 	struct 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};
+	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;
+	unsigned short ledStat = 0;
+	unsigned short conStat = 0;
 
 	/* DEBUG("ft1000_ioctl called\n"); */
 
@@ -447,14 +447,14 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 	switch (cmd) {
 	case IOCTL_REGISTER_CMD:
 		DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n");
-		result = get_user(tempword, (__u16 __user*)argp);
+		result = get_user(tempword, (__u16 __user *)argp);
 		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++) {
+			for (i = 0; i < MAX_NUM_APP; i++) {
 				if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
 					ft1000dev->app_info[i].DspBCMsgFlag = 1;
 					DEBUG("FT1000:ft1000_ioctl:Registered for broadcast messages\n");
@@ -475,7 +475,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 			break;
 		}
 
-		DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n",(unsigned int)get_ver_data.drv_ver);
+		DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n", (unsigned int)get_ver_data.drv_ver);
 
 		break;
 	case IOCTL_CONNECT:
@@ -581,12 +581,12 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 					result = -EFAULT;
 				} else {
 					/* Check if this message came from a registered application */
-					for (i=0; i<MAX_NUM_APP; i++) {
+					for (i = 0; i < MAX_NUM_APP; i++) {
 						if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
 							break;
 						}
 					}
-					if (i==MAX_NUM_APP) {
+					if (i == MAX_NUM_APP) {
 						DEBUG("FT1000:No matching application fileobject\n");
 						result = -EINVAL;
 						kfree(dpram_data);
@@ -646,13 +646,13 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 						/* Calculate new checksum */
 						ppseudo_hdr->checksum = *pmsg++;
 						/* DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); */
-						for (i=1; i<7; i++) {
+						for (i = 1; i < 7; i++) {
 							ppseudo_hdr->checksum ^= *pmsg++;
 							/* DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); */
 						}
 						pmsg++;
 						ppseudo_hdr = (struct pseudo_hdr *)pmsg;
-						card_send_command(ft1000dev,(unsigned short*)dpram_data,total_len+2);
+						card_send_command(ft1000dev, (unsigned short *)dpram_data, total_len+2);
 
 
 						ft1000dev->app_info[app_index].nTxMsg++;
@@ -682,7 +682,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 			}
 
 			/* Search for matching file object */
-			for (i=0; i<MAX_NUM_APP; i++) {
+			for (i = 0; i < MAX_NUM_APP; i++) {
 				if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
 					/*DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
 					break;
@@ -766,14 +766,14 @@ static int ft1000_release(struct inode *inode, struct file *file)
 	}
 
 	/* Search for matching file object */
-	for (i=0; i<MAX_NUM_APP; i++) {
+	for (i = 0; i < MAX_NUM_APP; i++) {
 		if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
 			/* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */
 			break;
 		}
 	}
 
-	if (i==MAX_NUM_APP)
+	if (i == MAX_NUM_APP)
 		return 0;
 
 	while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 3/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary whitespace.
  2014-06-07  3:02   ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Thomas Wood
  2014-06-07  3:02     ` [PATCH v2 1/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Replace spaces with tabs Thomas Wood
  2014-06-07  3:02     ` [PATCH v2 2/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Add required spaces Thomas Wood
@ 2014-06-07  3:02     ` Thomas Wood
  2014-06-07  3:02     ` [PATCH v2 4/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary braces Thomas Wood
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Thomas Wood @ 2014-06-07  3:02 UTC (permalink / raw)
  To: dan.carpenter; +Cc: marek.belisko, devel, gregkh, linux-kernel, Thomas Wood

Remove whitespace before a quoted newline.
Remove space between function name and it's parameter list.

Signed-off-by: Thomas Wood <tommyandrena@gmail.com>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 1395c2b..5e371b7 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -556,7 +556,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 
 			if (info->CardReady) {
 
-				/* DEBUG("FT1000:ft1000_ioctl: try to SET_DPRAM \n"); */
+				/* DEBUG("FT1000:ft1000_ioctl: try to SET_DPRAM\n"); */
 
 				/* Get the length field to see how many bytes to copy */
 				result = get_user(msgsz, (__u16 __user *)argp);
@@ -712,7 +712,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 					break;
 				msglen = htons(msglen);
 				/* DEBUG("FT1000:ft1000_ioctl:msg length = %x\n", msglen); */
-				if (copy_to_user (&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen)) {
+				if (copy_to_user(&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen)) {
 					DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n");
 					result = -EFAULT;
 					break;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 4/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary braces.
  2014-06-07  3:02   ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Thomas Wood
                       ` (2 preceding siblings ...)
  2014-06-07  3:02     ` [PATCH v2 3/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary whitespace Thomas Wood
@ 2014-06-07  3:02     ` Thomas Wood
  2014-06-07  3:02     ` [PATCH v2 5/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes Thomas Wood
  2014-06-07 16:56     ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Greg KH
  5 siblings, 0 replies; 12+ messages in thread
From: Thomas Wood @ 2014-06-07  3:02 UTC (permalink / raw)
  To: dan.carpenter; +Cc: marek.belisko, devel, gregkh, linux-kernel, Thomas Wood

Remove unnecessary braces from single statement if blocks.

Signed-off-by: Thomas Wood <tommyandrena@gmail.com>
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 5e371b7..94fb9f9 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -319,9 +319,8 @@ static int ft1000_open(struct inode *inode, struct file *file)
 
 	/* Search for available application info block */
 	for (i = 0; i < MAX_NUM_APP; i++) {
-		if ((dev->app_info[i].fileobject == NULL)) {
+		if ((dev->app_info[i].fileobject == NULL))
 			break;
-		}
 	}
 
 	/* Fail due to lack of application info block */
@@ -540,17 +539,14 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 			/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_SET_DPRAM called\n");*/
 
 
-			if (ft1000_flarion_cnt == 0) {
+			if (ft1000_flarion_cnt == 0)
 				return (-EBADF);
-			}
 
-			if (ft1000dev->DrvMsgPend) {
+			if (ft1000dev->DrvMsgPend)
 				return (-ENOTTY);
-			}
 
-			if (ft1000dev->fProvComplete == 0) {
+			if (ft1000dev->fProvComplete == 0)
 				return (-EACCES);
-			}
 
 			ft1000dev->fAppMsgPend = 1;
 
@@ -582,9 +578,8 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 				} else {
 					/* Check if this message came from a registered application */
 					for (i = 0; i < MAX_NUM_APP; i++) {
-						if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
+						if (ft1000dev->app_info[i].fileobject == &file->f_owner)
 							break;
-						}
 					}
 					if (i == MAX_NUM_APP) {
 						DEBUG("FT1000:No matching application fileobject\n");
@@ -636,9 +631,8 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 						pmsg = (u16 *)&dpram_data->pseudohdr;
 						ppseudo_hdr = (struct pseudo_hdr *)pmsg;
 						total_len = msgsz+2;
-						if (total_len & 0x1) {
+						if (total_len & 0x1)
 							total_len++;
-						}
 
 						/* Insert slow queue sequence number */
 						ppseudo_hdr->seq_num = info->squeseqnum++;
@@ -677,9 +671,8 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 
 			/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM called\n"); */
 
-			if (ft1000_flarion_cnt == 0) {
+			if (ft1000_flarion_cnt == 0)
 				return (-EBADF);
-			}
 
 			/* Search for matching file object */
 			for (i = 0; i < MAX_NUM_APP; i++) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 5/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes.
  2014-06-07  3:02   ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Thomas Wood
                       ` (3 preceding siblings ...)
  2014-06-07  3:02     ` [PATCH v2 4/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary braces Thomas Wood
@ 2014-06-07  3:02     ` Thomas Wood
  2014-06-09  7:16       ` Dan Carpenter
  2014-06-20  0:01       ` Greg KH
  2014-06-07 16:56     ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Greg KH
  5 siblings, 2 replies; 12+ messages in thread
From: Thomas Wood @ 2014-06-07  3:02 UTC (permalink / raw)
  To: dan.carpenter; +Cc: marek.belisko, devel, gregkh, linux-kernel, Thomas Wood

Remove initialization of static value.
Invert the empty if statement's test to replace the else statement.
Remove parentheses from a return statement.
Fix some code indentation.

Signed-off-by: Thomas Wood <tommyandrena@gmail.com>
---

I'm pretty sure that the indentation was caused by a mistake by me earlier on in the patch set, so I'm fixing it now.

 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 89 ++++++++++++------------
 1 file changed, 44 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 94fb9f9..ef08db9 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -38,7 +38,7 @@
 #include <linux/debugfs.h>
 #include "ft1000_usb.h"
 
-static int ft1000_flarion_cnt = 0;
+static int ft1000_flarion_cnt;
 
 static int ft1000_open(struct inode *inode, struct file *file);
 static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait);
@@ -389,7 +389,7 @@ static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait)
 	poll_wait(file, &dev->app_info[i].wait_dpram_msg, wait);
 	/* DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n"); */
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -592,70 +592,69 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
 					/* Check message qtype type which is the lower byte within qos_class */
 					qtype = ntohs(dpram_data->pseudohdr.qos_class) & 0xff;
 					/* DEBUG("FT1000_ft1000_ioctl: qtype = %d\n", qtype); */
-					if (qtype) {
-					} else {
+					if (!qtype) {
 						/* 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_ioctl: 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);
+							/* 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) {
-									/* 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_ioctl:Doorbell not available\n");
-										result = -ENOTTY;
-										kfree(dpram_data);
-										break;
+										/* 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_ioctl:Doorbell not available\n");
+											result = -ENOTTY;
+											kfree(dpram_data);
+											break;
+										}
 									}
 								}
 							}
 						}
-					}
 
-					/*DEBUG("FT1000_ft1000_ioctl: 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 = (u16 *)&dpram_data->pseudohdr;
-						ppseudo_hdr = (struct pseudo_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 = ft1000dev->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("FT1000_ft1000_ioctl: 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 = (u16 *)&dpram_data->pseudohdr;
+							ppseudo_hdr = (struct pseudo_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 = ft1000dev->app_info[app_index].app_id;
+							/* Calculate new checksum */
+							ppseudo_hdr->checksum = *pmsg++;
 							/* DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); */
-						}
-						pmsg++;
-						ppseudo_hdr = (struct pseudo_hdr *)pmsg;
-						card_send_command(ft1000dev, (unsigned short *)dpram_data, total_len+2);
+							for (i = 1; i < 7; i++) {
+								ppseudo_hdr->checksum ^= *pmsg++;
+								/* DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); */
+							}
+							pmsg++;
+							ppseudo_hdr = (struct pseudo_hdr *)pmsg;
+							card_send_command(ft1000dev, (unsigned short *)dpram_data, total_len+2);
 
 
-						ft1000dev->app_info[app_index].nTxMsg++;
-						} else {
-							result = -EINVAL;
+							ft1000dev->app_info[app_index].nTxMsg++;
+							} else {
+								result = -EINVAL;
+							}
 						}
 					}
-				}
-			} else {
+				} else {
 				DEBUG("FT1000:ft1000_ioctl: Card not ready take messages\n");
 				result = -EACCES;
 			}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings.
  2014-06-07  3:02   ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Thomas Wood
                       ` (4 preceding siblings ...)
  2014-06-07  3:02     ` [PATCH v2 5/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes Thomas Wood
@ 2014-06-07 16:56     ` Greg KH
  5 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2014-06-07 16:56 UTC (permalink / raw)
  To: Thomas Wood; +Cc: dan.carpenter, marek.belisko, devel, linux-kernel

On Fri, Jun 06, 2014 at 08:02:13PM -0700, Thomas Wood wrote:
> Changes since v1:
>  * Made single patch into a patch set.
>  * Added better commit messages.
> 
> Is this better, or do I still have to split up my first patch?

At first glance, it looks fine, I'll queue this up after 3.16-rc1 is out
(in about a week or so).

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 5/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes.
  2014-06-07  3:02     ` [PATCH v2 5/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes Thomas Wood
@ 2014-06-09  7:16       ` Dan Carpenter
  2014-06-20  0:01       ` Greg KH
  1 sibling, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2014-06-09  7:16 UTC (permalink / raw)
  To: Thomas Wood; +Cc: marek.belisko, devel, gregkh, linux-kernel

On Fri, Jun 06, 2014 at 08:02:18PM -0700, Thomas Wood wrote:
> Remove initialization of static value.
> Invert the empty if statement's test to replace the else statement.
> Remove parentheses from a return statement.
> Fix some code indentation.
> 
> Signed-off-by: Thomas Wood <tommyandrena@gmail.com>
> ---
> 
> I'm pretty sure that the indentation was caused by a mistake by me earlier on in the patch set, so I'm fixing it now.
> 

No....  That's not the right thing.  If you cause the mistake earlier,
then redo the earlier patch.

Also I feel like fixing the indent here makes the patch into a "does too
many things in one go patch."  This patch is on the limit anyway.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 5/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes.
  2014-06-07  3:02     ` [PATCH v2 5/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes Thomas Wood
  2014-06-09  7:16       ` Dan Carpenter
@ 2014-06-20  0:01       ` Greg KH
  1 sibling, 0 replies; 12+ messages in thread
From: Greg KH @ 2014-06-20  0:01 UTC (permalink / raw)
  To: Thomas Wood; +Cc: dan.carpenter, devel, linux-kernel

On Fri, Jun 06, 2014 at 08:02:18PM -0700, Thomas Wood wrote:
> Remove initialization of static value.
> Invert the empty if statement's test to replace the else statement.
> Remove parentheses from a return statement.
> Fix some code indentation.
> 
> Signed-off-by: Thomas Wood <tommyandrena@gmail.com>
> ---
> 
> I'm pretty sure that the indentation was caused by a mistake by me earlier on in the patch set, so I'm fixing it now.

As Dan says, please fix this in the original patch.

Can you please fix this up and resend the whole series?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-06-19 23:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-02  2:26 [PATCH] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and some warnings Thomas Wood
2014-06-02 10:30 ` Dan Carpenter
2014-06-02 19:23   ` Thomas Wood
2014-06-07  3:02   ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Thomas Wood
2014-06-07  3:02     ` [PATCH v2 1/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Replace spaces with tabs Thomas Wood
2014-06-07  3:02     ` [PATCH v2 2/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Add required spaces Thomas Wood
2014-06-07  3:02     ` [PATCH v2 3/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary whitespace Thomas Wood
2014-06-07  3:02     ` [PATCH v2 4/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary braces Thomas Wood
2014-06-07  3:02     ` [PATCH v2 5/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes Thomas Wood
2014-06-09  7:16       ` Dan Carpenter
2014-06-20  0:01       ` Greg KH
2014-06-07 16:56     ` [PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).