]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[net-next-2.6.git] / drivers / staging / ft1000 / ft1000-usb / ft1000_chdev.c
index 44b037c2033e41aef76b2057f32e754f093750b9..20d509836d9e24b9ef7e67ac185caeb1c960a993 100644 (file)
 #include "ft1000_usb.h"
 //#include "ft1000_ioctl.h"
 
-void ft1000_DestroyDevice(struct net_device *dev);
-u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buffer, u8 highlow);
-u16 ft1000_read_register(struct ft1000_device *ft1000dev, short* Data, u16 nRegIndx);
+static int ft1000_flarion_cnt = 0;
 
-extern inline u16 ft1000_asic_read (struct net_device *dev, u16 offset);
-extern inline void ft1000_asic_write (struct net_device *dev, u16 offset, u16 value);
-extern void CardSendCommand(struct ft1000_device *ft1000dev, unsigned short *ptempbuffer, int size);
+//need to looking usage of ft1000Handle
 
 static int ft1000_ChOpen (struct inode *Inode, struct file *File);
 static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait);
@@ -55,12 +51,6 @@ static long ft1000_ChIoctl(struct file *File, unsigned int Command,
                            unsigned long Argument);
 static int ft1000_ChRelease (struct inode *Inode, struct file *File);
 
-static int ft1000_flarion_cnt = 0;
-
-//need to looking usage of ft1000Handle
-
-
-
 // Global pointer to device object
 static struct ft1000_device *pdevobj[MAX_NUM_CARDS + 2];
 //static devfs_handle_t ft1000Handle[MAX_NUM_CARDS];
@@ -105,7 +95,7 @@ static struct file_operations ft1000fops =
 //---------------------------------------------------------------------------
 static int exec_mknod (void *pdata)
 {
-    PFT1000_INFO info;
+       struct ft1000_info *info;
     char mjnum[4];
     char minornum[4];
     char temp[32];
@@ -147,13 +137,13 @@ static int exec_mknod (void *pdata)
 static int rm_mknod (void *pdata)
 {
 
-    PFT1000_INFO info;
+       struct ft1000_info *info;
     //char *argv[4]={"rm", "-f", "/dev/FT1000", NULL};
     int retcode;
     char temp[32];
     char *argv[]={"rm", "-f", temp, NULL};
 
-    info = (PFT1000_INFO)pdata;
+       info = (struct ft1000_info *)pdata;
     DEBUG("ft1000_chdev:rm_mknod is called for device %s\n", info->DeviceName);
     sprintf(temp, "%s%s", "/dev/", info->DeviceName) ;
 
@@ -182,10 +172,10 @@ static int rm_mknod (void *pdata)
 // Notes:
 //
 //---------------------------------------------------------------------------
-PDPRAM_BLK ft1000_get_buffer (struct list_head *bufflist)
+struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist)
 {
     unsigned long flags;
-    PDPRAM_BLK ptr;
+       struct dpram_blk *ptr;
 
     spin_lock_irqsave(&free_buff_lock, flags);
     // Check if buffer is available
@@ -195,7 +185,7 @@ PDPRAM_BLK ft1000_get_buffer (struct list_head *bufflist)
     }
     else {
         numofmsgbuf--;
-        ptr = list_entry(bufflist->next, DPRAM_BLK, list);
+       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);
     }
@@ -219,7 +209,7 @@ PDPRAM_BLK ft1000_get_buffer (struct list_head *bufflist)
 // Notes:
 //
 //---------------------------------------------------------------------------
