Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp923414pxx; Thu, 29 Oct 2020 18:54:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2b32UDGTsWEvxRHBGpqps8Lj3NLNUP8hFfM3pTygv2iSrxCz7weRkHKIoIAF3Cy/w/UOf X-Received: by 2002:aa7:d1c4:: with SMTP id g4mr7048304edp.198.1604022842448; Thu, 29 Oct 2020 18:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604022842; cv=none; d=google.com; s=arc-20160816; b=jpkSbIRt1hrM4Hc8Y4sJeDlIuUHSP7FmeC+8OTLDTp7tHEz50cfH7SBZiBR5MLCETh 5NKUhv9KeW0c9tDxNXyqwBbZOjpaYyeetPaeRSbfwle3Ib7DjDykIJLBdkXG/fDb+zWT 5VKO4OraxPWZJeUmV3OYj9V42T8cL8wdQp+gey5tvgvIQHRClcQ8MeH3YTH12s8tLj/Q tm/xYn8awCIjYXPGZqN7vG+7ymLVLiewS7CB4ya72EDPf8kZgNN/BVaPKC/BvRYzy17l YuqfzvISDEFwZepQYtVlNSodS61VE7g1qgfIpyi/NZ0Jv3Z4pfq8aSpdR6+tGsjA2MsS /riw== 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=jHBDfhDUQAqfapfWx+pbcrnYTGcsW4TcpaOag4XW22U=; b=R4+gn6HFxI7x1pGNLafy/UxVLBFHfT4rCOOg4rfpksHT8ElqExIPqj/PCX6ahYd684 eDCR7z5GliT2n5cMPQmLeq6LRvl6E8zmzE0H0FYczGzp2WPFeYDu9WS04pUr6G2+gks4 7li1E0qS+i9z8Wi8KGVB7iV2LgHqMUcAJ7pKlmmJebqEYLu3NjftXfxthUBcwnS5HzWC F7SZvKvS/95itUDffWfHBDBFK/bIGepGNOGfDqUeQe0XgZOWdTZlRrKHMJetqSQMYp23 dl41gbo5ruozngjhsp0BUMCewvg/KIg+BqsW761BJuBV3SWRd+zGjSx4OqdR42PXOVQ0 lIlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=hDEF8jKn; 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 dn1si3585899edb.319.2020.10.29.18.53.40; Thu, 29 Oct 2020 18:54:02 -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=hDEF8jKn; 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 S1726313AbgJ3BwP (ORCPT + 99 others); Thu, 29 Oct 2020 21:52:15 -0400 Received: from z5.mailgun.us ([104.130.96.5]:59408 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726152AbgJ3BwN (ORCPT ); Thu, 29 Oct 2020 21:52:13 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1604022733; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=jHBDfhDUQAqfapfWx+pbcrnYTGcsW4TcpaOag4XW22U=; b=hDEF8jKnSm5SOPDOQZau19SYVDJOJSiq+OmfhlpYV6qkFTRlSGxVU1J2aOApS1G2EaVhzgo0 GilYt0VWA2Vg4rS6fjJuL5AtBq/LkB7MHWYqV1kyuAgvufL30H+wCCQSvMTnUD3nSpHZPGtt 5ExHaw7L3Ko0HZPr3vPI30NaemQ= X-Mailgun-Sending-Ip: 104.130.96.5 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-n05.prod.us-west-2.postgun.com with SMTP id 5f9b71ccc3d7c9858ad13fdc (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 30 Oct 2020 01:52:12 GMT Sender: bbhatt=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 7E0BDC433C6; Fri, 30 Oct 2020 01:52:12 +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 8B2B3C433CB; Fri, 30 Oct 2020 01:52:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8B2B3C433CB 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, Bhaumik Bhatt Subject: [PATCH v2 03/12] bus: mhi: core: Skip device wake in error or shutdown states Date: Thu, 29 Oct 2020 18:51:54 -0700 Message-Id: <1604022723-34578-4-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604022723-34578-1-git-send-email-bbhatt@codeaurora.org> References: <1604022723-34578-1-git-send-email-bbhatt@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MHI client drivers can request a device wake even if the device may be in an error state or undergoing a shutdown. To prevent unnecessary device wake processing, check for the device state and bail out early so that the clients are made aware of the device state sooner. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 805b6fa74..0299196 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -827,6 +827,10 @@ int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl) /* Wake up the device */ read_lock_bh(&mhi_cntrl->pm_lock); + if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { + read_unlock_bh(&mhi_cntrl->pm_lock); + return -EIO; + } mhi_cntrl->wake_get(mhi_cntrl, true); if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) mhi_trigger_resume(mhi_cntrl); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project