Loading drivers/char/diag/diagfwd_peripheral.c +1 −4 Original line number Diff line number Diff line /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. * * 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 Loading Loading @@ -1436,9 +1436,6 @@ int diagfwd_channel_close(struct diagfwd_info *fwd_info) if (!fwd_info) return -EIO; if (fwd_info->type == TYPE_CNTL) flush_workqueue(driver->cntl_wq); mutex_lock(&driver->diagfwd_channel_mutex[fwd_info->peripheral]); fwd_info->ch_open = 0; if (fwd_info && fwd_info->c_ops && fwd_info->c_ops->close) Loading drivers/char/diag/diagfwd_socket.c +34 −14 Original line number Diff line number Diff line Loading @@ -496,7 +496,7 @@ static void __socket_close_channel(struct diag_socket_info *info) if (!atomic_read(&info->opened)) return; if ((bootup_req[info->peripheral] == PEPIPHERAL_SSR_UP) && if ((bootup_req[info->peripheral] == PERIPHERAL_SSR_UP) && (info->port_type == PORT_TYPE_SERVER)) { DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: %s is up, stopping cleanup: bootup_req = %d\n", Loading @@ -504,9 +504,10 @@ static void __socket_close_channel(struct diag_socket_info *info) return; } if (info->type != TYPE_CNTL) { memset(&info->remote_addr, 0, sizeof(struct sockaddr_msm_ipc)); diagfwd_channel_close(info->fwd_ctxt); } atomic_set(&info->opened, 0); /* Don't close the server. Server should always remain open */ Loading Loading @@ -955,6 +956,7 @@ static int restart_notifier_cb(struct notifier_block *this, unsigned long code, void *_cmd) { struct restart_notifier_block *notifier; struct diag_socket_info *info = NULL; notifier = container_of(this, struct restart_notifier_block, nb); Loading @@ -964,22 +966,31 @@ static int restart_notifier_cb(struct notifier_block *this, unsigned long code, return NOTIFY_DONE; } mutex_lock(&driver->diag_notifier_mutex); DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "%s: ssr for processor %d ('%s')\n", __func__, notifier->processor, notifier->name); info = &socket_cntl[notifier->processor]; switch (code) { case SUBSYS_BEFORE_SHUTDOWN: DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: %s: SUBSYS_BEFORE_SHUTDOWN\n", __func__); bootup_req[notifier->processor] = PEPIPHERAL_SSR_DOWN; mutex_lock(&driver->diag_notifier_mutex); bootup_req[notifier->processor] = PERIPHERAL_SSR_DOWN; DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: bootup_req[%s] = %d\n", notifier->name, (int)bootup_req[notifier->processor]); mutex_unlock(&driver->diag_notifier_mutex); break; case SUBSYS_AFTER_SHUTDOWN: DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: %s: SUBSYS_AFTER_SHUTDOWN\n", __func__); mutex_lock(&driver->diag_notifier_mutex); memset(&info->remote_addr, 0, sizeof(struct sockaddr_msm_ipc)); diagfwd_channel_close(info->fwd_ctxt); mutex_unlock(&driver->diag_notifier_mutex); break; case SUBSYS_BEFORE_POWERUP: Loading @@ -990,11 +1001,20 @@ static int restart_notifier_cb(struct notifier_block *this, unsigned long code, case SUBSYS_AFTER_POWERUP: DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: %s: SUBSYS_AFTER_POWERUP\n", __func__); mutex_lock(&driver->diag_notifier_mutex); if (!bootup_req[notifier->processor]) { bootup_req[notifier->processor] = PEPIPHERAL_SSR_DOWN; bootup_req[notifier->processor] = PERIPHERAL_SSR_DOWN; DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: bootup_req[%s] = %d\n", notifier->name, (int)bootup_req[notifier->processor]); mutex_unlock(&driver->diag_notifier_mutex); break; } bootup_req[notifier->processor] = PEPIPHERAL_SSR_UP; bootup_req[notifier->processor] = PERIPHERAL_SSR_UP; DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: bootup_req[%s] = %d\n", notifier->name, (int)bootup_req[notifier->processor]); mutex_unlock(&driver->diag_notifier_mutex); break; default: Loading @@ -1002,10 +1022,6 @@ static int restart_notifier_cb(struct notifier_block *this, unsigned long code, "diag: code: %lu\n", code); break; } mutex_unlock(&driver->diag_notifier_mutex); DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: bootup_req[%s] = %d\n", notifier->name, (int)bootup_req[notifier->processor]); return NOTIFY_DONE; } Loading Loading @@ -1165,7 +1181,11 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len, if (read_len <= 0) goto fail; if (!atomic_read(&info->opened) && if (info->type == TYPE_CNTL) { memcpy(&info->remote_addr, &src_addr, sizeof(src_addr)); if (!atomic_read(&info->opened)) __socket_open_channel(info); } else if (!atomic_read(&info->opened) && info->port_type == PORT_TYPE_SERVER) { /* * This is the first packet from the client. Copy its Loading drivers/char/diag/diagfwd_socket.h +4 −4 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2017, 2019, The Linux Foundation. All rights reserved. * * 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 Loading @@ -24,9 +24,9 @@ #define PORT_TYPE_SERVER 0 #define PORT_TYPE_CLIENT 1 #define PEPIPHERAL_AFTER_BOOT 0 #define PEPIPHERAL_SSR_DOWN 1 #define PEPIPHERAL_SSR_UP 2 #define PERIPHERAL_AFTER_BOOT 0 #define PERIPHERAL_SSR_DOWN 1 #define PERIPHERAL_SSR_UP 2 #define CNTL_CMD_NEW_SERVER 4 #define CNTL_CMD_REMOVE_SERVER 5 Loading Loading
drivers/char/diag/diagfwd_peripheral.c +1 −4 Original line number Diff line number Diff line /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. * * 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 Loading Loading @@ -1436,9 +1436,6 @@ int diagfwd_channel_close(struct diagfwd_info *fwd_info) if (!fwd_info) return -EIO; if (fwd_info->type == TYPE_CNTL) flush_workqueue(driver->cntl_wq); mutex_lock(&driver->diagfwd_channel_mutex[fwd_info->peripheral]); fwd_info->ch_open = 0; if (fwd_info && fwd_info->c_ops && fwd_info->c_ops->close) Loading
drivers/char/diag/diagfwd_socket.c +34 −14 Original line number Diff line number Diff line Loading @@ -496,7 +496,7 @@ static void __socket_close_channel(struct diag_socket_info *info) if (!atomic_read(&info->opened)) return; if ((bootup_req[info->peripheral] == PEPIPHERAL_SSR_UP) && if ((bootup_req[info->peripheral] == PERIPHERAL_SSR_UP) && (info->port_type == PORT_TYPE_SERVER)) { DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: %s is up, stopping cleanup: bootup_req = %d\n", Loading @@ -504,9 +504,10 @@ static void __socket_close_channel(struct diag_socket_info *info) return; } if (info->type != TYPE_CNTL) { memset(&info->remote_addr, 0, sizeof(struct sockaddr_msm_ipc)); diagfwd_channel_close(info->fwd_ctxt); } atomic_set(&info->opened, 0); /* Don't close the server. Server should always remain open */ Loading Loading @@ -955,6 +956,7 @@ static int restart_notifier_cb(struct notifier_block *this, unsigned long code, void *_cmd) { struct restart_notifier_block *notifier; struct diag_socket_info *info = NULL; notifier = container_of(this, struct restart_notifier_block, nb); Loading @@ -964,22 +966,31 @@ static int restart_notifier_cb(struct notifier_block *this, unsigned long code, return NOTIFY_DONE; } mutex_lock(&driver->diag_notifier_mutex); DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "%s: ssr for processor %d ('%s')\n", __func__, notifier->processor, notifier->name); info = &socket_cntl[notifier->processor]; switch (code) { case SUBSYS_BEFORE_SHUTDOWN: DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: %s: SUBSYS_BEFORE_SHUTDOWN\n", __func__); bootup_req[notifier->processor] = PEPIPHERAL_SSR_DOWN; mutex_lock(&driver->diag_notifier_mutex); bootup_req[notifier->processor] = PERIPHERAL_SSR_DOWN; DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: bootup_req[%s] = %d\n", notifier->name, (int)bootup_req[notifier->processor]); mutex_unlock(&driver->diag_notifier_mutex); break; case SUBSYS_AFTER_SHUTDOWN: DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: %s: SUBSYS_AFTER_SHUTDOWN\n", __func__); mutex_lock(&driver->diag_notifier_mutex); memset(&info->remote_addr, 0, sizeof(struct sockaddr_msm_ipc)); diagfwd_channel_close(info->fwd_ctxt); mutex_unlock(&driver->diag_notifier_mutex); break; case SUBSYS_BEFORE_POWERUP: Loading @@ -990,11 +1001,20 @@ static int restart_notifier_cb(struct notifier_block *this, unsigned long code, case SUBSYS_AFTER_POWERUP: DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: %s: SUBSYS_AFTER_POWERUP\n", __func__); mutex_lock(&driver->diag_notifier_mutex); if (!bootup_req[notifier->processor]) { bootup_req[notifier->processor] = PEPIPHERAL_SSR_DOWN; bootup_req[notifier->processor] = PERIPHERAL_SSR_DOWN; DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: bootup_req[%s] = %d\n", notifier->name, (int)bootup_req[notifier->processor]); mutex_unlock(&driver->diag_notifier_mutex); break; } bootup_req[notifier->processor] = PEPIPHERAL_SSR_UP; bootup_req[notifier->processor] = PERIPHERAL_SSR_UP; DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: bootup_req[%s] = %d\n", notifier->name, (int)bootup_req[notifier->processor]); mutex_unlock(&driver->diag_notifier_mutex); break; default: Loading @@ -1002,10 +1022,6 @@ static int restart_notifier_cb(struct notifier_block *this, unsigned long code, "diag: code: %lu\n", code); break; } mutex_unlock(&driver->diag_notifier_mutex); DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "diag: bootup_req[%s] = %d\n", notifier->name, (int)bootup_req[notifier->processor]); return NOTIFY_DONE; } Loading Loading @@ -1165,7 +1181,11 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len, if (read_len <= 0) goto fail; if (!atomic_read(&info->opened) && if (info->type == TYPE_CNTL) { memcpy(&info->remote_addr, &src_addr, sizeof(src_addr)); if (!atomic_read(&info->opened)) __socket_open_channel(info); } else if (!atomic_read(&info->opened) && info->port_type == PORT_TYPE_SERVER) { /* * This is the first packet from the client. Copy its Loading
drivers/char/diag/diagfwd_socket.h +4 −4 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2017, 2019, The Linux Foundation. All rights reserved. * * 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 Loading @@ -24,9 +24,9 @@ #define PORT_TYPE_SERVER 0 #define PORT_TYPE_CLIENT 1 #define PEPIPHERAL_AFTER_BOOT 0 #define PEPIPHERAL_SSR_DOWN 1 #define PEPIPHERAL_SSR_UP 2 #define PERIPHERAL_AFTER_BOOT 0 #define PERIPHERAL_SSR_DOWN 1 #define PERIPHERAL_SSR_UP 2 #define CNTL_CMD_NEW_SERVER 4 #define CNTL_CMD_REMOVE_SERVER 5 Loading