msm: qdsp5: Avoid race condition of init info cmd being sent multiple times

GET_INIT_INFO command is sent to modem adsp service to get the information
such as task/queues supported by adsp. This command is sent whenever
msm_adsp_get() is called first time by any decoder/encoder drivers. This
command needs to be sent only once, to achieve this a global flag
init_info_cmd_sent is set in msm_get_adsp() after sending GET_INIT_INFO
command to adsp services. Currently flag init_info_cmd_sent is not
protected by any lock. Hence there is chance of GET_INIT_INFO command
being sent multiple times if there are concurrent calls to msm_adsp_get()
where each caller observes flag init_info_cmd_sent not to be set.

Fix this by protecting adsp info initialization sequence with mutex.

Change-Id: Ib0bd865d44e4687f9a85b56854e1fd3277a5707d
Signed-off-by: Manish Dewangan <manish@codeaurora.org>
diff --git a/arch/arm/mach-msm/qdsp5/adsp.h b/arch/arm/mach-msm/qdsp5/adsp.h
index 0ef27b9..8e5a4f3 100644
--- a/arch/arm/mach-msm/qdsp5/adsp.h
+++ b/arch/arm/mach-msm/qdsp5/adsp.h
@@ -1,7 +1,7 @@
 /* arch/arm/mach-msm/qdsp5/adsp.h
  *
  * Copyright (C) 2008 Google, Inc.
- * Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2008-2010, 2012 Code Aurora Forum. All rights reserved.
  * Author: Iliyan Malchev <ibm@android.com>
  *
  * This software is licensed under the terms of the GNU General Public
@@ -117,6 +117,7 @@
 	struct adsp_rtos_mp_mtoa_init_info_type	*init_info_ptr;
 	wait_queue_head_t	init_info_wait;
 	unsigned 		init_info_state;
+	struct mutex lock;
 };
 
 #define RPC_ADSP_RTOS_ATOM_NULL_PROC 0