Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp982774pxx; Thu, 29 Oct 2020 21:16:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxapZaWJbK5FKwbV1OBHMCelW461I+hon++JSgQ2kG17q5disYXNcFFanE09XHUcQujxgCT X-Received: by 2002:a17:906:2788:: with SMTP id j8mr590952ejc.185.1604031365706; Thu, 29 Oct 2020 21:16:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604031365; cv=none; d=google.com; s=arc-20160816; b=Km05utDIJbtQgCZ9WY9TmGwgL5kEqMblFLSTQ84u5aD053czYYbrrd/J9O5eRQNVIh 69qHuL4AyflPMT7eiMTtnC5X7wo/dpLomPRHOX5nZ3PrLR0JxnS/jJ7Uu6epsswxSeB1 oKrj4otPqDJy/T6ZYeWVbyeA1v0F7hH8+zlmYZlXq/rsAHis2Y8wvdtJQNfVfjMXAqM0 O9CrDn3nVelmUDPqYxucwo3xdyOxn2xQt64NiXmEmqeYTuKbbui/xWPFqHM4tqf+7kIy 6GqOgEiHhULXsVeGScJUePw61DESn/l1RvnBwCtiWplV3caySM+8dsN6gBtVRIQ9F7pg cbVA== 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=eEPMmlVmbY4orQyeT0zvucPxWgIeu6CyYYkSXaJt7TfxpgZeQcEpvAZdQsWKpdRTWX 5tffzElxz+OSaIcVYnKTmVm9r6aPf56ZG3/9tZOEtA9cSK1JSvkmWrVzNlwcMOk5+tvy Xg7qp1u1+CZUbCJvQXTxk70uTpcIRWiIwDBdooiuRF0GkZt5Fe834CmwE36GonILPQaw A5WVtgpWoomc5EA4B2N4wPE20uBz7m2UgzJZozg7rG1mEEOPzSB+N+/TSoc/mrxDXci6 dTUf0nXLQpEV0ugqja1NLNQS+WNO7gF/5hvpG1UoX3hPywXY7qdEdym75FAuvFgULQvE XE8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=mB6ko4aE; 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 bt10si3602399edb.503.2020.10.29.21.15.42; Thu, 29 Oct 2020 21:16:05 -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=mB6ko4aE; 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 S1726593AbgJ3ELi (ORCPT + 99 others); Fri, 30 Oct 2020 00:11:38 -0400 Received: from m42-4.mailgun.net ([69.72.42.4]:10763 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726570AbgJ3ELh (ORCPT ); Fri, 30 Oct 2020 00:11:37 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1604031097; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=jHBDfhDUQAqfapfWx+pbcrnYTGcsW4TcpaOag4XW22U=; b=mB6ko4aEHeScn45v532V2R3Pz4vljdafdpZ1kApDDB7adQW8PAgHHW9x3b0hm611mQYYlXbB oeUpKZe0wlYxOchBRG+qp00Nzm36cHsYHQqoYRXaG8UcyNDJF3StGg2pEsx5CE6K2ZWsqrbt ISXXTVaFWrbA6nao3h92f9O9ghA= X-Mailgun-Sending-Ip: 69.72.42.4 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-n07.prod.us-east-1.postgun.com with SMTP id 5f9b925bfc3d7f56d0f1974a (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 30 Oct 2020 04:11:07 GMT Sender: bbhatt=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E34DCC43395; Fri, 30 Oct 2020 04:11:06 +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 E881AC4339C; Fri, 30 Oct 2020 04:11:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E881AC4339C 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 v3 03/12] bus: mhi: core: Skip device wake in error or shutdown states Date: Thu, 29 Oct 2020 21:10:48 -0700 Message-Id: <1604031057-32820-4-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604031057-32820-1-git-send-email-bbhatt@codeaurora.org> References: <1604031057-32820-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