diag: Protect shared resources while mask updates
DIAG sends mask updates to peripherals over SMD control channels.
It uses several buffers, variables and SMD channel for this update
process. These shared resources risk corruption from several work
queue functions. Putting them under a mutex will ensure they do
not get overwritten.
Change-Id: I1d0a82b60dd8384d4b44ace29b25d60afe2ac5ad
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
diff --git a/drivers/char/diag/diagchar.h b/drivers/char/diag/diagchar.h
index 656223b..49d687d 100644
--- a/drivers/char/diag/diagchar.h
+++ b/drivers/char/diag/diagchar.h
@@ -162,6 +162,7 @@
int count_write_struct_pool;
int used;
/* Buffers for masks */
+ struct mutex diag_cntl_mutex;
struct diag_ctrl_event_mask *event_mask;
struct diag_ctrl_log_mask *log_mask;
struct diag_ctrl_msg_mask *msg_mask;