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

Commit 191e7084 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Do not close mhi channels on usb disconnect"

parents 02b92966 b8f4d96e
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)