/******************************************************************************************* Function: motionhub_init Description: apply kernel buffer, register motionhub_miscdev Data Accessed: no Data Updated: no Input: void Output: void Return: result of function, 0 successed, else false *******************************************************************************************/ static int __init motionhub_init(void) { int ret; #ifdef MHB_LOG_ON printk(KERN_INFO "motionhub_init start \n"); #endif printk(KERN_INFO "motionhub_init start \n"); ret = inputhub_route_open(ROUTE_MOTION_PORT); if(ret != 0) { printk(KERN_ERR "cannot open inputhub route err=%d\n", ret); return ret; } ret = misc_register(&motionhub_miscdev); if(ret != 0) { printk(KERN_ERR "cannot register miscdev err=%d\n", ret); #ifdef MHB_LOG_ON printk(KERN_ERR "cannot register miscdev err=%d\n", ret); #endif inputhub_route_close(ROUTE_MOTION_PORT); return ret; } printk(KERN_INFO "motionhub_init ok\n"); #ifdef MHB_LOG_ON printk(KERN_INFO "motionhub_init ok\n"); #endif return ret; }
/******************************************************************************************* Function: motionhub_exit Description: release kernel buffer, deregister motionhub_miscdev Data Accessed: no Data Updated: no Input: void Output: void Return: void *******************************************************************************************/ static void __exit motionhub_exit(void) { int ret; inputhub_route_close(ROUTE_MOTION_PORT); ret = misc_deregister(&motionhub_miscdev); printk(KERN_INFO "motionhub_exit ret=%d\n", ret); }
/******************************************************************************************* Function: sensorhub_exit Description: 释放kernel缓冲区并初始化读写指针,注销msic设备 Data Accessed: 无 Data Updated: 无 Input: 无 Output: 无 Return: 成功或者失败信息 *******************************************************************************************/ void __exit sensorhub_exit(void) { int ret; inputhub_route_close(ROUTE_SHB_PORT); ret = misc_deregister(&senorhub_miscdev); hwlog_info( "sensorhub_exit ret=%d\n", ret); }
/******************************************************************************************* Function: sensorhub_init Description: 申请kernel缓冲区并初始化读写指针,注册msic设备 Data Accessed: 无 Data Updated: 无 Input: 无 Output: 无 Return: 成功或者失败信息 *******************************************************************************************/ int __init sensorhub_init(void) { int ret; ret = inputhub_route_open(ROUTE_SHB_PORT); if (ret != 0) { hwlog_err( "cannot open inputhub route err=%d\n", ret); return ret; } ret = misc_register(&senorhub_miscdev); if (ret != 0) { inputhub_route_close(ROUTE_SHB_PORT); hwlog_err( "cannot register miscdev err=%d\n", ret); return ret; } hwlog_info( "sensorhub_init ok\n"); return 0; }