From patchwork Wed Dec 2 09:41:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335967 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778025ejs; Wed, 2 Dec 2020 01:45:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyrOij8F+ymnNXBRvowT5TdvAyvpB82TtItJf7DrlCOvGMFzY/ljCYYdcGoZU4YqLOiYYxc X-Received: by 2002:a17:906:3b5b:: with SMTP id h27mr1461039ejf.450.1606902304643; Wed, 02 Dec 2020 01:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902304; cv=none; d=google.com; s=arc-20160816; b=tZOwYjcVfzuRYjR5M+fKy2e3HIKcGjSVjrF4F2bgDD0zQ2UpdTrEmrifb6Uu9MXAx6 UljR4STekb9WQRJfWtEhD2ntYtvyjPUGiXVt63RGl/p2R3JfbDLYtrx6+3eifRM8T/0a 4zE2d+Q1xlwCHyFefspMGr8N87v/aa2tvgKYUTxm8YI82aietJ84FSwh6FCd9a6SWW19 K3N71aemuix6a9br90k1IaAFZYIxV6eX1CaunJJCXwRqSFExQB8zFeVvUxRKQ9zGS57b ZQUrg1OBKexlu6U971RH4CCNq1MArZ9PrfWA3FyXUC+anuMn9mGP/vrVe+Kyeo5r2fZ+ 2c4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qlptgLAgYYEEBECAOSdw0l78qtjRaQyT/9MkpEBmWJU=; b=Jc80abgMFmWkdLnQRsVZbRlQpxfd3vG0C8P2Jdgxe+Xcraq1ERrxpoLxkVreGv7aeO uji0TjpJVuhAVugW5PfKgP2z/lDKBwJKUWjDMOlwgtCG3s83PsgoUlwwtsZ7dXDn8cvj k5TbqUT32u5FB3Z/mQhRGlnptW5NBUHOkbLELl5lUGYIk4xj6JLLFg/FSmuaNIYic/7P uV0yZe04cD9/tRgqGHe6JeH4eXi+TS3FXxeaAbT5+08PKfgRSPIlaoWIm+daypkK1qBf AD2jzI2XFzj++V3i9w9Qc6e+GAMr9ZsmGp/8/TkKMxLTXerT3gMGpohXE0ml/Ve4xYuy AMeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WxxRtYpd; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do13si531726ejc.286.2020.12.02.01.45.04; Wed, 02 Dec 2020 01:45:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b=WxxRtYpd; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388381AbgLBJpA (ORCPT + 15 others); Wed, 2 Dec 2020 04:45:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388600AbgLBJom (ORCPT ); Wed, 2 Dec 2020 04:44:42 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75C43C08E861 for ; Wed, 2 Dec 2020 01:43:26 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id f17so754154pge.6 for ; Wed, 02 Dec 2020 01:43:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qlptgLAgYYEEBECAOSdw0l78qtjRaQyT/9MkpEBmWJU=; b=WxxRtYpdbnDZtPw8aTHbrkPc+jst9eXu8a/qPDLPBiWTxotTgJ8Ubm0oQ2o+y2RvFX RoKL2hzhmGcLywD4OEw1EPmRTjht7k1YQs3pUInAPwQ5gQlJ+LVpjgjZnkU5yXArFpMJ l5LL0RisqLXXnqITYhjmYDey6k5UxZfW5oq5cx9q+SX35hAUQYlV+03dh7owyGCPiKWg kPAWTDiWwnIM43ltUznEhK0yvwKHRRDIY6wL/Ioq3BSMF6wkmUJmdNOo4aL/Y5nlrB0a 5WBnDSEZ10wvhFbFTm1otfhZjJ2qRQ+6IHzqb7UKsalWCj74IY6jtn91JM355Oxyiohp XbfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qlptgLAgYYEEBECAOSdw0l78qtjRaQyT/9MkpEBmWJU=; b=oQyZM6jfXLnRqwsK6tRR/HQHxdzjY2kx9UEbuGM6XtVUBJ2b/rGZrE5oieHIgywFZC txxBDqumGyHtGJCV8A38ljI20n/tlKXWXHC91JqOmK+BNbDDPov5bqFm1HseXN8Zk9BV EIJ6LGvPry/7eIv97Ao40UTUxTz+PcqVOhpsWDa3tCS5mh3bHdSTVGmuBcYjPENacEGD DiUl82iBsqHpMYAU/JKL7Ao8+6QNXqYn+FPFQQ0z2UE8X0xVuSg5cI9B+K2U98t3anwj ggFppNg4qRnY4ACbUjX2abZJgIQ9TK38gN4a15qHHb+urg2I1x79BH/b89x7D+R2X2M8 7x5A== X-Gm-Message-State: AOAM531S8nM7omJQFhfuVtF0KsK2drW6Jh0+JD82kmsQkjWzUCmBgcAt T9kWPzKc7bU4SyLEzQE5qmerfoLOCXqk X-Received: by 2002:a63:e:: with SMTP id 14mr1879403pga.426.1606902206012; Wed, 02 Dec 2020 01:43:26 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:25 -0800 (PST) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, loic.poulain@linaro.org, Manivannan Sadhasivam Subject: [PATCH 15/29] bus: mhi: core: Skip device wake in error or shutdown states Date: Wed, 2 Dec 2020 15:11:45 +0530 Message-Id: <20201202094159.107075-16-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201202094159.107075-1-manivannan.sadhasivam@linaro.org> References: <20201202094159.107075-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt 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 Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.25.1 diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 805b6fa748f0..029919647002 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);