diff mbox series

[28/29] scsi: ufs: Move the ufs_is_valid_unit_desc_lun() definition

Message ID 20220331223424.1054715-29-bvanassche@acm.org
State Superseded
Headers show
Series UFS patches for kernel v5.19 | expand

Commit Message

Bart Van Assche March 31, 2022, 10:34 p.m. UTC
Move the definition of this function from a public into a private header
file since it is only used inside the UFS core.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ufs/ufs.h         | 19 -------------------
 drivers/scsi/ufs/ufshcd-priv.h | 19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 19 deletions(-)

Comments

Avri Altman April 5, 2022, 6:53 a.m. UTC | #1
> 
> Move the definition of this function from a public into a private header file
> since it is only used inside the UFS core.
Should be in patch 26/29? 

> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/scsi/ufs/ufs.h         | 19 -------------------
>  drivers/scsi/ufs/ufshcd-priv.h | 19 +++++++++++++++++++
>  2 files changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index
> f52173b8ad96..1bba3fead2ce 100644
> --- a/drivers/scsi/ufs/ufs.h
> +++ b/drivers/scsi/ufs/ufs.h
> @@ -620,23 +620,4 @@ enum ufs_trace_tsf_t {
>         UFS_TSF_CDB, UFS_TSF_OSF, UFS_TSF_TM_INPUT,
> UFS_TSF_TM_OUTPUT  };
> 
> -/**
> - * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor
> - * @dev_info: pointer of instance of struct ufs_dev_info
> - * @lun: LU number to check
> - * @return: true if the lun has a matching unit descriptor, false otherwise
> - */
> -static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info,
> -               u8 lun, u8 param_offset)
> -{
> -       if (!dev_info || !dev_info->max_lu_supported) {
> -               pr_err("Max General LU supported by UFS isn't initialized\n");
> -               return false;
> -       }
> -       /* WB is available only for the logical unit from 0 to 7 */
> -       if (param_offset == UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS)
> -               return lun < UFS_UPIU_MAX_WB_LUN_ID;
> -       return lun == UFS_UPIU_RPMB_WLUN || (lun < dev_info-
> >max_lu_supported);
> -}
> -
>  #endif /* End of Header */
> diff --git a/drivers/scsi/ufs/ufshcd-priv.h b/drivers/scsi/ufs/ufshcd-priv.h
> index 4ceb0c63aa15..de699b969aa6 100644
> --- a/drivers/scsi/ufs/ufshcd-priv.h
> +++ b/drivers/scsi/ufs/ufshcd-priv.h
> @@ -274,4 +274,23 @@ static inline int ufshcd_rpm_put(struct ufs_hba
> *hba)
>         return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev);
>  }
> 
> +/**
> + * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit
> +descriptor
> + * @dev_info: pointer of instance of struct ufs_dev_info
> + * @lun: LU number to check
> + * @return: true if the lun has a matching unit descriptor, false
> +otherwise  */ static inline bool ufs_is_valid_unit_desc_lun(struct
> +ufs_dev_info *dev_info,
> +               u8 lun, u8 param_offset) {
> +       if (!dev_info || !dev_info->max_lu_supported) {
> +               pr_err("Max General LU supported by UFS isn't initialized\n");
> +               return false;
> +       }
> +       /* WB is available only for the logical unit from 0 to 7 */
> +       if (param_offset == UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS)
> +               return lun < UFS_UPIU_MAX_WB_LUN_ID;
> +       return lun == UFS_UPIU_RPMB_WLUN || (lun <
> +dev_info->max_lu_supported); }
> +
>  #endif /* _UFSHCD_PRIV_H_ */
Bart Van Assche April 5, 2022, 2:13 p.m. UTC | #2
On 4/4/22 23:53, Avri Altman wrote:
>>
>> Move the definition of this function from a public into a private header file
>> since it is only used inside the UFS core.
>
> Should be in patch 26/29?

Patch 26/29 splits the ufshcd.h header file. This patch moves a 
definition from ufs.h into ufshcd-priv.h. I do not have a strong opinion 
about whether that should happen in separate patches or in a single patch.

Thanks,

Bart.
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
index f52173b8ad96..1bba3fead2ce 100644
--- a/drivers/scsi/ufs/ufs.h
+++ b/drivers/scsi/ufs/ufs.h
@@ -620,23 +620,4 @@  enum ufs_trace_tsf_t {
 	UFS_TSF_CDB, UFS_TSF_OSF, UFS_TSF_TM_INPUT, UFS_TSF_TM_OUTPUT
 };
 
-/**
- * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor
- * @dev_info: pointer of instance of struct ufs_dev_info
- * @lun: LU number to check
- * @return: true if the lun has a matching unit descriptor, false otherwise
- */
-static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info,
-		u8 lun, u8 param_offset)
-{
-	if (!dev_info || !dev_info->max_lu_supported) {
-		pr_err("Max General LU supported by UFS isn't initialized\n");
-		return false;
-	}
-	/* WB is available only for the logical unit from 0 to 7 */
-	if (param_offset == UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS)
-		return lun < UFS_UPIU_MAX_WB_LUN_ID;
-	return lun == UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported);
-}
-
 #endif /* End of Header */
diff --git a/drivers/scsi/ufs/ufshcd-priv.h b/drivers/scsi/ufs/ufshcd-priv.h
index 4ceb0c63aa15..de699b969aa6 100644
--- a/drivers/scsi/ufs/ufshcd-priv.h
+++ b/drivers/scsi/ufs/ufshcd-priv.h
@@ -274,4 +274,23 @@  static inline int ufshcd_rpm_put(struct ufs_hba *hba)
 	return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev);
 }
 
+/**
+ * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor
+ * @dev_info: pointer of instance of struct ufs_dev_info
+ * @lun: LU number to check
+ * @return: true if the lun has a matching unit descriptor, false otherwise
+ */
+static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info,
+		u8 lun, u8 param_offset)
+{
+	if (!dev_info || !dev_info->max_lu_supported) {
+		pr_err("Max General LU supported by UFS isn't initialized\n");
+		return false;
+	}
+	/* WB is available only for the logical unit from 0 to 7 */
+	if (param_offset == UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS)
+		return lun < UFS_UPIU_MAX_WB_LUN_ID;
+	return lun == UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported);
+}
+
 #endif /* _UFSHCD_PRIV_H_ */