From: Bean Huo <beanhuo@iokpp.de>
To: avri.altman@wdc.com, bvanassche@acm.org, alim.akhtar@samsung.com,
jejb@linux.ibm.com, martin.petersen@oracle.com, mani@kernel.org,
quic_cang@quicinc.com, quic_asutoshd@quicinc.com,
beanhuo@micron.com, thomas@t-8ch.de
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
mikebi@micron.com, lporzio@micron.com
Subject: [PATCH v2 1/3] scsi: ufs: core: Add ufshcd_is_ufs_dev_busy()
Date: Wed, 22 Nov 2023 18:25:10 +0100 [thread overview]
Message-ID: <20231122172512.103748-2-beanhuo@iokpp.de> (raw)
In-Reply-To: <20231122172512.103748-1-beanhuo@iokpp.de>
From: Bean Huo <beanhuo@micron.com>
Add helper inline for retrieving whether UFS device is busy or not.
Signed-off-by: Bean Huo <beanhuo@micron.com>
---
drivers/ufs/core/ufshcd.c | 6 +-----
include/ufs/ufshcd.h | 8 +++++++-
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 68d7da02944f..5d009d2c34f0 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -1916,11 +1916,7 @@ static void ufshcd_gate_work(struct work_struct *work)
hba->clk_gating.state);
goto rel_lock;
}
-
- if (hba->clk_gating.active_reqs
- || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL
- || hba->outstanding_reqs || hba->outstanding_tasks
- || hba->active_uic_cmd || hba->uic_async_done)
+ if (ufshcd_is_ufs_dev_busy(hba))
goto rel_lock;
spin_unlock_irqrestore(hba->host->host_lock, flags);
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 7f0b2c5599cd..b0cd6c6591ef 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -126,7 +126,6 @@ enum uic_link_state {
((h)->curr_dev_pwr_mode == UFS_POWERDOWN_PWR_MODE)
#define ufshcd_is_ufs_dev_deepsleep(h) \
((h)->curr_dev_pwr_mode == UFS_DEEPSLEEP_PWR_MODE)
-
/*
* UFS Power management levels.
* Each level is in increasing order of power savings, except DeepSleep
@@ -1408,6 +1407,13 @@ static inline int ufshcd_vops_phy_initialization(struct ufs_hba *hba)
return 0;
}
+static inline bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba)
+{
+ return (hba->clk_gating.active_reqs || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL ||
+ hba->outstanding_reqs || hba->outstanding_tasks || hba->active_uic_cmd ||
+ hba->uic_async_done);
+}
+
extern const struct ufs_pm_lvl_states ufs_pm_lvl_states[];
int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
--
2.34.1
next prev parent reply other threads:[~2023-11-22 17:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 17:25 [PATCH v2 0/3] Add UFS RTC support Bean Huo
2023-11-22 17:25 ` Bean Huo [this message]
2023-11-22 17:43 ` [PATCH v2 1/3] scsi: ufs: core: Add ufshcd_is_ufs_dev_busy() Bart Van Assche
2023-11-22 17:25 ` [PATCH v2 2/3] scsi: ufs: core: Add UFS RTC support Bean Huo
2023-11-22 17:51 ` Bart Van Assche
2023-11-22 17:25 ` [PATCH v2 3/3] scsi: ufs: core: Add sysfs node for UFS RTC update Bean Huo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231122172512.103748-2-beanhuo@iokpp.de \
--to=beanhuo@iokpp.de \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=lporzio@micron.com \
--cc=mani@kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mikebi@micron.com \
--cc=quic_asutoshd@quicinc.com \
--cc=quic_cang@quicinc.com \
--cc=thomas@t-8ch.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®