Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp162131ybg; Mon, 27 Jul 2020 19:05:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzV6UHoFpZf27ESimSytwnejJOQuKZM2JySa7sQG2FP4ds9pizMqAFseBgmJvGq12ToCA4j X-Received: by 2002:a17:906:924d:: with SMTP id c13mr22649581ejx.518.1595901911611; Mon, 27 Jul 2020 19:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595901911; cv=none; d=google.com; s=arc-20160816; b=j8vPX6QBwkRNJFrklg7dybkgZ8/pW/zmktKPicQ5e1E4qferztfBzNoPbsACehiqQ8 TD3bZPWyeQXdYEWfaapZPA0/++9xval924P5WUs32tXznIwEnKrTC4st2GWTL7MAwa2A ++kC97Si6Ix222MpVdMvQB+0r+fKz+F4cgYjUQLgB9CtUcS7iDgLIqDt4NhkLkAar22V YF/jNMd0jRuCYGBPk8EEYetSzdC6tlBIqjAg363ZtzPEf6tfhsMwEuAqb8SR1HbH2Dyv NEh+ohdUBQl73HEPorxoJppvlt7ATd2dGmZ8mNd5wLMJJQHO6V82eO08L65LcAkrxvtw lG/w== 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=U8o1vP3AmEHB9HwK6Wh4gpwjgxVENYB45anVJdXU0gYXIyRYPQ9GhlzoVSFnjs0ev7 BylItOvTq5MB6GVPiPcO9CfUR0aOd1V5KPU66Kl/9VmwXO2578EowhfnQGdXUMhLXR8x mzLrlht/FntaiRrOCc1zqxDBp5Qp6RQK2YAs+O4xYW/XEqq0AyDSEE9wS7wC3241Eiz1 DF4q7+a5ZhCps9JxpT+3ZkfrGd/5A0YNpoqh5EHGxCAyAJTVKANuqi7gOYnd5opNG3Vf /wxRs60lCaFrCjhQ3ZBV2Pqmhv5+nfBfRbS3mWUYaYjUrR3JGhdVSBWJs2cRwbyjXKLN QUQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=ggwn8xcq; 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 bq8si7403535ejb.52.2020.07.27.19.04.49; Mon, 27 Jul 2020 19:05:11 -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=ggwn8xcq; 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 S1727828AbgG1CDh (ORCPT + 99 others); Mon, 27 Jul 2020 22:03:37 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:26802 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727820AbgG1CDg (ORCPT ); Mon, 27 Jul 2020 22:03:36 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595901816; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=bJ/v+6BI1paYfL/eqbBaNuQt+rMkV7hVFchzos3nW8A=; b=ggwn8xcqeHqA1GMrM8eGqYtwY0gjDilw43qT3bGq5O6k5ZyxfymacuIqABkK/MFzMMDKkIUh DStjeewtL+kZsC+MJuTQE6rn4+ckOyeBPklwzaMdI6tWVEUOeq1yw6NOFkvX9ms/m5IZPgWD nceJzCfkMT09g/u+GomZG10ezXE= 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-n20.prod.us-east-1.postgun.com with SMTP id 5f1f873aca55a5604c7acfd5 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 28 Jul 2020 02:02:34 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8AD02C43391; Tue, 28 Jul 2020 02:02:33 +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, URIBL_BLOCKED autolearn=ham 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 F097AC433AF; Tue, 28 Jul 2020 02:02:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F097AC433AF 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 v6 06/11] bus: mhi: core: Introduce helper function to check device state Date: Mon, 27 Jul 2020 19:02:15 -0700 Message-Id: <1595901740-27379-7-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595901740-27379-1-git-send-email-bbhatt@codeaurora.org> References: <1595901740-27379-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