Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp809762pxf; Thu, 1 Apr 2021 14:17:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjM/2lReuf+CEPe/81cwHG0SvmXWazyomFxtxqdEMI2OG06kLxnOixi/QuPETimZbZN3Eo X-Received: by 2002:a05:6402:1393:: with SMTP id b19mr12004412edv.333.1617311852431; Thu, 01 Apr 2021 14:17:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617311852; cv=none; d=google.com; s=arc-20160816; b=z9r8Gk9v0Sdv9zx8gvKSrX6NwN2IdLvZ65/F8qm7cVoSmFEBbcngLqroAo2L7GmMvl L20p/WA26Ebyj4E4XUPF3RGLC6+qtM4cNRw7gylHRntaeaPvzmOIYFShwEncpT50J8q2 LBKMcwjc+uy0zRvy4LF6f7g6nDHh76eiq8dJ1lw9WpscP6zHyV6Q/EKIGWivhg7uE3t7 kKXmPRXOvpwbuWaiS0xz5y1r/Cl68IVFVO1AOxPziOpgfM7dzbjYyI0yQ3EPsz06T4KS wPI20QPTCuug6WsxN289By4znM5ApkQYFJQ3Veb8LVnK0bxVehYbWeLJ/H/er8hLNNuK pZXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=O6zXQGSmk5xBK5Aq+tFKe1FqmEKZngkh35RkCfWXlmU=; b=wf6ZRoxA/efLxc7t+3CTc71Q5ED6rCqoyaAUAKJIc0dHzEXCfjE8xYByyS5y7WOuar IKqZ9i4Q8Tmv1k1LzuxBVTdee2mkWqXJN7NwG2nnwk45zoM87Jv6/OKSe4jVwM15FkTI yEYROKkEdDhyCJU7S1lxRPhs1jz6Nlu5sVFPdR4MFHd/FDPekp8m+PFV59K+o/fja+W4 b078gCA7upUjYxHGMu6CzrckvCg42YcOZ55SeBrviwlWlX0mZk+pNEEycZuOmifoXGds yMLCSR2VN36n5w2jF045x1xx8m0slKr8G2LN0Z1bcEMqdOFkVSP/muIz1ZXMtIFYYZcb kHUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=LyilOC6S; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si5266401edd.8.2021.04.01.14.17.09; Thu, 01 Apr 2021 14:17:32 -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=@mg.codeaurora.org header.s=smtp header.b=LyilOC6S; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234662AbhDAVQe (ORCPT + 99 others); Thu, 1 Apr 2021 17:16:34 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:64059 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234633AbhDAVQ2 (ORCPT ); Thu, 1 Apr 2021 17:16:28 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1617311789; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=O6zXQGSmk5xBK5Aq+tFKe1FqmEKZngkh35RkCfWXlmU=; b=LyilOC6SSM/G2CaVy6TEYkKvXXl39K9in7gLmgnN8gb13aV8HvZbfkaqblqM6sOwTOHw1t67 4RRXZ9WBnmi2IzUUof5EfOIQ7DCBPZw45NePTTPoznjQzFaOz9JMtfV1NQ41lG12p6MpMKD/ 3VNvjwQRwKphyt/8evTo8KRQVsY= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 6066382b74f773a66493f47e (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 01 Apr 2021 21:16:27 GMT Sender: bbhatt=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 19672C43465; Thu, 1 Apr 2021 21:16:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from malabar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: bbhatt) by smtp.codeaurora.org (Postfix) with ESMTPSA id E7635C43461; Thu, 1 Apr 2021 21:16:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E7635C43461 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=bbhatt@codeaurora.org From: Bhaumik Bhatt To: manivannan.sadhasivam@linaro.org Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, carl.yin@quectel.com, naveen.kumar@quectel.com, loic.poulain@linaro.org, Bhaumik Bhatt Subject: [PATCH v8 2/9] bus: mhi: core: Clear context for stopped channels from remove() Date: Thu, 1 Apr 2021 14:16:11 -0700 Message-Id: <1617311778-1254-3-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1617311778-1254-1-git-send-email-bbhatt@codeaurora.org> References: <1617311778-1254-1-git-send-email-bbhatt@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 d1d9b0d..f8ba954 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -1293,7 +1293,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); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project