* [PATCH v1 1/1] scsi: ufs: core: Remove ufshcd_urgent_bkops()
@ 2024-08-27 23:14 Bao D. Nguyen
2024-08-28 6:02 ` Avri Altman
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bao D. Nguyen @ 2024-08-27 23:14 UTC (permalink / raw)
To: quic_cang, quic_nitirawa, bvanassche, avri.altman, peter.wang,
manivannan.sadhasivam, adrian.hunter, martin.petersen
Cc: linux-scsi, Bao D. Nguyen, Alim Akhtar, James E.J. Bottomley,
Bean Huo, ChanWoo Lee, Maramaina Naresh, open list
The ufshcd_urgent_bkops() is a wrapper function.
It only calls the ufshcd_bkops_ctrl(). Remove it to
simplify the ufs core driver. Replace any references
to ufshcd_urgent_bkops() with ufshcd_bkops_ctrl().
In addition, remove the second parameter in the
ufshcd_bkops_ctrl() because the information can be
retrieved from the first parameter.
Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
---
drivers/ufs/core/ufshcd.c | 32 +++++++-------------------------
1 file changed, 7 insertions(+), 25 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 21429ee..a52c95b 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -5895,12 +5895,11 @@ static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status)
/**
* ufshcd_bkops_ctrl - control the auto bkops based on current bkops status
* @hba: per-adapter instance
- * @status: bkops_status value
*
* Read the bkops_status from the UFS device and Enable fBackgroundOpsEn
* flag in the device to permit background operations if the device
- * bkops_status is greater than or equal to "status" argument passed to
- * this function, disable otherwise.
+ * bkops_status is greater than or equal to the "hba->urgent_bkops_lvl",
+ * disable otherwise.
*
* Return: 0 for success, non-zero in case of failure.
*
@@ -5908,11 +5907,11 @@ static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status)
* to know whether auto bkops is enabled or disabled after this function
* returns control to it.
*/
-static int ufshcd_bkops_ctrl(struct ufs_hba *hba,
- enum bkops_status status)
+static int ufshcd_bkops_ctrl(struct ufs_hba *hba)
{
- int err;
+ enum bkops_status status = hba->urgent_bkops_lvl;
u32 curr_status = 0;
+ int err;
err = ufshcd_get_bkops_status(hba, &curr_status);
if (err) {
@@ -5934,23 +5933,6 @@ static int ufshcd_bkops_ctrl(struct ufs_hba *hba,
return err;
}
-/**
- * ufshcd_urgent_bkops - handle urgent bkops exception event
- * @hba: per-adapter instance
- *
- * Enable fBackgroundOpsEn flag in the device to permit background
- * operations.
- *
- * If BKOPs is enabled, this function returns 0, 1 if the bkops in not enabled
- * and negative error value for any other failure.
- *
- * Return: 0 upon success; < 0 upon failure.
- */
-static int ufshcd_urgent_bkops(struct ufs_hba *hba)
-{
- return ufshcd_bkops_ctrl(hba, hba->urgent_bkops_lvl);
-}
-
static inline int ufshcd_get_ee_status(struct ufs_hba *hba, u32 *status)
{
return ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR,
@@ -9801,7 +9783,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
* allow background operations if bkops status shows
* that performance might be impacted.
*/
- ret = ufshcd_urgent_bkops(hba);
+ ret = ufshcd_bkops_ctrl(hba);
if (ret) {
/*
* If return err in suspend flow, IO will hang.
@@ -9990,7 +9972,7 @@ static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
* If BKOPs operations are urgently needed at this moment then
* keep auto-bkops enabled or else disable it.
*/
- ufshcd_urgent_bkops(hba);
+ ufshcd_bkops_ctrl(hba);
if (hba->ee_usr_mask)
ufshcd_write_ee_control(hba);
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: [PATCH v1 1/1] scsi: ufs: core: Remove ufshcd_urgent_bkops()
2024-08-27 23:14 [PATCH v1 1/1] scsi: ufs: core: Remove ufshcd_urgent_bkops() Bao D. Nguyen
@ 2024-08-28 6:02 ` Avri Altman
2024-08-28 13:21 ` Manivannan Sadhasivam
2024-08-29 1:18 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Avri Altman @ 2024-08-28 6:02 UTC (permalink / raw)
To: Bao D. Nguyen, quic_cang, quic_nitirawa, bvanassche, peter.wang,
manivannan.sadhasivam, adrian.hunter, martin.petersen
Cc: linux-scsi, Alim Akhtar, James E.J. Bottomley, Bean Huo,
ChanWoo Lee, Maramaina Naresh, open list
> The ufshcd_urgent_bkops() is a wrapper function.
> It only calls the ufshcd_bkops_ctrl(). Remove it to simplify the ufs core driver.
> Replace any references to ufshcd_urgent_bkops() with ufshcd_bkops_ctrl().
>
> In addition, remove the second parameter in the
> ufshcd_bkops_ctrl() because the information can be retrieved from the first
> parameter.
>
> Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Acked-by: Avri Altman <avri.altman@wdc.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] scsi: ufs: core: Remove ufshcd_urgent_bkops()
2024-08-27 23:14 [PATCH v1 1/1] scsi: ufs: core: Remove ufshcd_urgent_bkops() Bao D. Nguyen
2024-08-28 6:02 ` Avri Altman
@ 2024-08-28 13:21 ` Manivannan Sadhasivam
2024-08-29 1:18 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2024-08-28 13:21 UTC (permalink / raw)
To: Bao D. Nguyen
Cc: quic_cang, quic_nitirawa, bvanassche, avri.altman, peter.wang,
adrian.hunter, martin.petersen, linux-scsi, Alim Akhtar,
James E.J. Bottomley, Bean Huo, ChanWoo Lee, Maramaina Naresh,
open list
On Tue, Aug 27, 2024 at 04:14:13PM -0700, Bao D. Nguyen wrote:
> The ufshcd_urgent_bkops() is a wrapper function.
> It only calls the ufshcd_bkops_ctrl(). Remove it to
> simplify the ufs core driver. Replace any references
> to ufshcd_urgent_bkops() with ufshcd_bkops_ctrl().
>
> In addition, remove the second parameter in the
> ufshcd_bkops_ctrl() because the information can be
> retrieved from the first parameter.
>
Maximum allowed columns in patch description is 75, please make use of it.
> Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
- Mani
> ---
> drivers/ufs/core/ufshcd.c | 32 +++++++-------------------------
> 1 file changed, 7 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 21429ee..a52c95b 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -5895,12 +5895,11 @@ static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status)
> /**
> * ufshcd_bkops_ctrl - control the auto bkops based on current bkops status
> * @hba: per-adapter instance
> - * @status: bkops_status value
> *
> * Read the bkops_status from the UFS device and Enable fBackgroundOpsEn
> * flag in the device to permit background operations if the device
> - * bkops_status is greater than or equal to "status" argument passed to
> - * this function, disable otherwise.
> + * bkops_status is greater than or equal to the "hba->urgent_bkops_lvl",
> + * disable otherwise.
> *
> * Return: 0 for success, non-zero in case of failure.
> *
> @@ -5908,11 +5907,11 @@ static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status)
> * to know whether auto bkops is enabled or disabled after this function
> * returns control to it.
> */
> -static int ufshcd_bkops_ctrl(struct ufs_hba *hba,
> - enum bkops_status status)
> +static int ufshcd_bkops_ctrl(struct ufs_hba *hba)
> {
> - int err;
> + enum bkops_status status = hba->urgent_bkops_lvl;
> u32 curr_status = 0;
> + int err;
>
> err = ufshcd_get_bkops_status(hba, &curr_status);
> if (err) {
> @@ -5934,23 +5933,6 @@ static int ufshcd_bkops_ctrl(struct ufs_hba *hba,
> return err;
> }
>
> -/**
> - * ufshcd_urgent_bkops - handle urgent bkops exception event
> - * @hba: per-adapter instance
> - *
> - * Enable fBackgroundOpsEn flag in the device to permit background
> - * operations.
> - *
> - * If BKOPs is enabled, this function returns 0, 1 if the bkops in not enabled
> - * and negative error value for any other failure.
> - *
> - * Return: 0 upon success; < 0 upon failure.
> - */
> -static int ufshcd_urgent_bkops(struct ufs_hba *hba)
> -{
> - return ufshcd_bkops_ctrl(hba, hba->urgent_bkops_lvl);
> -}
> -
> static inline int ufshcd_get_ee_status(struct ufs_hba *hba, u32 *status)
> {
> return ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR,
> @@ -9801,7 +9783,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> * allow background operations if bkops status shows
> * that performance might be impacted.
> */
> - ret = ufshcd_urgent_bkops(hba);
> + ret = ufshcd_bkops_ctrl(hba);
> if (ret) {
> /*
> * If return err in suspend flow, IO will hang.
> @@ -9990,7 +9972,7 @@ static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> * If BKOPs operations are urgently needed at this moment then
> * keep auto-bkops enabled or else disable it.
> */
> - ufshcd_urgent_bkops(hba);
> + ufshcd_bkops_ctrl(hba);
>
> if (hba->ee_usr_mask)
> ufshcd_write_ee_control(hba);
> --
> 2.7.4
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v1 1/1] scsi: ufs: core: Remove ufshcd_urgent_bkops()
2024-08-27 23:14 [PATCH v1 1/1] scsi: ufs: core: Remove ufshcd_urgent_bkops() Bao D. Nguyen
2024-08-28 6:02 ` Avri Altman
2024-08-28 13:21 ` Manivannan Sadhasivam
@ 2024-08-29 1:18 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2024-08-29 1:18 UTC (permalink / raw)
To: Bao D. Nguyen
Cc: quic_cang, quic_nitirawa, bvanassche, avri.altman, peter.wang,
manivannan.sadhasivam, adrian.hunter, martin.petersen,
linux-scsi, Alim Akhtar, James E.J. Bottomley, Bean Huo,
ChanWoo Lee, Maramaina Naresh, open list
Bao,
> The ufshcd_urgent_bkops() is a wrapper function. It only calls the
> ufshcd_bkops_ctrl(). Remove it to simplify the ufs core driver.
> Replace any references to ufshcd_urgent_bkops() with
> ufshcd_bkops_ctrl().
Applied to 6.12/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-29 1:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-27 23:14 [PATCH v1 1/1] scsi: ufs: core: Remove ufshcd_urgent_bkops() Bao D. Nguyen
2024-08-28 6:02 ` Avri Altman
2024-08-28 13:21 ` Manivannan Sadhasivam
2024-08-29 1:18 ` Martin K. Petersen
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®