Loading drivers/char/diag/diag_mux.c +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ int diag_mux_register(int proc, int ctx, struct diag_mux_ops *ops) md_logger.ops[proc] = ops; err = diag_md_register(proc, ctx, ops); if (err) { pr_err("diag: MUX: unable to register usb operations for proc: %d, err: %d\n", pr_err("diag: MUX: unable to register md operations for proc: %d, err: %d\n", proc, err); return err; } Loading drivers/char/diag/diag_usb.c +0 −8 Original line number Diff line number Diff line Loading @@ -327,16 +327,12 @@ int diag_usb_write(int id, unsigned char *buf, int len, int ctxt) void diag_usb_connect_all(void) { int i = 0; unsigned long flags; struct diag_usb_info *usb_info = NULL; for (i = 0; i < NUM_DIAG_USB_DEV; i++) { usb_info = &diag_usb[i]; if (!usb_info->enabled) continue; spin_lock_irqsave(&usb_info->lock, flags); usb_info->connected = 1; spin_unlock_irqrestore(&usb_info->lock, flags); usb_connect(usb_info); } } Loading @@ -349,16 +345,12 @@ void diag_usb_connect_all(void) void diag_usb_disconnect_all(void) { int i = 0; unsigned long flags; struct diag_usb_info *usb_info = NULL; for (i = 0; i < NUM_DIAG_USB_DEV; i++) { usb_info = &diag_usb[i]; if (!usb_info->enabled) continue; spin_lock_irqsave(&usb_info->lock, flags); usb_info->connected = 0; spin_unlock_irqrestore(&usb_info->lock, flags); usb_disconnect(usb_info); } } Loading drivers/char/diag/diagchar_core.c +19 −1 Original line number Diff line number Diff line Loading @@ -873,6 +873,7 @@ static int diag_switch_logging(int requested_mode) int success = -EINVAL; int temp = 0, status = 0; int new_mode = DIAG_USB_MODE; /* set the mode from diag_mux.h */ int old_logging_id; switch (requested_mode) { case USB_MODE: Loading Loading @@ -911,6 +912,7 @@ static int diag_switch_logging(int requested_mode) mutex_lock(&driver->diagchar_mutex); temp = driver->logging_mode; driver->logging_mode = requested_mode; old_logging_id = driver->logging_process_id; if (driver->logging_mode == MEMORY_DEVICE_MODE) { driver->mask_check = 1; Loading Loading @@ -946,8 +948,24 @@ static int diag_switch_logging(int requested_mode) } driver->logging_process_id = current->tgid; mutex_unlock(&driver->diagchar_mutex); status = diag_mux_switch_logging(new_mode); if (status) { if (requested_mode == MEMORY_DEVICE_MODE) driver->mask_check = 0; else if (requested_mode == SOCKET_MODE) driver->socket_process = NULL; else if (requested_mode == CALLBACK_MODE) driver->callback_process = NULL; driver->logging_process_id = old_logging_id; driver->logging_mode = temp; pr_err("diag: Error switching logging mode, current logging mode: %d\n", driver->logging_mode); mutex_unlock(&driver->diagchar_mutex); success = status ? success : 1; return success; } mutex_unlock(&driver->diagchar_mutex); success = status ? success : 1; return success; } Loading drivers/char/diag/diagfwd.c +26 −12 Original line number Diff line number Diff line Loading @@ -1425,7 +1425,17 @@ static int diagfwd_mux_open(int id, int mode) return -EINVAL; } if ((mode == DIAG_USB_MODE && driver->logging_mode == MEMORY_DEVICE_MODE) || (mode == DIAG_MEMORY_DEVICE_MODE && driver->logging_mode == USB_MODE)) { /* In this case Diag shouldn't not reset the smd in_busy data. * If the reset of smd in_busy values happens then this will * lead to loss of data read over peripherals. */ } else { diag_reset_smd_data(RESET_AND_QUEUE); } for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++) { /* Poll SMD CNTL channels to check for data */ diag_smd_notify(&(driver->smd_cntl[i]), SMD_EVENT_DATA); Loading @@ -1450,6 +1460,7 @@ static int diagfwd_mux_close(int id, int mode) return -EINVAL; } if (driver->logging_mode == USB_MODE) { for (i = 0; i < NUM_SMD_DATA_CHANNELS; i++) { smd_info = &driver->smd_data[i]; spin_lock_irqsave(&smd_info->in_busy_lock, flags); Loading @@ -1461,10 +1472,13 @@ static int diagfwd_mux_close(int id, int mode) if (driver->supports_separate_cmdrsp) { for (i = 0; i < NUM_SMD_CMD_CHANNELS; i++) { smd_info = &driver->smd_cmd[i]; spin_lock_irqsave(&smd_info->in_busy_lock, flags); spin_lock_irqsave(&smd_info->in_busy_lock, flags); smd_info->in_busy_1 = 1; smd_info->in_busy_2 = 1; spin_unlock_irqrestore(&smd_info->in_busy_lock, flags); spin_unlock_irqrestore(&smd_info->in_busy_lock, flags); } } } queue_work(driver->diag_real_time_wq, Loading Loading
drivers/char/diag/diag_mux.c +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ int diag_mux_register(int proc, int ctx, struct diag_mux_ops *ops) md_logger.ops[proc] = ops; err = diag_md_register(proc, ctx, ops); if (err) { pr_err("diag: MUX: unable to register usb operations for proc: %d, err: %d\n", pr_err("diag: MUX: unable to register md operations for proc: %d, err: %d\n", proc, err); return err; } Loading
drivers/char/diag/diag_usb.c +0 −8 Original line number Diff line number Diff line Loading @@ -327,16 +327,12 @@ int diag_usb_write(int id, unsigned char *buf, int len, int ctxt) void diag_usb_connect_all(void) { int i = 0; unsigned long flags; struct diag_usb_info *usb_info = NULL; for (i = 0; i < NUM_DIAG_USB_DEV; i++) { usb_info = &diag_usb[i]; if (!usb_info->enabled) continue; spin_lock_irqsave(&usb_info->lock, flags); usb_info->connected = 1; spin_unlock_irqrestore(&usb_info->lock, flags); usb_connect(usb_info); } } Loading @@ -349,16 +345,12 @@ void diag_usb_connect_all(void) void diag_usb_disconnect_all(void) { int i = 0; unsigned long flags; struct diag_usb_info *usb_info = NULL; for (i = 0; i < NUM_DIAG_USB_DEV; i++) { usb_info = &diag_usb[i]; if (!usb_info->enabled) continue; spin_lock_irqsave(&usb_info->lock, flags); usb_info->connected = 0; spin_unlock_irqrestore(&usb_info->lock, flags); usb_disconnect(usb_info); } } Loading
drivers/char/diag/diagchar_core.c +19 −1 Original line number Diff line number Diff line Loading @@ -873,6 +873,7 @@ static int diag_switch_logging(int requested_mode) int success = -EINVAL; int temp = 0, status = 0; int new_mode = DIAG_USB_MODE; /* set the mode from diag_mux.h */ int old_logging_id; switch (requested_mode) { case USB_MODE: Loading Loading @@ -911,6 +912,7 @@ static int diag_switch_logging(int requested_mode) mutex_lock(&driver->diagchar_mutex); temp = driver->logging_mode; driver->logging_mode = requested_mode; old_logging_id = driver->logging_process_id; if (driver->logging_mode == MEMORY_DEVICE_MODE) { driver->mask_check = 1; Loading Loading @@ -946,8 +948,24 @@ static int diag_switch_logging(int requested_mode) } driver->logging_process_id = current->tgid; mutex_unlock(&driver->diagchar_mutex); status = diag_mux_switch_logging(new_mode); if (status) { if (requested_mode == MEMORY_DEVICE_MODE) driver->mask_check = 0; else if (requested_mode == SOCKET_MODE) driver->socket_process = NULL; else if (requested_mode == CALLBACK_MODE) driver->callback_process = NULL; driver->logging_process_id = old_logging_id; driver->logging_mode = temp; pr_err("diag: Error switching logging mode, current logging mode: %d\n", driver->logging_mode); mutex_unlock(&driver->diagchar_mutex); success = status ? success : 1; return success; } mutex_unlock(&driver->diagchar_mutex); success = status ? success : 1; return success; } Loading
drivers/char/diag/diagfwd.c +26 −12 Original line number Diff line number Diff line Loading @@ -1425,7 +1425,17 @@ static int diagfwd_mux_open(int id, int mode) return -EINVAL; } if ((mode == DIAG_USB_MODE && driver->logging_mode == MEMORY_DEVICE_MODE) || (mode == DIAG_MEMORY_DEVICE_MODE && driver->logging_mode == USB_MODE)) { /* In this case Diag shouldn't not reset the smd in_busy data. * If the reset of smd in_busy values happens then this will * lead to loss of data read over peripherals. */ } else { diag_reset_smd_data(RESET_AND_QUEUE); } for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++) { /* Poll SMD CNTL channels to check for data */ diag_smd_notify(&(driver->smd_cntl[i]), SMD_EVENT_DATA); Loading @@ -1450,6 +1460,7 @@ static int diagfwd_mux_close(int id, int mode) return -EINVAL; } if (driver->logging_mode == USB_MODE) { for (i = 0; i < NUM_SMD_DATA_CHANNELS; i++) { smd_info = &driver->smd_data[i]; spin_lock_irqsave(&smd_info->in_busy_lock, flags); Loading @@ -1461,10 +1472,13 @@ static int diagfwd_mux_close(int id, int mode) if (driver->supports_separate_cmdrsp) { for (i = 0; i < NUM_SMD_CMD_CHANNELS; i++) { smd_info = &driver->smd_cmd[i]; spin_lock_irqsave(&smd_info->in_busy_lock, flags); spin_lock_irqsave(&smd_info->in_busy_lock, flags); smd_info->in_busy_1 = 1; smd_info->in_busy_2 = 1; spin_unlock_irqrestore(&smd_info->in_busy_lock, flags); spin_unlock_irqrestore(&smd_info->in_busy_lock, flags); } } } queue_work(driver->diag_real_time_wq, Loading