static void cam_destroy_kernel_debuglevel(void) { CAM_PRINTK(1, "destroy kernel debuglevel!!!\n"); if (kernel_debuglevel_dir) debugfs_remove_recursive(kernel_debuglevel_dir); }
static void cam_create_kernel_debuglevel(void) { CAM_PRINTK(1, "create kernel debuglevel!!!\n"); if (kernel_debuglevel_dir!=NULL) { debugfs_create_u32("cam_mt9p017_dll", S_IRUGO | S_IWUGO, kernel_debuglevel_dir, (u32 *)(&CAM_MT9P017_DLL)); } else { printk(KERN_ERR "kernel_debuglevel_dir ts_dl Fail\n"); } }
int sr130pc10_regs_table_init(void) { struct file *filp; char *dp; long l; loff_t pos; int ret, i, retry_cnt; mm_segment_t fs = get_fs(); char *location_ptr = NULL; bool bFound_name; cam_dbg(" %d\n", __LINE__); set_fs(get_ds()); filp = filp_open("/sdcard/sr130pc10.h", O_RDONLY, 0); if(IS_ERR(filp)) { CAM_PRINTK(KERN_ERR "file open error\n"); return -EIO; } l = filp->f_path.dentry->d_inode->i_size; cam_dbg(" file size = %ld\n", l); //msleep(50); cam_dbg("Start vmalloc\n"); for(retry_cnt = 5; retry_cnt > 0; retry_cnt--) { dp = kmalloc(l, GFP_KERNEL); if(dp != NULL) break; msleep(50); } if(dp == NULL) { CAM_PRINTK(KERN_ERR "Out of Memory\n"); filp_close(filp, current->files); return -ENOMEM; } cam_dbg("End vmalloc\n"); pos = 0; memset(dp, 0, l); cam_dbg("Start vfs_read\n"); ret = vfs_read(filp, (char __user *)dp, l, &pos); if(ret != l) { CAM_PRINTK(KERN_ERR "Failed to read file ret = %d\n", ret); vfree(dp); filp_close(filp, current->files); return -EINVAL; } cam_dbg("End vfs_read\n"); filp_close(filp, current->files); set_fs(fs); front_regs_buf_ptr = dp; *((front_regs_buf_ptr + l) - 1) = '\0'; /* Make hash table to enhance speed.*/ front_curr_pos_ptr = front_regs_buf_ptr; location_ptr = front_curr_pos_ptr; for(i = 0; i < sizeof(front_reg_hash_table)/sizeof(reg_hash_t); i++) { front_reg_hash_table[i].location_ptr = NULL; bFound_name = false; while(sr130pc10_regs_get_line(front_current_line)) { if(strstr(front_current_line, front_reg_hash_table[i].name) != NULL) { bFound_name = true; front_reg_hash_table[i].location_ptr = location_ptr; break; } location_ptr = front_curr_pos_ptr; } if(bFound_name == false) { if(i == 0) { cam_err(" ERROR! Couldn't find the reg name in hash table\n"); return -EIO; } else { front_curr_pos_ptr = front_reg_hash_table[i-1].location_ptr; } location_ptr = front_curr_pos_ptr; cam_err(" ERROR! Couldn't find the reg name in hash table\n"); } } cam_dbg("sr130pc10_reg_table_init\n"); return 0; }