-void ft1000_free_buffer (PDPRAM_BLK pdpram_blk, struct list_head *plist)
+void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist)
 {
     unsigned long flags;
 
@@ -245,7 +235,7 @@ void ft1000_free_buffer (PDPRAM_BLK pdpram_blk, struct list_head *plist)
 //---------------------------------------------------------------------------
 int ft1000_CreateDevice(struct ft1000_device *dev)
 {
-    PFT1000_INFO info = netdev_priv(dev->net);
+       struct ft1000_info *info = netdev_priv(dev->net);
     int result;
     int i;
     pid_t pid;
@@ -263,7 +253,7 @@ int ft1000_CreateDevice(struct ft1000_device *dev)
     //save the device info to global array
     pdevobj[info->CardNumber] = dev;
 
-    DEBUG("ft1000_CreateDevice: ******SAVED pdevobj[%d]=%x\n", info->CardNumber, (unsigned int)pdevobj[info->CardNumber]);     //aelias [+] reason:up
+    DEBUG("ft1000_CreateDevice: ******SAVED pdevobj[%d]=%p\n", info->CardNumber, pdevobj[info->CardNumber]);   //aelias [+] reason:up
 
     if (info->DeviceCreated)
     {
@@ -296,7 +286,6 @@ int ft1000_CreateDevice(struct ft1000_device *dev)
     pid = kernel_thread (exec_mknod, (void *)info, 0);
 
     // initialize application information
-    info->appcnt = 0;
 
 //    if (ft1000_flarion_cnt == 0) {
 //
@@ -309,7 +298,7 @@ int ft1000_CreateDevice(struct ft1000_device *dev)
 //        // create list of free buffers
 //        for (i=0; i<NUM_OF_FREE_BUFFERS; i++) {
 //            // Get memory for DPRAM_DATA link list
-//            pdpram_blk = kmalloc ( sizeof(DPRAM_BLK), GFP_KERNEL );
+//            pdpram_blk = kmalloc ( sizeof(struct dpram_blk), GFP_KERNEL );
 //            // Get a block of memory to store command data
 //            pdpram_blk->pbuffer = kmalloc ( MAX_CMD_SQSIZE, GFP_KERNEL );
 //            // link provisioning data
@@ -326,7 +315,7 @@ int ft1000_CreateDevice(struct ft1000_device *dev)
         info->app_info[i].nRxMsg = 0;
         info->app_info[i].nTxMsgReject = 0;
         info->app_info[i].nRxMsgMiss = 0;
-        info->app_info[i].fileobject = 0;
+        info->app_info[i].fileobject = NULL;
         info->app_info[i].app_id = i+1;
         info->app_info[i].DspBCMsgFlag = 0;
         info->app_info[i].NumOfMsg = 0;
@@ -359,12 +348,12 @@ int ft1000_CreateDevice(struct ft1000_device *dev)
 //---------------------------------------------------------------------------
 void ft1000_DestroyDevice(struct net_device *dev)
 {
-    PFT1000_INFO info = netdev_priv(dev);
+       struct ft1000_info *info = netdev_priv(dev);
     int result = 0;
     pid_t pid;
                int i;
-    PDPRAM_BLK pdpram_blk;
-    DPRAM_BLK *ptr;
+       struct dpram_blk *pdpram_blk;
+       struct dpram_blk *ptr;
 
     DEBUG("ft1000_chdev:ft1000_DestroyDevice called\n");
 
@@ -382,7 +371,7 @@ void ft1000_DestroyDevice(struct net_device *dev)
         // Make sure we free any memory reserve for slow Queue
         for (i=0; i<MAX_NUM_APP; i++) {
             while (list_empty(&info->app_info[i].app_sqlist) == 0) {
-                pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list);
+                pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, struct dpram_blk, list);
                 list_del(&pdpram_blk->list);
                 ft1000_free_buffer(pdpram_blk, &freercvpool);
 
@@ -393,7 +382,7 @@ void ft1000_DestroyDevice(struct net_device *dev)
         // Remove buffer allocated for receive command data
         if (ft1000_flarion_cnt == 0) {
             while (list_empty(&freercvpool) == 0) {
-                ptr = list_entry(freercvpool.next, DPRAM_BLK, list);
+               ptr = list_entry(freercvpool.next, struct dpram_blk, list);
                 list_del(&ptr->list);
                 kfree(ptr->pbuffer);
                 kfree(ptr);
@@ -422,7 +411,7 @@ void ft1000_DestroyDevice(struct net_device *dev)
 //---------------------------------------------------------------------------
 static int ft1000_ChOpen (struct inode *Inode, struct file *File)
 {
-    PFT1000_INFO info;
+       struct ft1000_info *info;
     int i,num;
 
     DEBUG("ft1000_ChOpen called\n");
@@ -430,18 +419,18 @@ static int ft1000_ChOpen (struct inode *Inode, struct file *File)
     DEBUG("ft1000_ChOpen: minor number=%d\n", num);
 
     for (i=0; i<5; i++)
-        DEBUG("pdevobj[%d]=%x\n", i, (unsigned int)pdevobj[i]); //aelias [+] reason: down
+        DEBUG("pdevobj[%d]=%p\n", i, pdevobj[i]); //aelias [+] reason: down
 
     if ( pdevobj[num] != NULL )
-        //info = (PFT1000_INFO)(pdevobj[num]->net->priv);
-       info = (FT1000_INFO *) netdev_priv (pdevobj[num]->net);
+        //info = (struct ft1000_info *)(pdevobj[num]->net->priv);
+               info = (struct ft1000_info *)netdev_priv(pdevobj[num]->net);
     else
     {
         DEBUG("ft1000_ChOpen: can not find device object %d\n", num);
         return -1;
     }
 
-    DEBUG("f_owner = 0x%8x number of application = %d\n", (u32)(&File->f_owner), info->appcnt );
+    DEBUG("f_owner = %p number of application = %d\n", (&File->f_owner), info->appcnt );
 
     // Check if maximum number of application exceeded
     if (info->appcnt > MAX_NUM_APP) {
@@ -451,7 +440,7 @@ static int ft1000_ChOpen (struct inode *Inode, struct file *File)
 
     // Search for available application info block
     for (i=0; i<MAX_NUM_APP; i++) {
-        if ( (info->app_info[i].fileobject == 0) ) {
+        if ( (info->app_info[i].fileobject == NULL) ) {
             break;
         }
     }
@@ -463,7 +452,7 @@ static int ft1000_ChOpen (struct inode *Inode, struct file *File)
     }
 
     info->appcnt++;
-    info->app_info[i].fileobject = (u32)(&File->f_owner);
+    info->app_info[i].fileobject = &File->f_owner;
     info->app_info[i].nTxMsg = 0;
     info->app_info[i].nRxMsg = 0;
     info->app_info[i].nTxMsgReject = 0;
@@ -490,7 +479,7 @@ static int ft1000_ChOpen (struct inode *Inode, struct file *File)
 static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait)
 {
     struct net_device *dev = file->private_data;
-    PFT1000_INFO info;
+       struct ft1000_info *info;
     int i;
 
     //DEBUG("ft1000_ChPoll called\n");
@@ -499,11 +488,11 @@ static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait)
         return (-EBADF);
     }
 
-       info = (FT1000_INFO *) netdev_priv (dev);
+       info = (struct ft1000_info *) netdev_priv(dev);
 
     // Search for matching file object
     for (i=0; i<MAX_NUM_APP; i++) {
-        if ( info->app_info[i].fileobject == (u32)(&file->f_owner) ) {
+        if ( info->app_info[i].fileobject == &file->f_owner) {
             //DEBUG("FT1000:ft1000_ChIoctl: Message is for AppId = %d\n", info->app_info[i].app_id);
             break;
         }
@@ -539,8 +528,9 @@ static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait)
 static long ft1000_ChIoctl (struct file *File, unsigned int Command,
                            unsigned long Argument)
 {
+    void __user *argp = (void __user *)Argument;
     struct net_device *dev;
-    PFT1000_INFO info;
+       struct ft1000_info *info;
     struct ft1000_device *ft1000dev;
     int result=0;
     int cmd;
@@ -570,7 +560,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
     //DEBUG("FT1000:ft1000_ChIoctl:Command = 0x%x Argument = 0x%8x\n", Command, (u32)Argument);
 
     dev = File->private_data;
-       info = (FT1000_INFO *) netdev_priv (dev);
+       info = (struct ft1000_info *) netdev_priv(dev);
     ft1000dev = info->pFt1000Dev;
     cmd = _IOC_NR(Command);
     //DEBUG("FT1000:ft1000_ChIoctl:cmd = 0x%x\n", cmd);
@@ -579,7 +569,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
     switch (cmd) {
     case IOCTL_REGISTER_CMD:
             DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_REGISTER called\n");
-            result = get_user(tempword, (unsigned short *)Argument);
+            result = get_user(tempword, (__u16 __user*)argp);
             if (result) {
                 DEBUG("result = %d failed to get_user\n", result);
                 break;
@@ -587,7 +577,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
             if (tempword == DSPBCMSGID) {
                 // Search for matching file object
                 for (i=0; i<MAX_NUM_APP; i++) {
-                    if ( info->app_info[i].fileobject == (u32)(&File->f_owner) ) {
+                    if ( info->app_info[i].fileobject == &File->f_owner) {
                         info->app_info[i].DspBCMsgFlag = 1;
                         DEBUG("FT1000:ft1000_ChIoctl:Registered for broadcast messages\n");
                         break;
@@ -601,7 +591,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
 
         get_ver_data.drv_ver = FT1000_DRV_VER;
 
-        if (copy_to_user((PIOCTL_GET_VER)Argument, &get_ver_data, sizeof(get_ver_data)) ) {
+        if (copy_to_user(argp, &get_ver_data, sizeof(get_ver_data)) ) {
             DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
             result = -EFAULT;
             break;
@@ -625,7 +615,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
         break;
     case IOCTL_GET_DSP_STAT_CMD:
         //DEBUG("FT1000:ft1000_ChIoctl: 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);
@@ -651,7 +641,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
         do_gettimeofday ( &tv );
         get_stat_data.ConTm = (u32)(tv.tv_sec - info->ConTm);
         DEBUG("Connection Time = %d\n", (int)get_stat_data.ConTm);
-        if (copy_to_user((PIOCTL_GET_DSP_STAT)Argument, &get_stat_data, sizeof(get_stat_data)) ) {
+        if (copy_to_user(argp, &get_stat_data, sizeof(get_stat_data)) ) {
             DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
             result = -EFAULT;
             break;
@@ -660,11 +650,11 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
         break;
     case IOCTL_SET_DPRAM_CMD:
         {
-            IOCTL_DPRAM_BLK dpram_data;
+            IOCTL_DPRAM_BLK *dpram_data;
             //IOCTL_DPRAM_COMMAND dpram_command;
             USHORT qtype;
             USHORT msgsz;
-            PPSEUDO_HDR ppseudo_hdr;
+               struct pseudo_hdr *ppseudo_hdr;
             PUSHORT pmsg;
             USHORT total_len;
             USHORT app_index;
@@ -692,7 +682,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
                //DEBUG("FT1000:ft1000_ChIoctl: try to SET_DPRAM \n");
 
                 // Get the length field to see how many bytes to copy
-                result = get_user(msgsz, (unsigned short *)Argument);
+                result = get_user(msgsz, (__u16 __user *)argp);
                 msgsz = ntohs (msgsz);
                 //DEBUG("FT1000:ft1000_ChIoctl: length of message = %d\n", msgsz);
 
@@ -702,8 +692,13 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
                     break;
                 }
 
+               result = -ENOMEM;
+               dpram_data = kmalloc(msgsz + 2, GFP_KERNEL);
+               if (!dpram_data)
+                       break;
+
                 //if ( copy_from_user(&(dpram_command.dpram_blk), (PIOCTL_DPRAM_BLK)Argument, msgsz+2) ) {
-                if ( copy_from_user(&dpram_data, (PIOCTL_DPRAM_BLK)Argument, msgsz+2) ) {
+                if ( copy_from_user(&dpram_data, argp, msgsz+2) ) {
                     DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
                     result = -EFAULT;
                 }
@@ -717,20 +712,21 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
 #endif
                     // Check if this message came from a registered application
                     for (i=0; i<MAX_NUM_APP; i++) {
-                        if ( info->app_info[i].fileobject == (u32)(&File->f_owner) ) {
+                        if ( info->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_command.dpram_blk.pseudohdr.qos_class) & 0xff;
-                    qtype = ntohs(dpram_data.pseudohdr.qos_class) & 0xff;
+                    qtype = ntohs(dpram_data->pseudohdr.qos_class) & 0xff;
                     //DEBUG("FT1000_ft1000_ChIoctl: qtype = %d\n", qtype);
                     if (qtype) {
                     }
@@ -756,6 +752,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
                                         if (tempword & FT1000_DB_DPRAM_TX) {
                                             DEBUG("FT1000:ft1000_ChIoctl:Doorbell not available\n");
                                             result = -ENOTTY;
+                                               kfree(dpram_data);
                                             break;
                                         }
                                     }
@@ -769,8 +766,8 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
                         if ( (msgsz < MAX_CMD_SQSIZE) && (msgsz > PSEUDOSZ) ) {
                             // Need to put sequence number plus new checksum for message
                             //pmsg = (PUSHORT)&dpram_command.dpram_blk.pseudohdr;
-                            pmsg = (PUSHORT)&dpram_data.pseudohdr;
-                            ppseudo_hdr = (PPSEUDO_HDR)pmsg;
+                            pmsg = (PUSHORT)&dpram_data->pseudohdr;
+                               ppseudo_hdr = (struct pseudo_hdr *)pmsg;
                             total_len = msgsz+2;
                             if (total_len & 0x1) {
                                 total_len++;
@@ -787,9 +784,9 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
                                 //DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum);
                             }
                             pmsg++;
-                            ppseudo_hdr = (PPSEUDO_HDR)pmsg;
+                               ppseudo_hdr = (struct pseudo_hdr *)pmsg;
 #if 0
-                            ptr = (char *)&dpram_data;
+                            ptr = dpram_data;
                             DEBUG("FT1000:ft1000_ChIoctl: Command Send\n");
                             for (i=0; i<total_len; i++) {
                                 DEBUG("FT1000:ft1000_ChIoctl: data %d = 0x%x\n", i, *ptr++);
@@ -798,15 +795,13 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
                             //dpram_command.extra = 0;
 
                             //CardSendCommand(ft1000dev,(unsigned char*)&dpram_command,total_len+2);
-                            CardSendCommand(ft1000dev,(unsigned short*)&dpram_data,total_len+2);
+                            CardSendCommand(ft1000dev,(unsigned short*)dpram_data,total_len+2);
 
 
                             info->app_info[app_index].nTxMsg++;
-                            break;
                         }
                         else {
                             result = -EINVAL;
-                            break;
                         }
                     }
                 }
@@ -815,13 +810,14 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
                 DEBUG("FT1000:ft1000_ChIoctl: Card not ready take messages\n");
                 result = -EACCES;
             }
+           kfree(dpram_data);
 
         }
         break;
     case IOCTL_GET_DPRAM_CMD:
         {
-            PDPRAM_BLK pdpram_blk;
-            PIOCTL_DPRAM_BLK pioctl_dpram;
+               struct dpram_blk *pdpram_blk;
+            IOCTL_DPRAM_BLK __user *pioctl_dpram;
             int msglen;
 
             //DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_DPRAM called\n");
@@ -832,7 +828,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
 
             // Search for matching file object
             for (i=0; i<MAX_NUM_APP; i++) {
-                if ( info->app_info[i].fileobject == (u32)(&File->f_owner) ) {
+                if ( info->app_info[i].fileobject == &File->f_owner) {
                     //DEBUG("FT1000:ft1000_ChIoctl: Message is for AppId = %d\n", info->app_info[i].app_id);
                     break;
                 }
@@ -846,17 +842,20 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
             }
 
             result = 0;
-            pioctl_dpram = (PIOCTL_DPRAM_BLK)Argument;
+            pioctl_dpram = argp;
             if (list_empty(&info->app_info[i].app_sqlist) == 0) {
                 //DEBUG("FT1000:ft1000_ChIoctl:Message detected in slow queue\n");
                 spin_lock_irqsave(&free_buff_lock, flags);
-                pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list);
+                pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, struct dpram_blk, list);
                 list_del(&pdpram_blk->list);
                 info->app_info[i].NumOfMsg--;
                 //DEBUG("FT1000:ft1000_ChIoctl:NumOfMsg for app %d = %d\n", i, info->app_info[i].NumOfMsg);
                 spin_unlock_irqrestore(&free_buff_lock, flags);
                 msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ;
-                pioctl_dpram->total_len = htons(msglen);
+                result = get_user(msglen, &pioctl_dpram->total_len);
+               if (result)
+                       break;
+               msglen = htons(msglen);
                 //DEBUG("FT1000:ft1000_ChIoctl:msg length = %x\n", msglen);
                 if(copy_to_user (&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen))
                                {
@@ -893,15 +892,15 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
 //---------------------------------------------------------------------------
 static int ft1000_ChRelease (struct inode *Inode, struct file *File)
 {
-    PFT1000_INFO info;
+       struct ft1000_info *info;
     struct net_device *dev;
     int i;
-    PDPRAM_BLK pdpram_blk;
+       struct dpram_blk *pdpram_blk;
 
     DEBUG("ft1000_ChRelease called\n");
 
     dev = File->private_data;
-       info = (FT1000_INFO *) netdev_priv (dev);
+       info = (struct ft1000_info *) netdev_priv(dev);
 
     if (ft1000_flarion_cnt == 0) {
         info->appcnt--;
@@ -910,7 +909,7 @@ static int ft1000_ChRelease (struct inode *Inode, struct file *File)
 
     // Search for matching file object
     for (i=0; i<MAX_NUM_APP; i++) {
-        if ( info->app_info[i].fileobject == (u32)(&File->f_owner) ) {
+        if ( info->app_info[i].fileobject == &File->f_owner) {
             //DEBUG("FT1000:ft1000_ChIoctl: Message is for AppId = %d\n", info->app_info[i].app_id);
             break;
         }
@@ -921,7 +920,7 @@ static int ft1000_ChRelease (struct inode *Inode, struct file *File)
 
     while (list_empty(&info->app_info[i].app_sqlist) == 0) {
         DEBUG("Remove and free memory queue up on slow queue\n");
-        pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list);
+        pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, struct dpram_blk, list);
         list_del(&pdpram_blk->list);
         ft1000_free_buffer(pdpram_blk, &freercvpool);
     }
@@ -929,7 +928,7 @@ static int ft1000_ChRelease (struct inode *Inode, struct file *File)
     // initialize application information
     info->appcnt--;
     DEBUG("ft1000_chdev:%s:appcnt = %d\n", __FUNCTION__, info->appcnt);
-    info->app_info[i].fileobject = 0;
+    info->app_info[i].fileobject = NULL;
 
     return 0;
 }