Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp413009pxv; Thu, 24 Jun 2021 10:37:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsBf/Qy74qfNcOhIxsyV++muApuw/QvGbAMFT7Ne5t43+qCEOjlLI/+dsggeNpfHMMPvOZ X-Received: by 2002:aa7:c991:: with SMTP id c17mr8681594edt.195.1624556223304; Thu, 24 Jun 2021 10:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624556223; cv=none; d=google.com; s=arc-20160816; b=xNal1M68Z84LDbAJe3t/tF1Sb0ll0dqMbhmHemB6u5FE+yRYGYB9n5LA7mWCgrvHqo TsYpk795T6xJsPxLdqOmP/WMvx3xQ8Tg5wrNuVKUTJbozPZVos6FBBM4ECziEaYEqQ/I qDra0z5uIklTImod2stRq5tMqi3yvsP/9j9kAF5JJFvqen2RJKEgS4GN4KgJoPySnO1U EhrWIWdoTR4XKrPv/CfDFx7WNbadgVqRvNAYAT6IhYI2ob+FbC77rRautmcyCF3+i4dW gLj9qbUiK5yXafBL5WhVKuUTvjZwB3yAQArLYhuD47bCaFru6mO9L8kxXZ43tAyD2I4K 9N3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=x8YDqjlY3Yhk+5aYy3Mt9hst4lMIKy4S0P/FHR83jL8=; b=B+MgCXForyeDDD1b//Nt/h6PTxE6I6Cit1tUUodoOVbQykBkoYhy+0iAsjlhNdH4Xh xJtvOP0/Y+kyIWAdIa4Fwi4VDIJjb+mSDeJLDnhqT12ns4/zYpk8lloEG9VJTU/7pc5R iwF03iyK5xNC3DrK4PMzLFbIbig9R7/ynTzQc1ONG+dggBmHhBSdTHJYVMs2Y/omb+dA PYpbuiG0iXNxi/adoJx3VGg/62yLboUGLKuSVZlVO69o6yU+KEoCBEzhivONur+4tIKV J65ZGW/R6V+7Nip7zYFZhoVizwvRwHEUxts5fNxImRkicDiQNe64huC/jd25dGNfp0u1 khbw== ARC-Authentication-Results: i=1; mx.google.com; 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 nc23si3285551ejc.167.2021.06.24.10.36.39; Thu, 24 Jun 2021 10:37:03 -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; 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 S232304AbhFXRh6 (ORCPT + 99 others); Thu, 24 Jun 2021 13:37:58 -0400 Received: from mail-pl1-f171.google.com ([209.85.214.171]:33768 "EHLO mail-pl1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229721AbhFXRh5 (ORCPT ); Thu, 24 Jun 2021 13:37:57 -0400 Received: by mail-pl1-f171.google.com with SMTP id f10so3346714plg.0; Thu, 24 Jun 2021 10:35:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=x8YDqjlY3Yhk+5aYy3Mt9hst4lMIKy4S0P/FHR83jL8=; b=Q0y4ptmW0uzOAH9w5y/glR/NMa2sx0qfeAAsx0/jAiZ9QqFJjmnYDJIr8EMBb0SDYK svmhVJT5kEWQWWejOo4k8dJUIKgqU0jjnDbRLnbVswJ6+pfjdiUeqfhAS7xse3JkUE8N WGlZP1d7eCzquVbQUEUlkbjyDguFIlDfs1aij/TPeQ9k9ZHsExZD4gzU2TncUi1yOWda 3tsI2NPrsw47f7yYbeTEqb0+mawMJ2jUPRHAuXqBnOc02qt4w44pmnwyGyfVu36H/lQ1 FJEKJav9Wn5pxB+ai/LvNGPuUZwCasdqomoWkba+FAXQPgWV1PxkoEhbJMnDqwz+M5fX z4JA== X-Gm-Message-State: AOAM532J7GgFvHFVyvl3/0mF5ZOPRKa7iOwd2jJO1Qocu80brp9oLbs4 eBZ37cp5eTukxJvu57XjIsF1agTKW54UHQ== X-Received: by 2002:a17:90a:6404:: with SMTP id g4mr16349851pjj.155.1624556136704; Thu, 24 Jun 2021 10:35:36 -0700 (PDT) Received: from [192.168.3.217] (c-73-241-217-19.hsd1.ca.comcast.net. [73.241.217.19]) by smtp.gmail.com with ESMTPSA id c62sm3444447pfa.12.2021.06.24.10.35.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 10:35:35 -0700 (PDT) Subject: Re: [PATCH v4 02/10] scsi: ufs: Add flags pm_op_in_progress and is_sys_suspended To: Can Guo , asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, ziqichen@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com Cc: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Jaegeuk Kim , Adrian Hunter , Satya Tangirala , Kiwoong Kim , open list References: <1624433711-9339-1-git-send-email-cang@codeaurora.org> <1624433711-9339-3-git-send-email-cang@codeaurora.org> From: Bart Van Assche Message-ID: <77b92c6e-2e1c-c799-f6ac-04467175f96a@acm.org> Date: Thu, 24 Jun 2021 10:35:33 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <1624433711-9339-3-git-send-email-cang@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/23/21 12:35 AM, Can Guo wrote: > @@ -9141,6 +9143,8 @@ static int ufshcd_suspend(struct ufs_hba *hba) > > if (!hba->is_powered) > return 0; > + > + hba->pm_op_in_progress = true; > /* > * Disable the host irq as host controller as there won't be any > * host controller transaction expected till resume. > @@ -9160,6 +9164,7 @@ static int ufshcd_suspend(struct ufs_hba *hba) > ufshcd_vreg_set_lpm(hba); > /* Put the host controller in low power mode if possible */ > ufshcd_hba_vreg_set_lpm(hba); > + hba->pm_op_in_progress = false; > return ret; > } > > @@ -9179,6 +9184,7 @@ static int ufshcd_resume(struct ufs_hba *hba) > if (!hba->is_powered) > return 0; > > + hba->pm_op_in_progress = true; > ufshcd_hba_vreg_set_hpm(hba); > ret = ufshcd_vreg_set_hpm(hba); > if (ret) > @@ -9198,6 +9204,7 @@ static int ufshcd_resume(struct ufs_hba *hba) > out: > if (ret) > ufshcd_update_evt_hist(hba, UFS_EVT_RESUME_ERR, (u32)ret); > + hba->pm_op_in_progress = false; > return ret; > } Has it been considered to check dev->power.runtime_status instead of introducing the pm_op_in_progress variable? Thanks, Bart.