Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4663817pxa; Mon, 10 Aug 2020 15:04:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu/QmglipfE/bz/i67jqmJ46XwN+SyeWZM0wfwZ73BXisVw6bg921wnKfRUrMlWniw5P2U X-Received: by 2002:a17:906:8318:: with SMTP id j24mr22842622ejx.409.1597097046119; Mon, 10 Aug 2020 15:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597097046; cv=none; d=google.com; s=arc-20160816; b=nUMXdKuczMWcJuLz/rqR88932ngMyM7rJnkICGSw4pkSZivuMQQKedemS/AQmBIfXo 6/rKg7Yt2PsDxNfVv7os/D2SS7xopGQ5R7tutVfeRQPY+gCAKMjNP+VY2LLtmNtjOkRw pVxAU4FKCIAZ5rvuyXeK0QmM4ExfPo3vTf2O0naRuZmSRowfoHSjUoG5BGiPBwAh5gQV iYJ6pAjOiQj2G0GoFDWuIreLFXWgxSDSYGldyLybxfiNQAY92sfvZA6UqPORB2/QuMWl deCuYpe8aemU2IdQT/nQghHqnoEbt3JiqJate1E9JzsPKdStRw17VsedIgEc0teQlIxq U1Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=bJ/v+6BI1paYfL/eqbBaNuQt+rMkV7hVFchzos3nW8A=; b=erF1zFYIK0xfK7JVQrxcOqJ1/zy7/D+cMj3B/2akbU+1TMEJ5BqhqTB0KZO6+SYXI5 FnyXR0Dx6zWHIBlBGRsGlriNqK0N9StNJHonLTB7ltdqvrlOSmDZRmpLl741c/P7sXkx I/CQDXcRQrab+iXMcBb8l/I8Xp5OpTdZ0UDYch1fpDi0tINomDXbMdPPORod0QRImRrp YW9CHZ9Kp3x/chM8wVKBsYu3NXz16sn08MLH73X0Ftl3Ow3nv5E3H9UYwhb2g/uKaT6e VKGtVMRQ/m67u4x9TWoA1SXxfajDobCwTdK0dhGcaNlQGyjrmn1qq/2qtjXsA9+BKcSG 7qUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Iw4GrHqn; 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 s26si11328778ejv.28.2020.08.10.15.03.43; Mon, 10 Aug 2020 15:04:06 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Iw4GrHqn; 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 S1727028AbgHJWCF (ORCPT + 99 others); Mon, 10 Aug 2020 18:02:05 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:33944 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726700AbgHJWCB (ORCPT ); Mon, 10 Aug 2020 18:02:01 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597096921; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=bJ/v+6BI1paYfL/eqbBaNuQt+rMkV7hVFchzos3nW8A=; b=Iw4GrHqnM5Xl0LqDOTV6l/ZgeDDboVNVfa/w80WU+vBresuTL2963oLYw0A8dsvzDhbDzbYS oLs8QoJQgB6geUlhGdnBB+inOr/CY13RFCSfyFb05cM6ZYcKz7SIZm80rMf0PPrVbazkM34j Kr9N2Qhx3bGzmClkOpL8c5PQj9s= X-Mailgun-Sending-Ip: 69.72.43.7 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-n16.prod.us-east-1.postgun.com with SMTP id 5f31c3add48d4625ca16299c (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 10 Aug 2020 22:01:17 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 23785C433A1; Mon, 10 Aug 2020 22:01:17 +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=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable 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 DF2E3C433A0; Mon, 10 Aug 2020 22:01:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DF2E3C433A0 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=none 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 v7 06/11] bus: mhi: core: Introduce helper function to check device state Date: Mon, 10 Aug 2020 15:01:00 -0700 Message-Id: <1597096865-19636-7-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1597096865-19636-1-git-send-email-bbhatt@codeaurora.org> References: <1597096865-19636-1-git-send-email-bbhatt@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce a helper function to determine whether the device is in a powered ON state and resides in one of the active MHI states. This will allow for some use cases where access can be pre-determined. Signed-off-by: Bhaumik Bhatt Reviewed-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/internal.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h index 1bbd6e9..5a81a42 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -598,6 +598,11 @@ int mhi_pm_m3_transition(struct mhi_controller *mhi_cntrl); int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl); int mhi_send_cmd(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan, enum mhi_cmd_type cmd); +static inline bool mhi_is_active(struct mhi_controller *mhi_cntrl) +{ + return (mhi_cntrl->dev_state >= MHI_STATE_M0 && + mhi_cntrl->dev_state <= MHI_STATE_M3_FAST); +} static inline void mhi_trigger_resume(struct mhi_controller *mhi_cntrl) { -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project