Re: [PATCH v3 7/8] scsi: ufs: core: Toggle Write Booster during clock scaling base on gear speed

Bart Van Assche
2025-02-05T18:09:34Z

On 2/3/25 12:11 AM, Ziqi Chen wrote:
> - /* Enable Write Booster if we have scaled up else disable it */
> - if (ufshcd_enable_wb_if_scaling_up(hba) && !err)
> - ufshcd_wb_toggle(hba, scale_up);
> + /* Enable Write Booster if current gear requires it else disable it */
> + if (ufshcd_enable_wb_if_scaling_up(hba) && !err) {
> + bool wb_en = false;
> +
> + wb_en = hba->pwr_info.gear_rx >= hba->clk_scaling.wb_gear ? true : false;
> + ufshcd_wb_toggle(hba, wb_en);
> + }

Both the " = false" initialization and the "? true : false" part are
unnecessary. Please remove the "wb_en" variable entirely, e.g. as follows:

if (ufshcd_enable_wb_if_scaling_up(hba) && !err)
ufshcd_wb_toggle(hba, hba->pwr_info.gear_rx >=
hba->clk_scaling.wb_gear);

Otherwise this patch looks good to me.

Thanks,

Bart.