Loading drivers/scsi/ufs/ufshcd.c +11 −39 Original line number Diff line number Diff line Loading @@ -6087,37 +6087,6 @@ static int ufshcd_get_lu_wp(struct ufs_hba *hba, return ret; } /* * ufshcd_get_wb_alloc_units - returns "dLUNumWriteBoosterBufferAllocUnits" * @hba: per-adapter instance * @lun: UFS device lun id * @d_lun_wbb_au: pointer to buffer to hold the LU's alloc units info * * Returns 0 in case of success and d_lun_wbb_au would be returned * Returns -ENOTSUPP if reading d_lun_wbb_au is not supported. * Returns -EINVAL in case of invalid parameters passed to this function. */ static int ufshcd_get_wb_alloc_units(struct ufs_hba *hba, u8 lun, u8 *d_lun_wbb_au) { int ret; if (!d_lun_wbb_au) ret = -EINVAL; /* WB can be supported only from LU0..LU7 */ else if (lun >= UFS_UPIU_MAX_GENERAL_LUN) ret = -ENOTSUPP; else ret = ufshcd_read_unit_desc_param(hba, lun, UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS, d_lun_wbb_au, sizeof(*d_lun_wbb_au)); return ret; } /** * ufshcd_get_lu_power_on_wp_status - get LU's power on write protect * status Loading Loading @@ -8497,9 +8466,9 @@ static int ufs_get_device_desc(struct ufs_hba *hba, { int err; size_t buff_len; u8 model_index; u8 *desc_buf, wb_buf[4]; u32 lun, res; u8 model_index, lun; u8 *desc_buf; u32 d_lu_wb_buf_alloc; buff_len = max_t(size_t, hba->desc_size.dev_desc, QUERY_DESC_MAX_SIZE + 1); Loading Loading @@ -8549,14 +8518,17 @@ static int ufs_get_device_desc(struct ufs_hba *hba, hba->dev_info.wb_config_lun = false; for (lun = 0; lun < UFS_UPIU_MAX_GENERAL_LUN; lun++) { memset(wb_buf, 0, sizeof(wb_buf)); err = ufshcd_get_wb_alloc_units(hba, lun, wb_buf); d_lu_wb_buf_alloc = 0; err = ufshcd_read_unit_desc_param(hba, lun, UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS, (u8 *)&d_lu_wb_buf_alloc, sizeof(d_lu_wb_buf_alloc)); if (err) break; res = wb_buf[0] << 24 | wb_buf[1] << 16 | wb_buf[2] << 8 | wb_buf[3]; if (res) { if (d_lu_wb_buf_alloc) { hba->dev_info.wb_config_lun = true; break; } Loading Loading
drivers/scsi/ufs/ufshcd.c +11 −39 Original line number Diff line number Diff line Loading @@ -6087,37 +6087,6 @@ static int ufshcd_get_lu_wp(struct ufs_hba *hba, return ret; } /* * ufshcd_get_wb_alloc_units - returns "dLUNumWriteBoosterBufferAllocUnits" * @hba: per-adapter instance * @lun: UFS device lun id * @d_lun_wbb_au: pointer to buffer to hold the LU's alloc units info * * Returns 0 in case of success and d_lun_wbb_au would be returned * Returns -ENOTSUPP if reading d_lun_wbb_au is not supported. * Returns -EINVAL in case of invalid parameters passed to this function. */ static int ufshcd_get_wb_alloc_units(struct ufs_hba *hba, u8 lun, u8 *d_lun_wbb_au) { int ret; if (!d_lun_wbb_au) ret = -EINVAL; /* WB can be supported only from LU0..LU7 */ else if (lun >= UFS_UPIU_MAX_GENERAL_LUN) ret = -ENOTSUPP; else ret = ufshcd_read_unit_desc_param(hba, lun, UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS, d_lun_wbb_au, sizeof(*d_lun_wbb_au)); return ret; } /** * ufshcd_get_lu_power_on_wp_status - get LU's power on write protect * status Loading Loading @@ -8497,9 +8466,9 @@ static int ufs_get_device_desc(struct ufs_hba *hba, { int err; size_t buff_len; u8 model_index; u8 *desc_buf, wb_buf[4]; u32 lun, res; u8 model_index, lun; u8 *desc_buf; u32 d_lu_wb_buf_alloc; buff_len = max_t(size_t, hba->desc_size.dev_desc, QUERY_DESC_MAX_SIZE + 1); Loading Loading @@ -8549,14 +8518,17 @@ static int ufs_get_device_desc(struct ufs_hba *hba, hba->dev_info.wb_config_lun = false; for (lun = 0; lun < UFS_UPIU_MAX_GENERAL_LUN; lun++) { memset(wb_buf, 0, sizeof(wb_buf)); err = ufshcd_get_wb_alloc_units(hba, lun, wb_buf); d_lu_wb_buf_alloc = 0; err = ufshcd_read_unit_desc_param(hba, lun, UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS, (u8 *)&d_lu_wb_buf_alloc, sizeof(d_lu_wb_buf_alloc)); if (err) break; res = wb_buf[0] << 24 | wb_buf[1] << 16 | wb_buf[2] << 8 | wb_buf[3]; if (res) { if (d_lu_wb_buf_alloc) { hba->dev_info.wb_config_lun = true; break; } Loading