Loading drivers/char/diag/diag_usb.c +3 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ #include <linux/init.h> #include <linux/module.h> #include <linux/device.h> #include <linux/kernel.h> #include <linux/err.h> #include <linux/sched.h> #include <linux/ratelimit.h> Loading Loading @@ -218,7 +219,8 @@ static void usb_disconnect(struct diag_usb_info *ch) if (!ch) return; if (!atomic_read(&ch->connected) && driver->usb_connected) if (!atomic_read(&ch->connected) && driver->usb_connected && diag_mask_param()) diag_clear_masks(NULL); if (ch && ch->ops && ch->ops->close) Loading drivers/char/diag/diagchar.h +1 −0 Original line number Diff line number Diff line Loading @@ -625,6 +625,7 @@ void diag_cmd_remove_reg(struct diag_cmd_reg_entry_t *entry, uint8_t proc); void diag_cmd_remove_reg_by_pid(int pid); void diag_cmd_remove_reg_by_proc(int proc); int diag_cmd_chk_polling(struct diag_cmd_reg_entry_t *entry); int diag_mask_param(void); void diag_clear_masks(struct diag_md_session_t *info); void diag_record_stats(int type, int flag); Loading drivers/char/diag/diagchar_core.c +14 −2 Original line number Diff line number Diff line Loading @@ -144,6 +144,14 @@ module_param(max_clients, uint, 0); static struct timer_list drain_timer; static int timer_in_progress; /* * Diag Mask clear variable * Used for clearing masks upon * USB disconnection and stopping ODL */ static int diag_mask_clear_param = 1; module_param(diag_mask_clear_param, int, 0644); struct diag_apps_data_t { void *buf; uint32_t len; Loading Loading @@ -386,7 +394,10 @@ static uint32_t diag_translate_kernel_to_user_mask(uint32_t peripheral_mask) return ret; } int diag_mask_param(void) { return diag_mask_clear_param; } void diag_clear_masks(struct diag_md_session_t *info) { int ret; Loading Loading @@ -419,6 +430,7 @@ static void diag_close_logging_process(const int pid) if (!session_info) return; if (diag_mask_clear_param) diag_clear_masks(session_info); mutex_lock(&driver->diag_maskclear_mutex); Loading drivers/char/diag/diagfwd.c +18 −4 Original line number Diff line number Diff line Loading @@ -1225,6 +1225,8 @@ static int diagfwd_mux_open(int id, int mode) static int diagfwd_mux_close(int id, int mode) { uint8_t i; switch (mode) { case DIAG_USB_MODE: driver->usb_connected = 0; Loading @@ -1245,10 +1247,22 @@ static int diagfwd_mux_close(int id, int mode) */ } else { /* * With clearing of masks on ODL exit and * USB disconnection, closing of the channel is * not needed.This enables read and drop of stale packets. * With sysfs parameter to clear masks set, * peripheral masks are cleared on ODL exit and * USB disconnection and buffers are not marked busy. * This enables read and drop of stale packets. * * With sysfs parameter to clear masks cleared, * masks are not cleared and buffers are to be marked * busy to ensure traffic generated by peripheral * are not read */ if (!(diag_mask_param())) { for (i = 0; i < NUM_PERIPHERALS; i++) { diagfwd_close(i, TYPE_DATA); diagfwd_close(i, TYPE_CMD); } } /* Re enable HDLC encoding */ pr_debug("diag: In %s, re-enabling HDLC encoding\n", __func__); Loading Loading
drivers/char/diag/diag_usb.c +3 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ #include <linux/init.h> #include <linux/module.h> #include <linux/device.h> #include <linux/kernel.h> #include <linux/err.h> #include <linux/sched.h> #include <linux/ratelimit.h> Loading Loading @@ -218,7 +219,8 @@ static void usb_disconnect(struct diag_usb_info *ch) if (!ch) return; if (!atomic_read(&ch->connected) && driver->usb_connected) if (!atomic_read(&ch->connected) && driver->usb_connected && diag_mask_param()) diag_clear_masks(NULL); if (ch && ch->ops && ch->ops->close) Loading
drivers/char/diag/diagchar.h +1 −0 Original line number Diff line number Diff line Loading @@ -625,6 +625,7 @@ void diag_cmd_remove_reg(struct diag_cmd_reg_entry_t *entry, uint8_t proc); void diag_cmd_remove_reg_by_pid(int pid); void diag_cmd_remove_reg_by_proc(int proc); int diag_cmd_chk_polling(struct diag_cmd_reg_entry_t *entry); int diag_mask_param(void); void diag_clear_masks(struct diag_md_session_t *info); void diag_record_stats(int type, int flag); Loading
drivers/char/diag/diagchar_core.c +14 −2 Original line number Diff line number Diff line Loading @@ -144,6 +144,14 @@ module_param(max_clients, uint, 0); static struct timer_list drain_timer; static int timer_in_progress; /* * Diag Mask clear variable * Used for clearing masks upon * USB disconnection and stopping ODL */ static int diag_mask_clear_param = 1; module_param(diag_mask_clear_param, int, 0644); struct diag_apps_data_t { void *buf; uint32_t len; Loading Loading @@ -386,7 +394,10 @@ static uint32_t diag_translate_kernel_to_user_mask(uint32_t peripheral_mask) return ret; } int diag_mask_param(void) { return diag_mask_clear_param; } void diag_clear_masks(struct diag_md_session_t *info) { int ret; Loading Loading @@ -419,6 +430,7 @@ static void diag_close_logging_process(const int pid) if (!session_info) return; if (diag_mask_clear_param) diag_clear_masks(session_info); mutex_lock(&driver->diag_maskclear_mutex); Loading
drivers/char/diag/diagfwd.c +18 −4 Original line number Diff line number Diff line Loading @@ -1225,6 +1225,8 @@ static int diagfwd_mux_open(int id, int mode) static int diagfwd_mux_close(int id, int mode) { uint8_t i; switch (mode) { case DIAG_USB_MODE: driver->usb_connected = 0; Loading @@ -1245,10 +1247,22 @@ static int diagfwd_mux_close(int id, int mode) */ } else { /* * With clearing of masks on ODL exit and * USB disconnection, closing of the channel is * not needed.This enables read and drop of stale packets. * With sysfs parameter to clear masks set, * peripheral masks are cleared on ODL exit and * USB disconnection and buffers are not marked busy. * This enables read and drop of stale packets. * * With sysfs parameter to clear masks cleared, * masks are not cleared and buffers are to be marked * busy to ensure traffic generated by peripheral * are not read */ if (!(diag_mask_param())) { for (i = 0; i < NUM_PERIPHERALS; i++) { diagfwd_close(i, TYPE_DATA); diagfwd_close(i, TYPE_CMD); } } /* Re enable HDLC encoding */ pr_debug("diag: In %s, re-enabling HDLC encoding\n", __func__); Loading