diag: Edit lock conditions for USB buffers

DIAG uses dedicated buffers for each peripheral processor, to
write their data to USB. Setting the right locking condition
before DIAG uses buffer, enables mutual exclusion.

Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
diff --git a/drivers/char/diag/diagfwd.c b/drivers/char/diag/diagfwd.c
index c27e845..f9664c4 100644
--- a/drivers/char/diag/diagfwd.c
+++ b/drivers/char/diag/diagfwd.c
@@ -60,6 +60,7 @@
 		driver->write_ptr_1->buf = driver->buf_in_1;		\
 		driver->write_ptr_1->length = (int)(enc.dest - \
 						(void *)(driver->buf_in_1)); \
+		driver->in_busy_1 = 1;					\
 		usb_diag_write(driver->legacy_ch, driver->write_ptr_1);	\
 		memset(driver->apps_rsp_buf, '\0', 500);		\
 	}								\
@@ -226,7 +227,7 @@
 	int *in_busy_wcnss_ptr = &(driver->in_busy_wcnss);
 	struct diag_request *write_ptr_wcnss = driver->write_ptr_wcnss;
 
-	if (driver->ch_wcnss && buf) {
+	if ((!driver->in_busy_wcnss) && driver->ch_wcnss && buf) {
 		int r = smd_read_avail(driver->ch_wcnss);
 		if (r > IN_BUF_SIZE) {
 			if (r < MAX_IN_BUF_SIZE) {