Loading drivers/char/diag/diag_dci.c +1 −1 Original line number Diff line number Diff line Loading @@ -865,7 +865,7 @@ void extract_dci_pkt_rsp(unsigned char *buf, int len, int data_source, pkt_rsp_header.length = rsp_len + sizeof(int); pkt_rsp_header.delete_flag = delete_flag; pkt_rsp_header.uid = save_req_uid; memcpy(rsp_buf->data, &pkt_rsp_header, memcpy(rsp_buf->data + rsp_buf->data_len, &pkt_rsp_header, sizeof(struct diag_dci_pkt_rsp_header_t)); rsp_buf->data_len += sizeof(struct diag_dci_pkt_rsp_header_t); memcpy(rsp_buf->data + rsp_buf->data_len, temp, rsp_len); Loading drivers/char/diag/diagchar_core.c +14 −11 Original line number Diff line number Diff line Loading @@ -679,23 +679,15 @@ drop: /* Copy the total data length */ COPY_USER_SPACE_OR_EXIT(buf+8, total_data_len, 4); ret -= 4; /* * Flush any read that is currently pending on DCI data and * command channnels. This will ensure that the next read is not * missed. */ flush_workqueue(driver->diag_dci_wq); diag_ws_on_copy_complete(DIAG_WS_DCI); } else { pr_debug("diag: In %s, Trying to copy ZERO bytes, total_data_len: %d\n", __func__, total_data_len); } entry->in_service = 0; mutex_unlock(&entry->write_buf_mutex); exit_stat = 0; exit: mutex_unlock(&entry->write_buf_mutex); *pret = ret; return exit_stat; Loading Loading @@ -1369,6 +1361,7 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, int index = -1, i = 0, ret = 0; int num_data = 0, data_type; int remote_token; int copy_dci_data = 0; int exit_stat; int copy_data = 0; int write_len = 0; Loading Loading @@ -1625,7 +1618,6 @@ drop: if (driver->data_ready[index] & DCI_DATA_TYPE) { /* Copy the type of data being passed */ data_type = driver->data_ready[index] & DCI_DATA_TYPE; driver->data_ready[index] ^= DCI_DATA_TYPE; list_for_each_safe(start, temp, &driver->dci_client_list) { entry = list_entry(start, struct diag_dci_client_tbl, track); Loading @@ -1637,7 +1629,9 @@ drop: sizeof(int)); COPY_USER_SPACE_OR_EXIT(buf + ret, entry->client_info.token, sizeof(int)); copy_dci_data = 1; exit_stat = diag_copy_dci(buf, count, entry, &ret); driver->data_ready[index] ^= DCI_DATA_TYPE; if (exit_stat == 1) goto exit; } Loading @@ -1661,6 +1655,7 @@ drop: goto exit; } exit: mutex_unlock(&driver->diagchar_mutex); if (copy_data) { /* * Flush any work that is currently pending on the data Loading @@ -1671,7 +1666,15 @@ exit: wake_up(&driver->smd_wait_q); diag_ws_on_copy_complete(DIAG_WS_MD); } mutex_unlock(&driver->diagchar_mutex); /* * Flush any read that is currently pending on DCI data and * command channnels. This will ensure that the next read is not * missed. */ if (copy_dci_data) { diag_ws_on_copy_complete(DIAG_WS_DCI); flush_workqueue(driver->diag_dci_wq); } return ret; } Loading Loading
drivers/char/diag/diag_dci.c +1 −1 Original line number Diff line number Diff line Loading @@ -865,7 +865,7 @@ void extract_dci_pkt_rsp(unsigned char *buf, int len, int data_source, pkt_rsp_header.length = rsp_len + sizeof(int); pkt_rsp_header.delete_flag = delete_flag; pkt_rsp_header.uid = save_req_uid; memcpy(rsp_buf->data, &pkt_rsp_header, memcpy(rsp_buf->data + rsp_buf->data_len, &pkt_rsp_header, sizeof(struct diag_dci_pkt_rsp_header_t)); rsp_buf->data_len += sizeof(struct diag_dci_pkt_rsp_header_t); memcpy(rsp_buf->data + rsp_buf->data_len, temp, rsp_len); Loading
drivers/char/diag/diagchar_core.c +14 −11 Original line number Diff line number Diff line Loading @@ -679,23 +679,15 @@ drop: /* Copy the total data length */ COPY_USER_SPACE_OR_EXIT(buf+8, total_data_len, 4); ret -= 4; /* * Flush any read that is currently pending on DCI data and * command channnels. This will ensure that the next read is not * missed. */ flush_workqueue(driver->diag_dci_wq); diag_ws_on_copy_complete(DIAG_WS_DCI); } else { pr_debug("diag: In %s, Trying to copy ZERO bytes, total_data_len: %d\n", __func__, total_data_len); } entry->in_service = 0; mutex_unlock(&entry->write_buf_mutex); exit_stat = 0; exit: mutex_unlock(&entry->write_buf_mutex); *pret = ret; return exit_stat; Loading Loading @@ -1369,6 +1361,7 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, int index = -1, i = 0, ret = 0; int num_data = 0, data_type; int remote_token; int copy_dci_data = 0; int exit_stat; int copy_data = 0; int write_len = 0; Loading Loading @@ -1625,7 +1618,6 @@ drop: if (driver->data_ready[index] & DCI_DATA_TYPE) { /* Copy the type of data being passed */ data_type = driver->data_ready[index] & DCI_DATA_TYPE; driver->data_ready[index] ^= DCI_DATA_TYPE; list_for_each_safe(start, temp, &driver->dci_client_list) { entry = list_entry(start, struct diag_dci_client_tbl, track); Loading @@ -1637,7 +1629,9 @@ drop: sizeof(int)); COPY_USER_SPACE_OR_EXIT(buf + ret, entry->client_info.token, sizeof(int)); copy_dci_data = 1; exit_stat = diag_copy_dci(buf, count, entry, &ret); driver->data_ready[index] ^= DCI_DATA_TYPE; if (exit_stat == 1) goto exit; } Loading @@ -1661,6 +1655,7 @@ drop: goto exit; } exit: mutex_unlock(&driver->diagchar_mutex); if (copy_data) { /* * Flush any work that is currently pending on the data Loading @@ -1671,7 +1666,15 @@ exit: wake_up(&driver->smd_wait_q); diag_ws_on_copy_complete(DIAG_WS_MD); } mutex_unlock(&driver->diagchar_mutex); /* * Flush any read that is currently pending on DCI data and * command channnels. This will ensure that the next read is not * missed. */ if (copy_dci_data) { diag_ws_on_copy_complete(DIAG_WS_DCI); flush_workqueue(driver->diag_dci_wq); } return ret; } Loading