static int deregister_memory(void) { int result = 0; int i; pr_debug("%s\n", __func__); if (atomic64_read(&acdb_data.mem_len)) { mutex_lock(&acdb_data.acdb_mutex); /* unmap all cal data */ result = unmap_cal_tables(); if (result < 0) pr_err("%s: unmap_cal_tables failed, err = %d\n", __func__, result); atomic64_set(&acdb_data.mem_len, 0); for (i = 0; i < MAX_VOCPROC_TYPES; i++) { kfree(acdb_data.col_data[i]); acdb_data.col_data[i] = NULL; } msm_audio_ion_free(acdb_data.ion_client, acdb_data.ion_handle); acdb_data.ion_client = NULL; acdb_data.ion_handle = NULL; mutex_unlock(&acdb_data.acdb_mutex); } return result; }
static int deregister_memory(void) { int result = 0; int i; pr_debug("%s\n", __func__); if (acdb_data.mem_len == 0) goto done; pr_debug("Remove existing memory\n"); acdb_data.mem_len = 0; /* unmap all cal data */ result = unmap_cal_tables(); if (result < 0) pr_err("%s: unmap_cal_tables failed, err = %d\n", __func__, result); msm_audio_ion_free(acdb_data.ion_client, acdb_data.ion_handle); acdb_data.ion_client = NULL; acdb_data.ion_handle = NULL; for (i = 0; i < MAX_VOCPROC_TYPES; i++) { kfree(acdb_data.col_data[i]); acdb_data.col_data[i] = NULL; } kfree(acdb_data.hw_delay_tx.delay_info); kfree(acdb_data.hw_delay_rx.delay_info); done: return result; }
static int deregister_memory(void) { int result = 0; pr_debug("%s\n", __func__); if (acdb_data.mem_len == 0) goto done; pr_debug("Remove existing memory\n"); acdb_data.mem_len = 0; /* unmap all cal data */ result = unmap_cal_tables(); if (result < 0) pr_err("%s: unmap_cal_tables failed, err = %d\n", __func__, result); msm_audio_ion_free(acdb_data.ion_client, acdb_data.ion_handle); acdb_data.ion_client = NULL; acdb_data.ion_handle = NULL; deallocate_col_data(); deallocate_hw_delay_entries(); done: return result; }
static int deregister_memory(void) { int result = 0; pr_debug("%s\n", __func__); if (atomic64_read(&acdb_data.mem_len)) { mutex_lock(&acdb_data.acdb_mutex); result = unmap_cal_tables(); if (result < 0) pr_err("%s: unmap_cal_tables failed, err = %d\n", __func__, result); atomic_set(&acdb_data.vocstrm_total_cal_size, 0); atomic_set(&acdb_data.vocproc_total_cal_size, 0); atomic_set(&acdb_data.vocvol_total_cal_size, 0); atomic64_set(&acdb_data.mem_len, 0); ion_unmap_kernel(acdb_data.ion_client, acdb_data.ion_handle); ion_free(acdb_data.ion_client, acdb_data.ion_handle); ion_client_destroy(acdb_data.ion_client); mutex_unlock(&acdb_data.acdb_mutex); } return result; }