Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3073915ybt; Mon, 29 Jun 2020 14:37:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygi4JyUW97qrUOQQa1tBrtI1NEgP7TbXYpDizwn3DCJ3GShzasWEhzWv/Yj0Fci1TiwHXa X-Received: by 2002:aa7:c590:: with SMTP id g16mr20207074edq.5.1593466632728; Mon, 29 Jun 2020 14:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593466632; cv=none; d=google.com; s=arc-20160816; b=GrwJo5CziZEzfQo6h5Nw1Mpjede2sO5aUyP1AOhrR2lw5OI+afA3Sp59msilj3uSwv w7WMOGFIKcF89vnVeSW/ikSeh1hhwolxFmT6Z/ZgiK1OXsEZOCRrjbCmp59FIV/Vrosc 0OMDhsH1RG9SeouCIuM6zZlQzb1/s29rvnR3wpoJfxSxlJbZKs000ya9qhan/yUltMfr TtiNG9we7QmsZeGjbU8p8WuoU/q+a4BlxxHp3QSnW9vI99zDB9vPxBCijn5Lq429R2tx hgLwLqmr5q3pGCl+CCs3KthctQpcC5D5siyfd20RtI5rjlLCAEiOGsS6iwa3E1RINr9B 3YcQ== 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=WbUeEpKb1Qs2PCBMIgTEm9+uqDc9t0k9P6qZc4ZqOZE=; b=SNtk9eH238CuyZ6xDmf96N3fkD7Ev4E6oeiFJpMh2tS6LTLBco8WEKvyU57qPZuH5q NK7XMsCw0AM1wDrj2tnoDKVMvJJ+GaldZQGUYN5vovYNgTwMxRMk2i0PNGb/Q2VVJkZc 5XT9LMMj7Ck1Q87Qa8zgvaHM2EXMQbNHGE3R7q3fKNTKMcCBwLMXPBIoOVhRPEvtJJtr ZDlVkxsXmBbYOKqFn86pagRnwkhP/n1RRRcvM+J9FryO1KytBvuMmXS47VwTlhYVnJhM NWR70Y4P4StUtvc13ESxCl+h/kPQL2HmRVCzwGFZZP5jmhWQ0WgK3Bceal6jxfqnpaeL ysrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=OtvFprdL; 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 m6si456371eda.275.2020.06.29.14.36.49; Mon, 29 Jun 2020 14:37:12 -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=OtvFprdL; 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 S2388697AbgF2VgK (ORCPT + 99 others); Mon, 29 Jun 2020 17:36:10 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:17693 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726937AbgF2Sko (ORCPT ); Mon, 29 Jun 2020 14:40:44 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1593456044; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=WbUeEpKb1Qs2PCBMIgTEm9+uqDc9t0k9P6qZc4ZqOZE=; b=OtvFprdLppLSIFNI6V5LeyG/wwvThHTvpq27xmzLRF0tUE/3E0j2CpUn8Kk52dVEyvb6gf1r 2MNCPkRGIWDEOlgMxPoWKExO8bKR/8rBAWvN2dIGltB4f3PE8Vw3fOhIGy7pu50EgZ0zAG/N V5DCZhKxNA5rXr9yLUtbeFh+woY= X-Mailgun-Sending-Ip: 104.130.122.29 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-n04.prod.us-west-2.postgun.com with SMTP id 5efa195b117610c7ffefd39f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 29 Jun 2020 16:39:55 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 0057AC433CA; Mon, 29 Jun 2020 16:39:54 +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 5EB22C43391; Mon, 29 Jun 2020 16:39:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5EB22C43391 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 v4 6/9] bus: mhi: core: Introduce helper function to check device state Date: Mon, 29 Jun 2020 09:39:39 -0700 Message-Id: <1593448782-8385-7-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593448782-8385-1-git-send-email-bbhatt@codeaurora.org> References: <1593448782-8385-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 --- 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 cb32eaf..997c6e9 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -598,6 +598,11 @@ int mhi_queue_state_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, bool hard_wakeup) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project