Re: [PATCH 3/3] scsi: ufs: use UFS device indicated maximum LU number

From: Bart Van Assche
Date: Sat Jan 11 2020 - 17:50:23 EST


On 2020-01-10 10:36, Bean Huo wrote:
> @@ -548,12 +547,19 @@ struct ufs_dev_desc {
>
> /**
> * 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(u8 lun)
> +static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info,
> + u8 lun)
> {

Can the dev_info be declared 'const' (const truct ufs_dev_info *dev_info)?

> - return lun == UFS_UPIU_RPMB_WLUN || (lun < UFS_UPIU_MAX_GENERAL_LUN);
> + if (!dev_info || !dev_info->max_lu_supported) {
> + pr_err("Max General LU supported by UFS isn't initilized\n");
^^^^^^^^^^
initialized?
> + return false;
> + }
> +
> + return lun == UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported);
> }

Are the parentheses in the above expression necessary?

Thanks,

Bart.