int res_trk_open_secure_session() { int rc; if (res_trk_check_for_sec_session() == 1) { mutex_lock(&resource_context.secure_lock); pr_err("Securing...\n"); rc = res_trk_enable_iommu_clocks(); if (rc) { pr_err("IOMMU clock enabled failed while open"); goto error_open; } msm_ion_secure_heap(ION_HEAP(resource_context.memtype)); msm_ion_secure_heap(ION_HEAP(resource_context.cmd_mem_type)); res_trk_disable_iommu_clocks(); mutex_unlock(&resource_context.secure_lock); } return 0; error_open: mutex_unlock(&resource_context.secure_lock); return rc; }
int res_trk_open_secure_session() { int rc; mutex_lock(&resource_context.secure_lock); if (resource_context.secure_session) { pr_err("Secure session already open"); rc = -EBUSY; goto error_open; } resource_context.secure_session = 1; rc = res_trk_enable_iommu_clocks(); if (rc) { pr_err("IOMMU clock enabled failed while open"); goto error_open; } msm_ion_secure_heap(ION_HEAP(resource_context.memtype)); msm_ion_secure_heap(ION_HEAP(resource_context.cmd_mem_type)); res_trk_disable_iommu_clocks(); mutex_unlock(&resource_context.secure_lock); return 0; error_open: mutex_unlock(&resource_context.secure_lock); return rc; }