Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8f4d96e authored by Sreelakshmi Gownipalli's avatar Sreelakshmi Gownipalli Committed by Manoj Prabhu B
Browse files

diag: Do not close mhi channels on usb disconnect



Do not close mhi channels on usb disconnect. Close the
channels only when a ssr notification from MHI occurs.
This will reduce the over head of closing and opening
mhi channels during usb disconnect/connect. Also this
will resolve a deadlock issue while switching the
logging from memory device mode to usb.

Change-Id: If57bc0d4355da1f8e400bab8a312988721157eab
Signed-off-by: default avatarSreelakshmi Gownipalli <sgownipa@codeaurora.org>
Signed-off-by: default avatarManoj Prabhu B <bmanoj@codeaurora.org>
parent 6304c587
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/slab.h>
@@ -84,19 +84,6 @@ static int diagfwd_bridge_mux_disconnect(int id, int mode)
	if (id < 0 || id >= NUM_REMOTE_DEV)
		return -EINVAL;

	if ((mode == DIAG_USB_MODE &&
		driver->logging_mode == DIAG_MEMORY_DEVICE_MODE) ||
		(mode == DIAG_MEMORY_DEVICE_MODE &&
		driver->logging_mode == DIAG_USB_MODE)) {
		/*
		 * Don't close the MHI channels when usb is disconnected
		 * and a process is running in memory device mode.
		 */
		return 0;
	}

	if (bridge_info[id].dev_ops && bridge_info[id].dev_ops->close)
		bridge_info[id].dev_ops->close(bridge_info[id].ctxt);
	return 0;
}

+3 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/slab.h>
@@ -216,6 +216,8 @@ static int __mhi_close(struct diag_mhi_info *mhi_info, int close_flag)
	atomic_set(&(mhi_info->read_ch.opened), 0);
	atomic_set(&(mhi_info->write_ch.opened), 0);

	cancel_work_sync(&mhi_info->read_work);
	cancel_work_sync(&mhi_info->read_done_work);
	flush_workqueue(mhi_info->mhi_wq);

	if (close_flag == CLOSE_CHANNELS)