static void __exit mtk_cooler_bcct_exit(void) { mtk_cooler_bcct_dprintk("exit\n"); /* remove the proc file */ remove_proc_entry("driver/mtk-cl-bcct", NULL); mtk_cooler_bcct_unregister_ltf(); }
static int __init mtk_cooler_bcct_init(void) { int err = 0; int i; for (i = MAX_NUM_INSTANCE_MTK_COOLER_BCCT; i-- > 0; ) { cl_bcct_dev[i] = NULL; cl_bcct_state[i] = 0; } //cl_bcct_dev = NULL; mtk_cooler_bcct_dprintk("init\n"); err = mtk_cooler_bcct_register_ltf(); if (err) goto err_unreg; /* create a proc file */ { struct proc_dir_entry *entry = NULL; struct proc_dir_entry *dir_entry = NULL; dir_entry = mtk_thermal_get_proc_drv_therm_dir_entry(); if (!dir_entry) { mtk_cooler_bcct_dprintk("[%s]: mkdir /proc/driver/thermal failed\n", __func__); } entry = proc_create("clbcct", S_IRUGO | S_IWUSR | S_IWGRP, dir_entry, &_cl_bcct_fops); if (!entry) { mtk_cooler_bcct_dprintk_always("%s clbcct creation failed\n", __func__); } else { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) proc_set_user(entry, 0, 1000); #else entry->gid = 1000; #endif } } return 0; err_unreg: mtk_cooler_bcct_unregister_ltf(); return err; }
static int __init mtk_cooler_bcct_init(void) { int err = 0; int i; for (i = MAX_NUM_INSTANCE_MTK_COOLER_BCCT; i-- > 0; ) { cl_bcct_dev[i] = NULL; cl_bcct_state[i] = 0; } //cl_bcct_dev = NULL; mtk_cooler_bcct_dprintk("init\n"); err = mtk_cooler_bcct_register_ltf(); if (err) goto err_unreg; /* create a proc file */ { struct proc_dir_entry *entry = NULL; entry = create_proc_entry("driver/mtk-cl-bcct", S_IRUGO | S_IWUSR | S_IWGRP, NULL); if (NULL != entry) { entry->read_proc = _mtk_cl_bcct_proc_read; entry->write_proc = _mtk_cl_bcct_proc_write; entry->data = cl_bcct_state; entry->gid = 1000; // allow system process to write this proc } mtk_cooler_bcct_dprintk("[mtk_cooler_bcct_init] proc file created: %x \n", entry->data); } return 0; err_unreg: mtk_cooler_bcct_unregister_ltf(); return err; }