Loading drivers/char/diag/diag_dci.c +65 −19 Original line number Original line Diff line number Diff line Loading @@ -2137,13 +2137,17 @@ struct diag_dci_client_tbl *dci_lookup_client_entry_pid(int tgid) void update_dci_cumulative_event_mask(int offset, uint8_t byte_mask, int token) void update_dci_cumulative_event_mask(int offset, uint8_t byte_mask, int token) { { uint8_t *event_mask_ptr; uint8_t *event_mask_ptr, *update_ptr = NULL; uint8_t *update_ptr = dci_ops_tbl[token].event_mask_composite; struct list_head *start, *temp; struct list_head *start, *temp; struct diag_dci_client_tbl *entry = NULL; struct diag_dci_client_tbl *entry = NULL; bool is_set = false; bool is_set = false; mutex_lock(&dci_event_mask_mutex); mutex_lock(&dci_event_mask_mutex); update_ptr = dci_ops_tbl[token].event_mask_composite; if (!update_ptr) { mutex_unlock(&dci_event_mask_mutex); return; } update_ptr += offset; update_ptr += offset; list_for_each_safe(start, temp, &driver->dci_client_list) { list_for_each_safe(start, temp, &driver->dci_client_list) { entry = list_entry(start, struct diag_dci_client_tbl, track); entry = list_entry(start, struct diag_dci_client_tbl, track); Loading @@ -2169,13 +2173,15 @@ void diag_dci_invalidate_cumulative_event_mask(int token) int i = 0; int i = 0; struct list_head *start, *temp; struct list_head *start, *temp; struct diag_dci_client_tbl *entry = NULL; struct diag_dci_client_tbl *entry = NULL; uint8_t *update_ptr, *event_mask_ptr; uint8_t *event_mask_ptr, *update_ptr = NULL; update_ptr = dci_ops_tbl[token].event_mask_composite; if (!update_ptr) mutex_lock(&dci_event_mask_mutex); update_ptr = dci_ops_tbl[token].event_mask_composite; if (!update_ptr) { mutex_unlock(&dci_event_mask_mutex); return; return; } mutex_lock(&dci_event_mask_mutex); create_dci_event_mask_tbl(update_ptr); create_dci_event_mask_tbl(update_ptr); list_for_each_safe(start, temp, &driver->dci_client_list) { list_for_each_safe(start, temp, &driver->dci_client_list) { entry = list_entry(start, struct diag_dci_client_tbl, track); entry = list_entry(start, struct diag_dci_client_tbl, track); Loading @@ -2197,14 +2203,20 @@ int diag_send_dci_event_mask_remote(int token) int dci_header_size = sizeof(struct diag_dci_header_t); int dci_header_size = sizeof(struct diag_dci_header_t); int event_header_size = sizeof(struct diag_ctrl_event_mask); int event_header_size = sizeof(struct diag_ctrl_event_mask); int i, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int i, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; unsigned char *event_mask_ptr = dci_ops_tbl[token]. unsigned char *event_mask_ptr = NULL; event_mask_composite; uint32_t write_len = 0; uint32_t write_len = 0; mutex_lock(&dci_event_mask_mutex); event_mask_ptr = dci_ops_tbl[token].event_mask_composite; if (!event_mask_ptr) { mutex_unlock(&dci_event_mask_mutex); return -EINVAL; } buf = dci_get_buffer_from_bridge(token); buf = dci_get_buffer_from_bridge(token); if (!buf) { if (!buf) { pr_err("diag: In %s, unable to get dci buffers to write data\n", pr_err("diag: In %s, unable to get dci buffers to write data\n", __func__); __func__); mutex_unlock(&dci_event_mask_mutex); return -EAGAIN; return -EAGAIN; } } Loading Loading @@ -2243,7 +2255,7 @@ int diag_send_dci_event_mask_remote(int token) } else { } else { ret = DIAG_DCI_NO_ERROR; ret = DIAG_DCI_NO_ERROR; } } mutex_unlock(&dci_event_mask_mutex); return ret; return ret; } } #endif #endif Loading @@ -2254,8 +2266,14 @@ int diag_send_dci_event_mask(int token) struct diag_ctrl_event_mask header; struct diag_ctrl_event_mask header; int header_size = sizeof(struct diag_ctrl_event_mask); int header_size = sizeof(struct diag_ctrl_event_mask); int ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR, i; int ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR, i; unsigned char *event_mask_ptr = dci_ops_tbl[DCI_LOCAL_PROC]. unsigned char *event_mask_ptr = NULL; event_mask_composite; mutex_lock(&dci_event_mask_mutex); event_mask_ptr = dci_ops_tbl[DCI_LOCAL_PROC].event_mask_composite; if (!event_mask_ptr) { mutex_unlock(&dci_event_mask_mutex); return -EINVAL; } mutex_lock(&event_mask.lock); mutex_lock(&event_mask.lock); /* send event mask update */ /* send event mask update */ Loading Loading @@ -2284,7 +2302,9 @@ int diag_send_dci_event_mask(int token) if (err != DIAG_DCI_NO_ERROR) if (err != DIAG_DCI_NO_ERROR) ret = DIAG_DCI_SEND_DATA_FAIL; ret = DIAG_DCI_SEND_DATA_FAIL; } } mutex_unlock(&event_mask.lock); mutex_unlock(&event_mask.lock); mutex_unlock(&dci_event_mask_mutex); return ret; return ret; } } Loading @@ -2292,13 +2312,18 @@ int diag_send_dci_event_mask(int token) void update_dci_cumulative_log_mask(int offset, unsigned int byte_index, void update_dci_cumulative_log_mask(int offset, unsigned int byte_index, uint8_t byte_mask, int token) uint8_t byte_mask, int token) { { uint8_t *update_ptr = dci_ops_tbl[token].log_mask_composite; uint8_t *log_mask_ptr, *update_ptr = NULL; uint8_t *log_mask_ptr; bool is_set = false; bool is_set = false; struct list_head *start, *temp; struct list_head *start, *temp; struct diag_dci_client_tbl *entry = NULL; struct diag_dci_client_tbl *entry = NULL; mutex_lock(&dci_log_mask_mutex); mutex_lock(&dci_log_mask_mutex); update_ptr = dci_ops_tbl[token].log_mask_composite; if (!update_ptr) { mutex_unlock(&dci_log_mask_mutex); return; } update_ptr += offset; update_ptr += offset; /* update the dirty bit */ /* update the dirty bit */ *(update_ptr+1) = 1; *(update_ptr+1) = 1; Loading Loading @@ -2328,11 +2353,16 @@ void diag_dci_invalidate_cumulative_log_mask(int token) int i = 0; int i = 0; struct list_head *start, *temp; struct list_head *start, *temp; struct diag_dci_client_tbl *entry = NULL; struct diag_dci_client_tbl *entry = NULL; uint8_t *update_ptr, *log_mask_ptr; uint8_t *log_mask_ptr, *update_ptr = NULL; update_ptr = dci_ops_tbl[token].log_mask_composite; /* Clear the composite mask and redo all the masks */ /* Clear the composite mask and redo all the masks */ mutex_lock(&dci_log_mask_mutex); mutex_lock(&dci_log_mask_mutex); update_ptr = dci_ops_tbl[token].log_mask_composite; if (!update_ptr) { mutex_unlock(&dci_log_mask_mutex); return; } create_dci_log_mask_tbl(update_ptr, DCI_LOG_MASK_DIRTY); create_dci_log_mask_tbl(update_ptr, DCI_LOG_MASK_DIRTY); list_for_each_safe(start, temp, &driver->dci_client_list) { list_for_each_safe(start, temp, &driver->dci_client_list) { entry = list_entry(start, struct diag_dci_client_tbl, track); entry = list_entry(start, struct diag_dci_client_tbl, track); Loading Loading @@ -2371,11 +2401,18 @@ int diag_send_dci_log_mask_remote(int token) struct diag_dci_header_t dci_header; struct diag_dci_header_t dci_header; int dci_header_size = sizeof(struct diag_dci_header_t); int dci_header_size = sizeof(struct diag_dci_header_t); int log_header_size = sizeof(struct diag_ctrl_log_mask); int log_header_size = sizeof(struct diag_ctrl_log_mask); uint8_t *log_mask_ptr = dci_ops_tbl[token].log_mask_composite; uint8_t *log_mask_ptr = NULL; int i, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int i, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int updated; int updated; uint32_t write_len = 0; uint32_t write_len = 0; mutex_lock(&dci_log_mask_mutex); log_mask_ptr = dci_ops_tbl[token].log_mask_composite; if (!log_mask_ptr) { mutex_unlock(&dci_log_mask_mutex); return -EINVAL; } /* DCI header is common to all equipment IDs */ /* DCI header is common to all equipment IDs */ dci_header.start = CONTROL_CHAR; dci_header.start = CONTROL_CHAR; dci_header.version = 1; dci_header.version = 1; Loading @@ -2394,6 +2431,7 @@ int diag_send_dci_log_mask_remote(int token) if (!buf) { if (!buf) { pr_err("diag: In %s, unable to get dci buffers to write data\n", pr_err("diag: In %s, unable to get dci buffers to write data\n", __func__); __func__); mutex_unlock(&dci_log_mask_mutex); return -EAGAIN; return -EAGAIN; } } Loading @@ -2413,7 +2451,7 @@ int diag_send_dci_log_mask_remote(int token) *(log_mask_ptr + 1) = 0; /* clear dirty byte */ *(log_mask_ptr + 1) = 0; /* clear dirty byte */ log_mask_ptr += 514; log_mask_ptr += 514; } } mutex_unlock(&dci_log_mask_mutex); return ret; return ret; } } #endif #endif Loading @@ -2422,10 +2460,18 @@ int diag_send_dci_log_mask(int token) { { void *buf = log_mask.update_buf; void *buf = log_mask.update_buf; int write_len = 0; int write_len = 0; uint8_t *log_mask_ptr = dci_ops_tbl[DCI_LOCAL_PROC].log_mask_composite; uint8_t *log_mask_ptr = NULL; int i, j, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int i, j, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int updated; int updated; mutex_lock(&dci_log_mask_mutex); log_mask_ptr = dci_ops_tbl[DCI_LOCAL_PROC].log_mask_composite; if (!log_mask_ptr) { mutex_unlock(&dci_log_mask_mutex); return -EINVAL; } mutex_lock(&log_mask.lock); mutex_lock(&log_mask.lock); for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) { updated = 1; updated = 1; Loading @@ -2448,7 +2494,7 @@ int diag_send_dci_log_mask(int token) log_mask_ptr += 514; log_mask_ptr += 514; } } mutex_unlock(&log_mask.lock); mutex_unlock(&log_mask.lock); mutex_unlock(&dci_log_mask_mutex); return ret; return ret; } } Loading Loading
drivers/char/diag/diag_dci.c +65 −19 Original line number Original line Diff line number Diff line Loading @@ -2137,13 +2137,17 @@ struct diag_dci_client_tbl *dci_lookup_client_entry_pid(int tgid) void update_dci_cumulative_event_mask(int offset, uint8_t byte_mask, int token) void update_dci_cumulative_event_mask(int offset, uint8_t byte_mask, int token) { { uint8_t *event_mask_ptr; uint8_t *event_mask_ptr, *update_ptr = NULL; uint8_t *update_ptr = dci_ops_tbl[token].event_mask_composite; struct list_head *start, *temp; struct list_head *start, *temp; struct diag_dci_client_tbl *entry = NULL; struct diag_dci_client_tbl *entry = NULL; bool is_set = false; bool is_set = false; mutex_lock(&dci_event_mask_mutex); mutex_lock(&dci_event_mask_mutex); update_ptr = dci_ops_tbl[token].event_mask_composite; if (!update_ptr) { mutex_unlock(&dci_event_mask_mutex); return; } update_ptr += offset; update_ptr += offset; list_for_each_safe(start, temp, &driver->dci_client_list) { list_for_each_safe(start, temp, &driver->dci_client_list) { entry = list_entry(start, struct diag_dci_client_tbl, track); entry = list_entry(start, struct diag_dci_client_tbl, track); Loading @@ -2169,13 +2173,15 @@ void diag_dci_invalidate_cumulative_event_mask(int token) int i = 0; int i = 0; struct list_head *start, *temp; struct list_head *start, *temp; struct diag_dci_client_tbl *entry = NULL; struct diag_dci_client_tbl *entry = NULL; uint8_t *update_ptr, *event_mask_ptr; uint8_t *event_mask_ptr, *update_ptr = NULL; update_ptr = dci_ops_tbl[token].event_mask_composite; if (!update_ptr) mutex_lock(&dci_event_mask_mutex); update_ptr = dci_ops_tbl[token].event_mask_composite; if (!update_ptr) { mutex_unlock(&dci_event_mask_mutex); return; return; } mutex_lock(&dci_event_mask_mutex); create_dci_event_mask_tbl(update_ptr); create_dci_event_mask_tbl(update_ptr); list_for_each_safe(start, temp, &driver->dci_client_list) { list_for_each_safe(start, temp, &driver->dci_client_list) { entry = list_entry(start, struct diag_dci_client_tbl, track); entry = list_entry(start, struct diag_dci_client_tbl, track); Loading @@ -2197,14 +2203,20 @@ int diag_send_dci_event_mask_remote(int token) int dci_header_size = sizeof(struct diag_dci_header_t); int dci_header_size = sizeof(struct diag_dci_header_t); int event_header_size = sizeof(struct diag_ctrl_event_mask); int event_header_size = sizeof(struct diag_ctrl_event_mask); int i, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int i, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; unsigned char *event_mask_ptr = dci_ops_tbl[token]. unsigned char *event_mask_ptr = NULL; event_mask_composite; uint32_t write_len = 0; uint32_t write_len = 0; mutex_lock(&dci_event_mask_mutex); event_mask_ptr = dci_ops_tbl[token].event_mask_composite; if (!event_mask_ptr) { mutex_unlock(&dci_event_mask_mutex); return -EINVAL; } buf = dci_get_buffer_from_bridge(token); buf = dci_get_buffer_from_bridge(token); if (!buf) { if (!buf) { pr_err("diag: In %s, unable to get dci buffers to write data\n", pr_err("diag: In %s, unable to get dci buffers to write data\n", __func__); __func__); mutex_unlock(&dci_event_mask_mutex); return -EAGAIN; return -EAGAIN; } } Loading Loading @@ -2243,7 +2255,7 @@ int diag_send_dci_event_mask_remote(int token) } else { } else { ret = DIAG_DCI_NO_ERROR; ret = DIAG_DCI_NO_ERROR; } } mutex_unlock(&dci_event_mask_mutex); return ret; return ret; } } #endif #endif Loading @@ -2254,8 +2266,14 @@ int diag_send_dci_event_mask(int token) struct diag_ctrl_event_mask header; struct diag_ctrl_event_mask header; int header_size = sizeof(struct diag_ctrl_event_mask); int header_size = sizeof(struct diag_ctrl_event_mask); int ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR, i; int ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR, i; unsigned char *event_mask_ptr = dci_ops_tbl[DCI_LOCAL_PROC]. unsigned char *event_mask_ptr = NULL; event_mask_composite; mutex_lock(&dci_event_mask_mutex); event_mask_ptr = dci_ops_tbl[DCI_LOCAL_PROC].event_mask_composite; if (!event_mask_ptr) { mutex_unlock(&dci_event_mask_mutex); return -EINVAL; } mutex_lock(&event_mask.lock); mutex_lock(&event_mask.lock); /* send event mask update */ /* send event mask update */ Loading Loading @@ -2284,7 +2302,9 @@ int diag_send_dci_event_mask(int token) if (err != DIAG_DCI_NO_ERROR) if (err != DIAG_DCI_NO_ERROR) ret = DIAG_DCI_SEND_DATA_FAIL; ret = DIAG_DCI_SEND_DATA_FAIL; } } mutex_unlock(&event_mask.lock); mutex_unlock(&event_mask.lock); mutex_unlock(&dci_event_mask_mutex); return ret; return ret; } } Loading @@ -2292,13 +2312,18 @@ int diag_send_dci_event_mask(int token) void update_dci_cumulative_log_mask(int offset, unsigned int byte_index, void update_dci_cumulative_log_mask(int offset, unsigned int byte_index, uint8_t byte_mask, int token) uint8_t byte_mask, int token) { { uint8_t *update_ptr = dci_ops_tbl[token].log_mask_composite; uint8_t *log_mask_ptr, *update_ptr = NULL; uint8_t *log_mask_ptr; bool is_set = false; bool is_set = false; struct list_head *start, *temp; struct list_head *start, *temp; struct diag_dci_client_tbl *entry = NULL; struct diag_dci_client_tbl *entry = NULL; mutex_lock(&dci_log_mask_mutex); mutex_lock(&dci_log_mask_mutex); update_ptr = dci_ops_tbl[token].log_mask_composite; if (!update_ptr) { mutex_unlock(&dci_log_mask_mutex); return; } update_ptr += offset; update_ptr += offset; /* update the dirty bit */ /* update the dirty bit */ *(update_ptr+1) = 1; *(update_ptr+1) = 1; Loading Loading @@ -2328,11 +2353,16 @@ void diag_dci_invalidate_cumulative_log_mask(int token) int i = 0; int i = 0; struct list_head *start, *temp; struct list_head *start, *temp; struct diag_dci_client_tbl *entry = NULL; struct diag_dci_client_tbl *entry = NULL; uint8_t *update_ptr, *log_mask_ptr; uint8_t *log_mask_ptr, *update_ptr = NULL; update_ptr = dci_ops_tbl[token].log_mask_composite; /* Clear the composite mask and redo all the masks */ /* Clear the composite mask and redo all the masks */ mutex_lock(&dci_log_mask_mutex); mutex_lock(&dci_log_mask_mutex); update_ptr = dci_ops_tbl[token].log_mask_composite; if (!update_ptr) { mutex_unlock(&dci_log_mask_mutex); return; } create_dci_log_mask_tbl(update_ptr, DCI_LOG_MASK_DIRTY); create_dci_log_mask_tbl(update_ptr, DCI_LOG_MASK_DIRTY); list_for_each_safe(start, temp, &driver->dci_client_list) { list_for_each_safe(start, temp, &driver->dci_client_list) { entry = list_entry(start, struct diag_dci_client_tbl, track); entry = list_entry(start, struct diag_dci_client_tbl, track); Loading Loading @@ -2371,11 +2401,18 @@ int diag_send_dci_log_mask_remote(int token) struct diag_dci_header_t dci_header; struct diag_dci_header_t dci_header; int dci_header_size = sizeof(struct diag_dci_header_t); int dci_header_size = sizeof(struct diag_dci_header_t); int log_header_size = sizeof(struct diag_ctrl_log_mask); int log_header_size = sizeof(struct diag_ctrl_log_mask); uint8_t *log_mask_ptr = dci_ops_tbl[token].log_mask_composite; uint8_t *log_mask_ptr = NULL; int i, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int i, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int updated; int updated; uint32_t write_len = 0; uint32_t write_len = 0; mutex_lock(&dci_log_mask_mutex); log_mask_ptr = dci_ops_tbl[token].log_mask_composite; if (!log_mask_ptr) { mutex_unlock(&dci_log_mask_mutex); return -EINVAL; } /* DCI header is common to all equipment IDs */ /* DCI header is common to all equipment IDs */ dci_header.start = CONTROL_CHAR; dci_header.start = CONTROL_CHAR; dci_header.version = 1; dci_header.version = 1; Loading @@ -2394,6 +2431,7 @@ int diag_send_dci_log_mask_remote(int token) if (!buf) { if (!buf) { pr_err("diag: In %s, unable to get dci buffers to write data\n", pr_err("diag: In %s, unable to get dci buffers to write data\n", __func__); __func__); mutex_unlock(&dci_log_mask_mutex); return -EAGAIN; return -EAGAIN; } } Loading @@ -2413,7 +2451,7 @@ int diag_send_dci_log_mask_remote(int token) *(log_mask_ptr + 1) = 0; /* clear dirty byte */ *(log_mask_ptr + 1) = 0; /* clear dirty byte */ log_mask_ptr += 514; log_mask_ptr += 514; } } mutex_unlock(&dci_log_mask_mutex); return ret; return ret; } } #endif #endif Loading @@ -2422,10 +2460,18 @@ int diag_send_dci_log_mask(int token) { { void *buf = log_mask.update_buf; void *buf = log_mask.update_buf; int write_len = 0; int write_len = 0; uint8_t *log_mask_ptr = dci_ops_tbl[DCI_LOCAL_PROC].log_mask_composite; uint8_t *log_mask_ptr = NULL; int i, j, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int i, j, ret = DIAG_DCI_NO_ERROR, err = DIAG_DCI_NO_ERROR; int updated; int updated; mutex_lock(&dci_log_mask_mutex); log_mask_ptr = dci_ops_tbl[DCI_LOCAL_PROC].log_mask_composite; if (!log_mask_ptr) { mutex_unlock(&dci_log_mask_mutex); return -EINVAL; } mutex_lock(&log_mask.lock); mutex_lock(&log_mask.lock); for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) { updated = 1; updated = 1; Loading @@ -2448,7 +2494,7 @@ int diag_send_dci_log_mask(int token) log_mask_ptr += 514; log_mask_ptr += 514; } } mutex_unlock(&log_mask.lock); mutex_unlock(&log_mask.lock); mutex_unlock(&dci_log_mask_mutex); return ret; return ret; } } Loading