public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <mani@kernel.org>
To: Bean Huo <beanhuo@iokpp.de>
Cc: avri.altman@wdc.com, bvanassche@acm.org, alim.akhtar@samsung.com,
	jejb@linux.ibm.com, martin.petersen@oracle.com,
	quic_cang@quicinc.com, quic_asutoshd@quicinc.com,
	beanhuo@micron.com, thomas@t-8ch.de, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, mikebi@micron.com,
	lporzio@micron.com
Subject: Re: [PATCH v4 1/3] scsi: ufs: core: Add ufshcd_is_ufs_dev_busy()
Date: Fri, 8 Dec 2023 18:18:35 +0530	[thread overview]
Message-ID: <20231208124835.GB15552@thinkpad> (raw)
In-Reply-To: <20231208103940.153734-2-beanhuo@iokpp.de>

On Fri, Dec 08, 2023 at 11:39:38AM +0100, Bean Huo wrote:
> 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>
> Reviewed-by: Avri Altman <avri.altman@wdc.com>
> ---
>  drivers/ufs/core/ufshcd.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index f0b837cb0c2b..32cfcba66d60 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -235,6 +235,13 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state,
>  	return UFS_PM_LVL_0;
>  }
>  
> +static inline bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba)

No need to use 'inline' keyword in '.c' files. Compiler has its own decisions.

> +{
> +	return (hba->clk_gating.active_reqs || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL ||

I feel like checking the ufshcd state inside ufshcd_is_ufs_dev_busy() is
somewhat confusing. Because, if "ufshcd_state != UFSHCD_STATE_OPERATIONAL"
returns true, then it means that the ufshc is in non-operational state. But,
non-operational state doesn't mean that the ufs is busy doing some work.

So I propose to move this check outside of ufshcd_is_ufs_dev_busy().

Like,

	if (hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL ||
	    ufshcd_is_ufs_dev_busy(hba))

- Mani

> +		hba->outstanding_reqs || hba->outstanding_tasks || hba->active_uic_cmd ||
> +		hba->uic_async_done);
> +}
> +
>  static const struct ufs_dev_quirk ufs_fixups[] = {
>  	/* UFS cards deviations table */
>  	{ .wmanufacturerid = UFS_VENDOR_MICRON,
> @@ -1917,10 +1924,7 @@ static void ufshcd_gate_work(struct work_struct *work)
>  		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);
> -- 
> 2.34.1
> 

-- 
மணிவண்ணன் சதாசிவம்

  reply	other threads:[~2023-12-08 12:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08 10:39 [PATCH v4 0/3] Add UFS RTC support Bean Huo
2023-12-08 10:39 ` [PATCH v4 1/3] scsi: ufs: core: Add ufshcd_is_ufs_dev_busy() Bean Huo
2023-12-08 12:48   ` Manivannan Sadhasivam [this message]
2023-12-08 10:39 ` [PATCH v4 2/3] scsi: ufs: core: Add UFS RTC support Bean Huo
2023-12-08 14:50   ` Manivannan Sadhasivam
2023-12-08 15:12     ` Bean Huo
2023-12-08 17:06       ` Manivannan Sadhasivam
2023-12-08 17:31         ` Manivannan Sadhasivam
2023-12-10 19:15           ` Bean Huo
2023-12-11 12:09             ` Manivannan Sadhasivam
2023-12-10 19:28         ` Bean Huo
2023-12-11 12:07           ` Manivannan Sadhasivam
2023-12-08 10:39 ` [PATCH v4 3/3] scsi: ufs: core: Add sysfs node for UFS RTC update Bean Huo
2023-12-08 10:57 ` [PATCH v4 0/3] Add UFS RTC support Thomas Weißschuh

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=20231208124835.GB15552@thinkpad \
    --to=mani@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@iokpp.de \
    --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=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