Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2481136pxj; Mon, 10 May 2021 04:08:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNNNnpkzVwu+ql89YsKV3GQ/6Y6kn/oSo5Qe1MYl1WMCcYXuvhCCoFPUGjVveDAPN4lJ8S X-Received: by 2002:a17:907:7747:: with SMTP id kx7mr8529275ejc.400.1620644903346; Mon, 10 May 2021 04:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644903; cv=none; d=google.com; s=arc-20160816; b=BrvV40yRAsAQvIoO/ezaRvmNJoVGSsjtzhUE6iJdjSUMI+YAjUv5i8JR8nqgnMC1aI jN9m8h/PjmBHwNtrbBBPsLjQHbD6XH0ksvbWzeVAjmdrWT7GMU9bBNtAZep65rLrE++L aHVZD2Bsst0vrI6YTEQTms2HqxkoOLHCB7pCTIAZ4Moc/7roFCI8nrd32dHYvVJ1ktrI IAW3ogcta8AG1au2AfEQXGzajFUug+ItWQi53g4i9FW184+o7a/XqpnrFKqH4jbRpGxO U+UsAzsEhhbjor5TjDEKHE+YhggYDSfWgZ91xrdMiqoGB7wBJzDeljBPMO2CEgTYOL7T BtyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MwA0VsyUy5GNZ/ax9CA4FtYlqMyLfL2LUIkw30rzoj8=; b=mfYwKF5rkXP3/iOib0bZpazeK9vC3T4bXDbzDirPe6hclPDn6zjse8mvCphkhEKj9N vgfSCfpKxbJMC/4aI3DhMR+Fcy1Qvhp+chc/ifRO43mbRsdIOVSxGlbq9DzOUV0gCRvj CGnyJ3Tiwui+ZH/q9u5t4twNMm26WNB2+HYTHsK2Crj2F/cJoynkIvo1/qsHBgGaMGow rLhEPP9sTz+1Z5HEAxG4KCm86+9lKnNkkW8O7UgI7KdP/939nIa5nYe56xIAM9iihZFb DjLbnpd4S0gxdImpR+GNqibom+i+kTJgHYIGshFJY5/jk+srdyDYCO/la2G7a9hOsUFh 8mBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jQIIZwfL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si12552199edr.586.2021.05.10.04.07.49; Mon, 10 May 2021 04:08:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jQIIZwfL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234309AbhEJLDA (ORCPT + 99 others); Mon, 10 May 2021 07:03:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:59672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233331AbhEJKpi (ORCPT ); Mon, 10 May 2021 06:45:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8606C619A1; Mon, 10 May 2021 10:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642966; bh=yFRxryqeJbgnPjATn1vS0LuRKrYh/hsd3oCMnWC80p4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQIIZwfLgpjNHur6AV3gSoXCwiUVXFS5WnI99I8miF1IVLohplnrqX9gTewzprlfm sqztkEjAK4xrPuj53qSoxttGFswA2siK0bJ2+DEwlWfRqy7RNnxC49KaolTuNEM3Zj gWi5VLp6EasIiaTVg5qVFFXtcvCw2WyxxX6K57vI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bhaumik Bhatt , Hemant Kumar , Manivannan Sadhasivam , Sasha Levin Subject: [PATCH 5.10 088/299] bus: mhi: core: Clear context for stopped channels from remove() Date: Mon, 10 May 2021 12:18:05 +0200 Message-Id: <20210510102007.861213920@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bhaumik Bhatt [ Upstream commit 4e44ae3d6d9c2c2a6d9356dd279c925532d5cd8c ] If a channel was explicitly stopped but not reset and a driver remove is issued, clean up the channel context such that it is reflected on the device. This move is useful if a client driver module is unloaded or a device crash occurs with the host having placed the channel in a stopped state. Signed-off-by: Bhaumik Bhatt Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Link: https://lore.kernel.org/r/1617311778-1254-3-git-send-email-bbhatt@codeaurora.org Signed-off-by: Manivannan Sadhasivam Signed-off-by: Sasha Levin --- drivers/bus/mhi/core/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 3422ea133deb..0d0386f67ffe 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -1280,7 +1280,8 @@ static int mhi_driver_remove(struct device *dev) mutex_lock(&mhi_chan->mutex); - if (ch_state[dir] == MHI_CH_STATE_ENABLED && + if ((ch_state[dir] == MHI_CH_STATE_ENABLED || + ch_state[dir] == MHI_CH_STATE_STOP) && !mhi_chan->offload_ch) mhi_deinit_chan_ctxt(mhi_cntrl, mhi_chan); -- 2.30.2