From: Eero Nurkkala <eero.nurkkala@xxxxxxxxxx> There appears to be either audio or voice service, where all voice goes to (comes from) modem. Thus, drop the client[APR_DEST_MAX] array altogether. Signed-off-by: Eero Nurkkala <eero.nurkkala@xxxxxxxxxx> --- arch/arm/mach-msm/qdsp6v2/apr.c | 70 ++++++++++++++++++--------------------- 1 files changed, 32 insertions(+), 38 deletions(-) diff --git a/arch/arm/mach-msm/qdsp6v2/apr.c b/arch/arm/mach-msm/qdsp6v2/apr.c index cd2d27c..72a577d 100644 --- a/arch/arm/mach-msm/qdsp6v2/apr.c +++ b/arch/arm/mach-msm/qdsp6v2/apr.c @@ -38,14 +38,13 @@ #include "dsp_debug.h" static struct apr_q6 q6; -static struct apr_client client[APR_DEST_MAX][APR_CLIENT_MAX]; +static struct apr_client client[APR_CLIENT_MAX]; int apr_send_pkt(void *handle, uint32_t *buf) { struct apr_svc *svc = handle; struct apr_client *clnt; struct apr_hdr *hdr; - uint16_t dest_id; uint16_t client_id; uint16_t w_len; unsigned long flags; @@ -56,11 +55,10 @@ int apr_send_pkt(void *handle, uint32_t *buf) } spin_lock_irqsave(&svc->w_lock, flags); - dest_id = svc->dest_id; client_id = svc->client_id; - clnt = &client[dest_id][client_id]; + clnt = &client[client_id]; - if (!client[dest_id][client_id].handle) { + if (!client[client_id].handle) { pr_err("APR: Still service is not yet opened\n"); spin_unlock_irqrestore(&svc->w_lock, flags); return -EINVAL; @@ -69,9 +67,9 @@ int apr_send_pkt(void *handle, uint32_t *buf) hdr->src_domain = APR_DOMAIN_APPS; hdr->src_svc = svc->id; - if (dest_id == APR_DEST_MODEM) + if (client_id == APR_CLIENT_VOICE) hdr->dest_domain = APR_DOMAIN_MODEM; - else if (dest_id == APR_DEST_QDSP6) + else if (client_id == APR_CLIENT_AUDIO) hdr->dest_domain = APR_DOMAIN_ADSP; hdr->dest_svc = svc->id; @@ -178,7 +176,7 @@ static void apr_cb_func(void *buf, int len, void *priv) } pr_debug("src =%d clnt = %d\n", src, clnt); - apr_client = &client[src][clnt]; + apr_client = &client[clnt]; for (i = 0; i < APR_SVC_MAX; i++) if (apr_client->svc[i].id == svc) { pr_debug("%d\n", apr_client->svc[i].id); @@ -252,21 +250,21 @@ struct apr_svc *apr_register(int dest_id, int svc_id, apr_fn svc_fn, q6.state = APR_Q6_LOADED; } mutex_unlock(&q6.lock); - mutex_lock(&client[dest_id][client_id].m_lock); - if (!client[dest_id][client_id].handle) { - client[dest_id][client_id].handle = apr_tal_open(client_id, + mutex_lock(&client[client_id].m_lock); + if (!client[client_id].handle) { + client[client_id].handle = apr_tal_open(client_id, dest_id, APR_DL_SMD, apr_cb_func, NULL); - if (!client[dest_id][client_id].handle) { + if (!client[client_id].handle) { svc = NULL; pr_err("APR: Unable to open handle\n"); - mutex_unlock(&client[dest_id][client_id].m_lock); + mutex_unlock(&client[client_id].m_lock); goto done; } } - mutex_unlock(&client[dest_id][client_id].m_lock); - svc = &client[dest_id][client_id].svc[svc_idx]; + mutex_unlock(&client[client_id].m_lock); + svc = &client[client_id].svc[svc_idx]; mutex_lock(&svc->m_lock); - client[dest_id][client_id].id = client_id; + client[client_id].id = client_id; svc->priv = priv; svc->id = svc_id; svc->dest_id = dest_id; @@ -275,14 +273,14 @@ struct apr_svc *apr_register(int dest_id, int svc_id, apr_fn svc_fn, temp_port = ((src_port >> 8) * 8) + (src_port & 0xFF); pr_info("port = %d t_port = %d\n", src_port, temp_port); if (!svc->port_cnt && !svc->svc_cnt) - client[dest_id][client_id].svc_cnt++; + client[client_id].svc_cnt++; svc->port_cnt++; svc->port_fn[temp_port] = svc_fn; svc->port_priv[temp_port] = priv; } else { if (!svc->fn) { if (!svc->port_cnt && !svc->svc_cnt) - client[dest_id][client_id].svc_cnt++; + client[client_id].svc_cnt++; svc->fn = svc_fn; if (svc->port_cnt) svc->svc_cnt++; @@ -298,16 +296,14 @@ int apr_deregister(void *handle) { struct apr_svc *svc = handle; struct apr_client *clnt; - uint16_t dest_id; uint16_t client_id; if (!handle) return -EINVAL; mutex_lock(&svc->m_lock); - dest_id = svc->dest_id; client_id = svc->client_id; - clnt = &client[dest_id][client_id]; + clnt = &client[client_id]; if (svc->port_cnt > 0 || svc->svc_cnt > 0) { if (svc->port_cnt) @@ -315,21 +311,20 @@ int apr_deregister(void *handle) else if (svc->svc_cnt) svc->svc_cnt--; if (!svc->port_cnt && !svc->svc_cnt) - client[dest_id][client_id].svc_cnt--; - } else if (client[dest_id][client_id].svc_cnt > 0) - client[dest_id][client_id].svc_cnt--; + client[client_id].svc_cnt--; + } else if (client[client_id].svc_cnt > 0) + client[client_id].svc_cnt--; if (!svc->port_cnt && !svc->svc_cnt) { svc->priv = NULL; svc->id = 0; svc->fn = NULL; - svc->dest_id = 0; svc->client_id = 0; } - if (client[dest_id][client_id].handle && - !client[dest_id][client_id].svc_cnt) { - apr_tal_close(client[dest_id][client_id].handle); - client[dest_id][client_id].handle = NULL; + if (client[client_id].handle && + !client[client_id].svc_cnt) { + apr_tal_close(client[client_id].handle); + client[client_id].handle = NULL; } mutex_unlock(&svc->m_lock); @@ -351,16 +346,15 @@ int adsp_state(int state) static int __init apr_init(void) { - int i, j, k; - - for (i = 0; i < APR_DEST_MAX; i++) - for (j = 0; j < APR_CLIENT_MAX; j++) { - mutex_init(&client[i][j].m_lock); - for (k = 0; k < APR_SVC_MAX; k++) { - mutex_init(&client[i][j].svc[k].m_lock); - spin_lock_init(&client[i][j].svc[k].w_lock); - } + int j, k; + + for (j = 0; j < APR_CLIENT_MAX; j++) { + mutex_init(&client[j].m_lock); + for (k = 0; k < APR_SVC_MAX; k++) { + mutex_init(&client[j].svc[k].m_lock); + spin_lock_init(&client[j].svc[k].w_lock); } + } mutex_init(&q6.lock); dsp_debug_register(adsp_state); return 0; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html