Loading drivers/char/diag/diagchar.h +2 −1 Original line number Original line Diff line number Diff line /* Copyright (c) 2008-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2008-2016, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -500,6 +500,7 @@ struct diagchar_dev { struct list_head cmd_reg_list; struct list_head cmd_reg_list; struct mutex cmd_reg_mutex; struct mutex cmd_reg_mutex; uint32_t cmd_reg_count; uint32_t cmd_reg_count; struct mutex diagfwd_channel_mutex; /* Sizes that reflect memory pool sizes */ /* Sizes that reflect memory pool sizes */ unsigned int poolsize; unsigned int poolsize; unsigned int poolsize_hdlc; unsigned int poolsize_hdlc; Loading drivers/char/diag/diagchar_core.c +1 −0 Original line number Original line Diff line number Diff line Loading @@ -3298,6 +3298,7 @@ static int __init diagchar_init(void) mutex_init(&driver->diag_file_mutex); mutex_init(&driver->diag_file_mutex); mutex_init(&driver->delayed_rsp_mutex); mutex_init(&driver->delayed_rsp_mutex); mutex_init(&apps_data_mutex); mutex_init(&apps_data_mutex); mutex_init(&driver->diagfwd_channel_mutex); init_waitqueue_head(&driver->wait_q); init_waitqueue_head(&driver->wait_q); INIT_WORK(&(driver->diag_drain_work), diag_drain_work_fn); INIT_WORK(&(driver->diag_drain_work), diag_drain_work_fn); INIT_WORK(&(driver->update_user_clients), INIT_WORK(&(driver->update_user_clients), Loading drivers/char/diag/diagfwd_peripheral.c +3 −1 Original line number Original line Diff line number Diff line /* Copyright (c) 2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -646,6 +646,7 @@ void diagfwd_close_transport(uint8_t transport, uint8_t peripheral) fwd_info = &early_init_info[transport][peripheral]; fwd_info = &early_init_info[transport][peripheral]; if (fwd_info->p_ops && fwd_info->p_ops->close) if (fwd_info->p_ops && fwd_info->p_ops->close) fwd_info->p_ops->close(fwd_info->ctxt); fwd_info->p_ops->close(fwd_info->ctxt); mutex_lock(&driver->diagfwd_channel_mutex); fwd_info = &early_init_info[transport_open][peripheral]; fwd_info = &early_init_info[transport_open][peripheral]; dest_info = &peripheral_info[TYPE_CNTL][peripheral]; dest_info = &peripheral_info[TYPE_CNTL][peripheral]; dest_info->inited = 1; dest_info->inited = 1; Loading @@ -664,6 +665,7 @@ void diagfwd_close_transport(uint8_t transport, uint8_t peripheral) diagfwd_late_open(dest_info); diagfwd_late_open(dest_info); diagfwd_cntl_open(dest_info); diagfwd_cntl_open(dest_info); init_fn(peripheral); init_fn(peripheral); mutex_unlock(&driver->diagfwd_channel_mutex); diagfwd_queue_read(&peripheral_info[TYPE_DATA][peripheral]); diagfwd_queue_read(&peripheral_info[TYPE_DATA][peripheral]); diagfwd_queue_read(&peripheral_info[TYPE_CMD][peripheral]); diagfwd_queue_read(&peripheral_info[TYPE_CMD][peripheral]); } } Loading drivers/char/diag/diagfwd_socket.c +9 −1 Original line number Original line Diff line number Diff line /* Copyright (c) 2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -929,7 +929,9 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len) (info->data_ready > 0) || (!info->hdl) || (info->data_ready > 0) || (!info->hdl) || (atomic_read(&info->diag_state) == 0)); (atomic_read(&info->diag_state) == 0)); if (err) { if (err) { mutex_lock(&driver->diagfwd_channel_mutex); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); mutex_unlock(&driver->diagfwd_channel_mutex); return -ERESTARTSYS; return -ERESTARTSYS; } } Loading @@ -941,7 +943,9 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len) DIAG_LOG(DIAG_DEBUG_PERIPHERALS, DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "%s closing read thread. diag state is closed\n", "%s closing read thread. diag state is closed\n", info->name); info->name); mutex_lock(&driver->diagfwd_channel_mutex); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); mutex_unlock(&driver->diagfwd_channel_mutex); return 0; return 0; } } Loading Loading @@ -1008,8 +1012,10 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len) if (total_recd > 0) { if (total_recd > 0) { DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "%s read total bytes: %d\n", DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "%s read total bytes: %d\n", info->name, total_recd); info->name, total_recd); mutex_lock(&driver->diagfwd_channel_mutex); err = diagfwd_channel_read_done(info->fwd_ctxt, err = diagfwd_channel_read_done(info->fwd_ctxt, buf, total_recd); buf, total_recd); mutex_unlock(&driver->diagfwd_channel_mutex); if (err) if (err) goto fail; goto fail; } else { } else { Loading @@ -1022,7 +1028,9 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len) return 0; return 0; fail: fail: mutex_lock(&driver->diagfwd_channel_mutex); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); mutex_unlock(&driver->diagfwd_channel_mutex); return -EIO; return -EIO; } } Loading Loading
drivers/char/diag/diagchar.h +2 −1 Original line number Original line Diff line number Diff line /* Copyright (c) 2008-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2008-2016, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -500,6 +500,7 @@ struct diagchar_dev { struct list_head cmd_reg_list; struct list_head cmd_reg_list; struct mutex cmd_reg_mutex; struct mutex cmd_reg_mutex; uint32_t cmd_reg_count; uint32_t cmd_reg_count; struct mutex diagfwd_channel_mutex; /* Sizes that reflect memory pool sizes */ /* Sizes that reflect memory pool sizes */ unsigned int poolsize; unsigned int poolsize; unsigned int poolsize_hdlc; unsigned int poolsize_hdlc; Loading
drivers/char/diag/diagchar_core.c +1 −0 Original line number Original line Diff line number Diff line Loading @@ -3298,6 +3298,7 @@ static int __init diagchar_init(void) mutex_init(&driver->diag_file_mutex); mutex_init(&driver->diag_file_mutex); mutex_init(&driver->delayed_rsp_mutex); mutex_init(&driver->delayed_rsp_mutex); mutex_init(&apps_data_mutex); mutex_init(&apps_data_mutex); mutex_init(&driver->diagfwd_channel_mutex); init_waitqueue_head(&driver->wait_q); init_waitqueue_head(&driver->wait_q); INIT_WORK(&(driver->diag_drain_work), diag_drain_work_fn); INIT_WORK(&(driver->diag_drain_work), diag_drain_work_fn); INIT_WORK(&(driver->update_user_clients), INIT_WORK(&(driver->update_user_clients), Loading
drivers/char/diag/diagfwd_peripheral.c +3 −1 Original line number Original line Diff line number Diff line /* Copyright (c) 2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -646,6 +646,7 @@ void diagfwd_close_transport(uint8_t transport, uint8_t peripheral) fwd_info = &early_init_info[transport][peripheral]; fwd_info = &early_init_info[transport][peripheral]; if (fwd_info->p_ops && fwd_info->p_ops->close) if (fwd_info->p_ops && fwd_info->p_ops->close) fwd_info->p_ops->close(fwd_info->ctxt); fwd_info->p_ops->close(fwd_info->ctxt); mutex_lock(&driver->diagfwd_channel_mutex); fwd_info = &early_init_info[transport_open][peripheral]; fwd_info = &early_init_info[transport_open][peripheral]; dest_info = &peripheral_info[TYPE_CNTL][peripheral]; dest_info = &peripheral_info[TYPE_CNTL][peripheral]; dest_info->inited = 1; dest_info->inited = 1; Loading @@ -664,6 +665,7 @@ void diagfwd_close_transport(uint8_t transport, uint8_t peripheral) diagfwd_late_open(dest_info); diagfwd_late_open(dest_info); diagfwd_cntl_open(dest_info); diagfwd_cntl_open(dest_info); init_fn(peripheral); init_fn(peripheral); mutex_unlock(&driver->diagfwd_channel_mutex); diagfwd_queue_read(&peripheral_info[TYPE_DATA][peripheral]); diagfwd_queue_read(&peripheral_info[TYPE_DATA][peripheral]); diagfwd_queue_read(&peripheral_info[TYPE_CMD][peripheral]); diagfwd_queue_read(&peripheral_info[TYPE_CMD][peripheral]); } } Loading
drivers/char/diag/diagfwd_socket.c +9 −1 Original line number Original line Diff line number Diff line /* Copyright (c) 2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -929,7 +929,9 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len) (info->data_ready > 0) || (!info->hdl) || (info->data_ready > 0) || (!info->hdl) || (atomic_read(&info->diag_state) == 0)); (atomic_read(&info->diag_state) == 0)); if (err) { if (err) { mutex_lock(&driver->diagfwd_channel_mutex); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); mutex_unlock(&driver->diagfwd_channel_mutex); return -ERESTARTSYS; return -ERESTARTSYS; } } Loading @@ -941,7 +943,9 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len) DIAG_LOG(DIAG_DEBUG_PERIPHERALS, DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "%s closing read thread. diag state is closed\n", "%s closing read thread. diag state is closed\n", info->name); info->name); mutex_lock(&driver->diagfwd_channel_mutex); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); mutex_unlock(&driver->diagfwd_channel_mutex); return 0; return 0; } } Loading Loading @@ -1008,8 +1012,10 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len) if (total_recd > 0) { if (total_recd > 0) { DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "%s read total bytes: %d\n", DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "%s read total bytes: %d\n", info->name, total_recd); info->name, total_recd); mutex_lock(&driver->diagfwd_channel_mutex); err = diagfwd_channel_read_done(info->fwd_ctxt, err = diagfwd_channel_read_done(info->fwd_ctxt, buf, total_recd); buf, total_recd); mutex_unlock(&driver->diagfwd_channel_mutex); if (err) if (err) goto fail; goto fail; } else { } else { Loading @@ -1022,7 +1028,9 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len) return 0; return 0; fail: fail: mutex_lock(&driver->diagfwd_channel_mutex); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); diagfwd_channel_read_done(info->fwd_ctxt, buf, 0); mutex_unlock(&driver->diagfwd_channel_mutex); return -EIO; return -EIO; } } Loading